34 using namespace Linux;
70 fprintf(stderr,
"WARNING!! potentially wrong counters!!!");
76 "(no events)\n", c.name);
84 c.name, c.count, c.min, c.max, c.avg, sqrt(c.m2));
113 uintptr_t idx = (uintptr_t)pc;
121 hal.
console->
printf(
"perf_begin() called on perf_counter_t(%s) that" 122 " is not of PC_ELAPSED type.\n",
127 if (perf.
start != 0) {
128 hal.
console->
printf(
"perf_begin() called twice on perf_counter_t(%s)\n",
142 uintptr_t idx = (uintptr_t)pc;
150 hal.
console->
printf(
"perf_begin() called on perf_counter_t(%s) that" 151 " is not of PC_ELAPSED type.\n",
156 if (perf.
start == 0) {
157 hal.
console->
printf(
"perf_begin() called before begin() on perf_counter_t(%s)\n",
166 perf.
total += elapsed;
168 if (perf.
min > elapsed) {
172 if (perf.
max < elapsed) {
181 const double delta_intvl = elapsed - perf.
avg;
182 perf.
avg += (delta_intvl / perf.
count);
183 perf.
m2 += (delta_intvl * (elapsed - perf.
avg));
191 uintptr_t idx = (uintptr_t)pc;
199 hal.
console->
printf(
"perf_begin() called on perf_counter_t(%s) that" 200 " is not of PC_COUNT type.\n",
void end(perf_counter_t pc)
void clock_gettime(uint32_t a1, void *a2)
std::vector< Perf_Counter > _perf_counters
AP_HAL::UARTDriver * console
void begin(perf_counter_t pc)
std::atomic< unsigned int > _update_count
pthread_rwlock_t _perf_counters_lock
virtual void printf(const char *,...) FMT_PRINTF(2
void end(const char *name)
static const AP_HAL::HAL & hal
perf_counter_t add(perf_counter_type type, const char *name)
virtual void register_timer_process(AP_HAL::MemberProc)=0
void count(perf_counter_t pc)
uint64_t _last_debug_msec
void begin(const char *name)
int fprintf(FILE *fp, const char *fmt,...)
fprintf character write function
static Perf * get_instance()
#define FUNCTOR_BIND_MEMBER(func, rettype,...)
void panic(const char *errormsg,...) FMT_PRINTF(1
static uint64_t now_nsec()
AP_HAL::Scheduler * scheduler
void count(const char *name, uint64_t val)