18#ifndef __KOS_PERF_MONITOR_H
19#define __KOS_PERF_MONITOR_H
45 uint64_t time_ns, time_start;
46 uint64_t event0, event0_start;
47 uint64_t event1, event1_start;
54#define __perf_monitor(f, l) \
55 static struct perf_monitor __perf_monitor_##l \
56 __attribute__((section(".monitors"))) = { f, l, }; \
57 struct perf_monitor *___perf_monitor_##l \
58 __attribute__((cleanup(__stop_perf_monitor))) = \
59 __start_perf_monitor(&__perf_monitor_##l)
61#define _perf_monitor(f, l) __perf_monitor(f, l)
63#define __perf_monitor_if(f, l, tst) ({ \
64 static struct perf_monitor __perf_monitor_##l \
65 __attribute__((section(".monitors"))) = { f, l, }; \
66 __perf_monitor_##l.calls++; \
67 (tst) ? (__perf_monitor_##l.event1++,1) : (__perf_monitor_##l.event0++,0); \
70#define _perf_monitor_if(f, l, tst) __perf_monitor_if(f, l, tst)
78#define perf_monitor() _perf_monitor(__func__, __LINE__)
92#define perf_monitor_if(tst) _perf_monitor_if(__func__, __LINE__, tst)
perf_cntr_event_t
Performance Counter Event Modes.
Definition perfctr.h:90
#define perf_monitor()
Register a performance monitor in the current functional block.
Definition perf_monitor.h:78
void perf_monitor_print(FILE *f)
Print statistics about the probe points to the given file descriptor.
void perf_monitor_exit(void)
De-initialize the performance monitor system.
void perf_monitor_init(perf_cntr_event_t event1, perf_cntr_event_t event2)
Initialize the performance monitor system.
Low-level performance counter API.
Basic sys/stdio.h file from newlib.