diff options
author | Andy Lutomirski <luto@kernel.org> | 2015-07-09 15:01:00 -0700 |
---|---|---|
committer | Andy Lutomirski <luto@kernel.org> | 2015-07-09 15:01:00 -0700 |
commit | 4bfa4d8349a9e6a3747812ea9af49f211a621237 (patch) | |
tree | bfa8208a7ca84eff2e77f11b3e24058ebfe6a516 | |
parent | 3609a4c498a91389a9acb5d5fc81b5781028f789 (diff) | |
download | misc-tests-4bfa4d8349a9e6a3747812ea9af49f211a621237.tar.gz |
perf_self_monitor: improve output
Signed-off-by: Andy Lutomirski <luto@kernel.org>
-rw-r--r-- | tight_loop/perf_self_monitor.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tight_loop/perf_self_monitor.c b/tight_loop/perf_self_monitor.c index 33c2be2..378d0fd 100644 --- a/tight_loop/perf_self_monitor.c +++ b/tight_loop/perf_self_monitor.c @@ -98,9 +98,9 @@ struct psm_atomic { uint64_t initial_raw_count; /* - * This is here to improve code generation. struct psm_atomic is - * unlikely to exist as escaped and hence be affected by a "memory" - * clobber. + * This is here to improve code generation. struct psm_atomic + * is unlikely to be referenced by an escapted pointer and hence + * be affected by a "memory" clobber. */ unsigned int rdpmc_ecx; }; @@ -227,8 +227,15 @@ int main() psm_settle(ctr, psm_atomic_sample_empty, NULL); + uint64_t baseline = + psm_integer_quantile(ctr, psm_atomic_sample_empty, + NULL, 250, 500); + printf("An empty sample takes %llu cycles\n", + (unsigned long long)baseline); + for (int i = 0; i < 20; i++) { - printf("%llu\n", (unsigned long long)psm_integer_quantile(ctr, psm_atomic_sample_enosys, NULL, 0, 500)); + uint64_t cost = psm_integer_quantile(ctr, psm_atomic_sample_enosys, NULL, 250, 500) - baseline; + printf("%llu\n", (unsigned long long)cost); } psm_counter_destroy(ctr); |