From 7a346fbf8ce35978524e85dd2c19768640f20c89 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Thu, 20 Nov 2003 01:10:03 +0000 Subject: [PATCH] Measure with caching disabled, global caching, and thread-local caching. (Logical change 1.114) --- tests/Gperf-simple.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/Gperf-simple.c b/tests/Gperf-simple.c index 39ca4adc..003c0fcf 100644 --- a/tests/Gperf-simple.c +++ b/tests/Gperf-simple.c @@ -48,7 +48,7 @@ measure_unwind (int maxlevel) panic ("Unwound only %d levels, expected at least %d levels", level, maxlevel); - printf ("initialization time = %gnsec, time per unwind-step = %gnsec\n", + printf (" unw_{getcontext+init_local}: %9.3f nsec, unw_step: %9.3f nsec\n", 1e9*(mid - start), 1e9*(stop - mid)/level); return 0; } @@ -71,6 +71,18 @@ main (int argc, char **argv) if (argc > 1) maxlevel = atol (argv[1]); + printf ("Caching: none\n"); + unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE); + for (i = 0; i < 20; ++i) + f1 (0, maxlevel); + + printf ("Caching: global\n"); + unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL); + for (i = 0; i < 20; ++i) + f1 (0, maxlevel); + + printf ("Caching: per-thread\n"); + unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD); for (i = 0; i < 20; ++i) f1 (0, maxlevel); return 0;