mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
AP_HAL_Linux: rename min, max and avg fields
These were probably named otherwise in order not to conflict with min/max macros from math.h. We don't have this problem anymore.
This commit is contained in:
parent
b8e3e549c7
commit
4a18108600
@ -77,7 +77,7 @@ void Perf::_debug_counters()
|
||||
"max: %llu\t"
|
||||
"avg: %.4f\t"
|
||||
"stddev: %.4f\n",
|
||||
c.name, c.count, c.least, c.most, c.mean, sqrt(c.m2));
|
||||
c.name, c.count, c.min, c.max, c.avg, sqrt(c.m2));
|
||||
} else {
|
||||
fprintf(stderr, "%-30s\t"
|
||||
"count: %llu\n",
|
||||
@ -161,22 +161,22 @@ void Perf::end(Util::perf_counter_t pc)
|
||||
perf.count++;
|
||||
perf.total += elapsed;
|
||||
|
||||
if (perf.least > elapsed) {
|
||||
perf.least = elapsed;
|
||||
if (perf.min > elapsed) {
|
||||
perf.min = elapsed;
|
||||
}
|
||||
|
||||
if (perf.most < elapsed) {
|
||||
perf.most = elapsed;
|
||||
if (perf.max < elapsed) {
|
||||
perf.max = elapsed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Maintain mean and variance of interval in nanoseconds
|
||||
* Knuth/Welford recursive mean and variance of update intervals (via Wikipedia)
|
||||
* Maintain avg and variance of interval in nanoseconds
|
||||
* Knuth/Welford recursive avg and variance of update intervals (via Wikipedia)
|
||||
* Same implementation of PX4.
|
||||
*/
|
||||
const double delta_intvl = elapsed - perf.mean;
|
||||
perf.mean += (delta_intvl / perf.count);
|
||||
perf.m2 += (delta_intvl * (elapsed - perf.mean));
|
||||
const double delta_intvl = elapsed - perf.avg;
|
||||
perf.avg += (delta_intvl / perf.count);
|
||||
perf.m2 += (delta_intvl * (elapsed - perf.avg));
|
||||
perf.start = 0;
|
||||
|
||||
perf.lttng.end(perf.name);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
Perf_Counter(perf_counter_type type_, const char *name_)
|
||||
: name{name_}
|
||||
, type{type_}
|
||||
, least{ULONG_MAX}
|
||||
, min{ULONG_MAX}
|
||||
{
|
||||
}
|
||||
|
||||
@ -51,10 +51,10 @@ public:
|
||||
/* Everything below is in nanoseconds */
|
||||
uint64_t start;
|
||||
uint64_t total;
|
||||
uint64_t least;
|
||||
uint64_t most;
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
|
||||
double mean;
|
||||
double avg;
|
||||
double m2;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user