18#ifndef __KOS_PERF_MONITOR_H
19#define __KOS_PERF_MONITOR_H
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
const char * fn
Definition perf_monitor.h:42
uint64_t time_ns
Definition perf_monitor.h:45
uint64_t event0
Definition perf_monitor.h:46
void perf_monitor_print(FILE *f)
Print statistics about the probe points to the given file descriptor.
uint64_t calls
Definition perf_monitor.h:44
uint64_t time_start
Definition perf_monitor.h:45
unsigned int line
Definition perf_monitor.h:43
void perf_monitor_exit(void)
De-initialize the performance monitor system.
uint64_t event1_start
Definition perf_monitor.h:47
struct perf_monitor * __start_perf_monitor(struct perf_monitor *monitor)
void __stop_perf_monitor(struct perf_monitor **monitor)
void perf_monitor_init(perf_cntr_event_t event1, perf_cntr_event_t event2)
Initialize the performance monitor system.
uint64_t event1
Definition perf_monitor.h:47
uint64_t event0_start
Definition perf_monitor.h:46
Low-level performance counter API.
Basic sys/stdio.h file from newlib.
/cond
Definition perf_monitor.h:41