diff options
author | Andi Kleen <ak@linux.intel.com> | 2015-03-11 11:28:01 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-13 06:46:10 -0400 |
commit | 56f0fd45d8df51542930b9b2e1acee5034b53479 (patch) | |
tree | 1b7fca0f64cda22963390eddda9547e6307bb5ae /tools | |
parent | d73515c03c6a2706e088094ff6095a3abefd398b (diff) |
perf stat: Fix IPC and other formulas with -A
perf stat didn't compute the IPC and other formulas for individual CPUs
with -A. Fix this for the easy -A case. As before, --per-core and
--per-socket do not handle it, they simply print nothing.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1426087682-22765-2-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-stat.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d58e50cbc6ec..c95dbdad98c3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -353,39 +353,40 @@ static struct perf_evsel *nth_evsel(int n) | |||
353 | * more semantic information such as miss/hit ratios, | 353 | * more semantic information such as miss/hit ratios, |
354 | * instruction rates, etc: | 354 | * instruction rates, etc: |
355 | */ | 355 | */ |
356 | static void update_shadow_stats(struct perf_evsel *counter, u64 *count) | 356 | static void update_shadow_stats(struct perf_evsel *counter, u64 *count, |
357 | int cpu) | ||
357 | { | 358 | { |
358 | if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK)) | 359 | if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK)) |
359 | update_stats(&runtime_nsecs_stats[0], count[0]); | 360 | update_stats(&runtime_nsecs_stats[cpu], count[0]); |
360 | else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) | 361 | else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) |
361 | update_stats(&runtime_cycles_stats[0], count[0]); | 362 | update_stats(&runtime_cycles_stats[cpu], count[0]); |
362 | else if (transaction_run && | 363 | else if (transaction_run && |
363 | perf_evsel__cmp(counter, nth_evsel(T_CYCLES_IN_TX))) | 364 | perf_evsel__cmp(counter, nth_evsel(T_CYCLES_IN_TX))) |
364 | update_stats(&runtime_cycles_in_tx_stats[0], count[0]); | 365 | update_stats(&runtime_cycles_in_tx_stats[cpu], count[0]); |
365 | else if (transaction_run && | 366 | else if (transaction_run && |
366 | perf_evsel__cmp(counter, nth_evsel(T_TRANSACTION_START))) | 367 | perf_evsel__cmp(counter, nth_evsel(T_TRANSACTION_START))) |
367 | update_stats(&runtime_transaction_stats[0], count[0]); | 368 | update_stats(&runtime_transaction_stats[cpu], count[0]); |
368 | else if (transaction_run && | 369 | else if (transaction_run && |
369 | perf_evsel__cmp(counter, nth_evsel(T_ELISION_START))) | 370 | perf_evsel__cmp(counter, nth_evsel(T_ELISION_START))) |
370 | update_stats(&runtime_elision_stats[0], count[0]); | 371 | update_stats(&runtime_elision_stats[cpu], count[0]); |
371 | else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_FRONTEND)) | 372 | else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_FRONTEND)) |
372 | update_stats(&runtime_stalled_cycles_front_stats[0], count[0]); | 373 | update_stats(&runtime_stalled_cycles_front_stats[cpu], count[0]); |
373 | else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_BACKEND)) | 374 | else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_BACKEND)) |
374 | update_stats(&runtime_stalled_cycles_back_stats[0], count[0]); | 375 | update_stats(&runtime_stalled_cycles_back_stats[cpu], count[0]); |
375 | else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS)) | 376 | else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS)) |
376 | update_stats(&runtime_branches_stats[0], count[0]); | 377 | update_stats(&runtime_branches_stats[cpu], count[0]); |
377 | else if (perf_evsel__match(counter, HARDWARE, HW_CACHE_REFERENCES)) | 378 | else if (perf_evsel__match(counter, HARDWARE, HW_CACHE_REFERENCES)) |
378 | update_stats(&runtime_cacherefs_stats[0], count[0]); | 379 | update_stats(&runtime_cacherefs_stats[cpu], count[0]); |
379 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1D)) | 380 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1D)) |
380 | update_stats(&runtime_l1_dcache_stats[0], count[0]); | 381 | update_stats(&runtime_l1_dcache_stats[cpu], count[0]); |
381 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1I)) | 382 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1I)) |
382 | update_stats(&runtime_l1_icache_stats[0], count[0]); | 383 | update_stats(&runtime_l1_icache_stats[cpu], count[0]); |
383 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_LL)) | 384 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_LL)) |
384 | update_stats(&runtime_ll_cache_stats[0], count[0]); | 385 | update_stats(&runtime_ll_cache_stats[cpu], count[0]); |
385 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_DTLB)) | 386 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_DTLB)) |
386 | update_stats(&runtime_dtlb_cache_stats[0], count[0]); | 387 | update_stats(&runtime_dtlb_cache_stats[cpu], count[0]); |
387 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_ITLB)) | 388 | else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_ITLB)) |
388 | update_stats(&runtime_itlb_cache_stats[0], count[0]); | 389 | update_stats(&runtime_itlb_cache_stats[cpu], count[0]); |
389 | } | 390 | } |
390 | 391 | ||
391 | static void zero_per_pkg(struct perf_evsel *counter) | 392 | static void zero_per_pkg(struct perf_evsel *counter) |
@@ -447,7 +448,8 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread __maybe_unused, | |||
447 | perf_evsel__compute_deltas(evsel, cpu, count); | 448 | perf_evsel__compute_deltas(evsel, cpu, count); |
448 | perf_counts_values__scale(count, scale, NULL); | 449 | perf_counts_values__scale(count, scale, NULL); |
449 | evsel->counts->cpu[cpu] = *count; | 450 | evsel->counts->cpu[cpu] = *count; |
450 | update_shadow_stats(evsel, count->values); | 451 | if (aggr_mode == AGGR_NONE) |
452 | update_shadow_stats(evsel, count->values, cpu); | ||
451 | break; | 453 | break; |
452 | case AGGR_GLOBAL: | 454 | case AGGR_GLOBAL: |
453 | aggr->val += count->val; | 455 | aggr->val += count->val; |
@@ -495,7 +497,7 @@ static int read_counter_aggr(struct perf_evsel *counter) | |||
495 | /* | 497 | /* |
496 | * Save the full runtime - to allow normalization during printout: | 498 | * Save the full runtime - to allow normalization during printout: |
497 | */ | 499 | */ |
498 | update_shadow_stats(counter, count); | 500 | update_shadow_stats(counter, count, 0); |
499 | 501 | ||
500 | return 0; | 502 | return 0; |
501 | } | 503 | } |