28 lines
721 B
C
28 lines
721 B
C
#ifndef LIBBARRELFISH_PERFORMANCE_H
|
|
#define LIBBARRELFISH_PERFORMANCE_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#define PERFORMANCE_MEASUREMENT_COUNT_MAX 10
|
|
|
|
// uncomment to enable performance measurements
|
|
// #define PERFORMANCE_ENABLED
|
|
|
|
struct measurement {
|
|
char *tag;
|
|
systime_t timestamp;
|
|
};
|
|
|
|
struct performance_context {
|
|
size_t count;
|
|
char *name;
|
|
struct measurement measurements[PERFORMANCE_MEASUREMENT_COUNT_MAX];
|
|
};
|
|
|
|
void perf_init(struct performance_context *c, char *name);
|
|
void perf_add_measurement(struct performance_context *c, char *tag, systime_t timestamp);
|
|
void perf_add_now(struct performance_context *c, char *tag);
|
|
void perf_print(struct performance_context *c);
|
|
|
|
#endif // LIBBARRELFISH_PERFORMANCE_H
|