#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 {
    const char *tag;
    systime_t timestamp;
};

struct performance_context {
    size_t count;
    const char *name;
    struct measurement measurements[PERFORMANCE_MEASUREMENT_COUNT_MAX];
};

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
