@@ -3,16 +3,18 @@
33
44#ifdef IDRIS_ENABLE_STATS
55#include <time.h>
6+#include <inttypes.h>
7+#include <stdint.h>
68#endif
79
810
911// TODO: measure user time, exclusive/inclusive stats
1012typedef struct {
1113#ifdef IDRIS_ENABLE_STATS
12− int allocations; // Size of allocated space in bytes for all execution time.
13− int alloc_count; // How many times alloc is called.
14− int copied; // Size of space copied during GC.
15− int max_heap_size; // Maximum heap size achieved.
14+ uint64_t allocations; // Size of allocated space in bytes for all execution time.
15+ uint32_t alloc_count; // How many times alloc is called.
16+ uint64_t copied; // Size of space copied during GC.
17+ uint32_t max_heap_size; // Maximum heap size achieved.
1618
1719 clock_t init_time; // Time spent for vm initialization.
1820 clock_t exit_time; // Time spent for vm termination.
@@ -20,7 +22,7 @@ typedef struct {
2022 clock_t max_gc_pause; // Time spent for longest gc.
2123 clock_t start_time; // Time of rts entry point.
2224#endif // IDRIS_ENABLE_STATS
23− int collections; // How many times gc called.
25+ uint32_t collections; // How many times gc called.
2426} Stats; // without start time it's a monoid, can we remove start_time it somehow?
2527
2628void print_stats(const Stats * stats);
@@ -35,7 +37,7 @@ void aggregate_stats(Stats * stats1, const Stats * stats2);
3537
3638#define STATS_INIT_STATS(stats) \
3739 memset(&stats, 0, sizeof(Stats)); \
38− stats.start_time = clock();
40+ stats.start_time = clock();
3941
4042#define STATS_ALLOC(stats, size) \
4143 stats.allocations += size; \
@@ -60,8 +62,8 @@ void aggregate_stats(Stats * stats1, const Stats * stats2);
6062
6163#else
6264#define STATS_INIT_STATS(stats) memset(&stats, 0, sizeof(Stats));
63−#define STATS_ENTER_INIT(stats)
64−#define STATS_LEAVE_INIT(stats)
65+#define STATS_ENTER_INIT(stats)
66+#define STATS_LEAVE_INIT(stats)
6567#define STATS_ENTER_EXIT(stats)
6668#define STATS_LEAVE_EXIT(stats)
6769#define STATS_ALLOC(stats, size)