diff --git a/include/aos/performance.h b/include/aos/performance.h index b093fa3..70c9e16 100644 --- a/include/aos/performance.h +++ b/include/aos/performance.h @@ -9,19 +9,19 @@ // #define PERFORMANCE_ENABLED struct measurement { - char *tag; + const char *tag; systime_t timestamp; }; struct performance_context { size_t count; - char *name; + const 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_init(struct performance_context *c, const char *name); +void perf_add_measurement(struct performance_context *c, const char *tag, systime_t timestamp); +void perf_add_now(struct performance_context *c, const char *tag); void perf_print(struct performance_context *c); #endif // LIBBARRELFISH_PERFORMANCE_H diff --git a/lib/aos/performance.c b/lib/aos/performance.c index 9eb0e8c..77cbd1e 100644 --- a/lib/aos/performance.c +++ b/lib/aos/performance.c @@ -3,15 +3,18 @@ #include #include -void perf_init(struct performance_context *c, char *name) { +void perf_init(struct performance_context *c, const char *name) { c->count = 0; c->name = name; - memset(c->measurements, 0, sizeof(c->measurements)); } -inline void perf_add_measurement(struct performance_context *c, char *tag, systime_t timestamp) +inline void perf_add_measurement(struct performance_context *c, const char *tag, systime_t timestamp) { assert(c->count < PERFORMANCE_MEASUREMENT_COUNT_MAX); + + __asm volatile ( + "dmb sy\n" + ); c->measurements[c->count].tag = tag; c->measurements[c->count].timestamp = timestamp; c->count++; @@ -20,7 +23,7 @@ inline void perf_add_measurement(struct performance_context *c, char *tag, systi ); } -inline void perf_add_now(struct performance_context *c, char *tag) +inline void perf_add_now(struct performance_context *c, const char *tag) { systime_t now = systime_now(); perf_add_measurement(c, tag, now);