From bfa35f7d6234b38d18fafb529f11348d6f15488c Mon Sep 17 00:00:00 2001 From: Patrick Lipka Date: Fri, 8 Aug 2025 15:54:28 +0200 Subject: [PATCH] add stats comparison --- src/rvprof_output.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/rvprof_output.c diff --git a/src/rvprof_output.c b/src/rvprof_output.c new file mode 100644 index 0000000..56ed6f6 --- /dev/null +++ b/src/rvprof_output.c @@ -0,0 +1,15 @@ +#include "rvprof_internal.h" + +// comparison used to sort regions by exclusive time +static int compare_functions(const void* fn_a, const void* fn_b){ + const function_stats_t* stats_a = (const function_stats_t*)fn_a; + const function_stats_t* stats_b = (const function_stats_t*)fn_b; + + if (stats_a->total_exclusive_time > stats_b->total_exclusive_time){ + return -1; + } else if (stats_a->total_exclusive_time < stats_b->total_exclusive_time){ + return 1; + } else{ + return 0; + } +} \ No newline at end of file