summaryrefslogtreecommitdiff
path: root/src/util/perf_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/perf_malloc.c')
-rw-r--r--src/util/perf_malloc.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c
index ee2281edd..3682777bd 100644
--- a/src/util/perf_malloc.c
+++ b/src/util/perf_malloc.c
@@ -28,36 +28,37 @@
28#include <gauger.h> 28#include <gauger.h>
29 29
30static uint64_t 30static uint64_t
31perfMalloc() 31perfMalloc ()
32{ 32{
33 size_t i; 33 size_t i;
34 uint64_t ret; 34 uint64_t ret;
35 35
36 ret = 0; 36 ret = 0;
37 for (i = 1; i < 1024 * 1024; i += 1024) 37 for (i = 1; i < 1024 * 1024; i += 1024)
38 { 38 {
39 ret += i; 39 ret += i;
40 GNUNET_free(GNUNET_malloc(i)); 40 GNUNET_free (GNUNET_malloc (i));
41 } 41 }
42 return ret; 42 return ret;
43} 43}
44 44
45 45
46int 46int
47main(int argc, char *argv[]) 47main (int argc, char *argv[])
48{ 48{
49 struct GNUNET_TIME_Absolute start; 49 struct GNUNET_TIME_Absolute start;
50 uint64_t kb; 50 uint64_t kb;
51 51
52 start = GNUNET_TIME_absolute_get(); 52 start = GNUNET_TIME_absolute_get ();
53 kb = perfMalloc(); 53 kb = perfMalloc ();
54 printf("Malloc perf took %s\n", 54 printf ("Malloc perf took %s\n",
55 GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start), 55 GNUNET_STRINGS_relative_time_to_string (
56 GNUNET_YES)); 56 GNUNET_TIME_absolute_get_duration (start),
57 GAUGER("UTIL", "Allocation", 57 GNUNET_YES));
58 kb / 1024 / (1 + 58 GAUGER ("UTIL", "Allocation",
59 GNUNET_TIME_absolute_get_duration 59 kb / 1024 / (1
60 (start).rel_value_us / 1000LL), "kb/ms"); 60 + GNUNET_TIME_absolute_get_duration
61 (start).rel_value_us / 1000LL), "kb/ms");
61 return 0; 62 return 0;
62} 63}
63 64