Add dynamic array structure

This commit is contained in:
Patrick Lipka 2025-08-07 16:05:40 +02:00
parent 88ce871058
commit 1b5e488b45
1 changed files with 13 additions and 1 deletions

View File

@ -58,7 +58,7 @@ typedef struct {
char caller [MAX_NAME_LEN];
uint64_t total_inclusive_time;
uint64_t total_exclusive_time;
uint64_t total_inclusive_cycles;
uint64_t total_inclusive_cycles;
uint64_t total_exclusive_cycles;
uint64_t call_count;
int* stack_ids;
@ -71,6 +71,18 @@ typedef struct {
double inclusive_percent;
} function_stats_t;
// dynamic array structure (could switch to a more sophisticated container + template if we would move to C++ at some point)
#define DECLARE_DYNAMIC_ARRAY(type, name) \
typedef struct { \
type* data; \
int size; \
int capacity; \
} name##_array_t;
DECLARE_DYNAMIC_ARRAY(region_t, region);
DECLARE_DYNAMIC_ARRAY(function_stats_t, function_stats);
DECLARE_DYNAMIC_ARRAY(symbol_entry_t, symbol);
#ifdef __cplusplus
}
#endif