Web lists-archives.com

Re: [PATCH] perf stat: Support metrics with perf stat --per-thread

I wonder if patch below would be enough for this


Hi Jiri,

I think below patch and next patch (in your another mail) is OK, thanks!

Do I need to upgrade my patch to v2 according to your modifications?

Or you will post your patches? Both OK for me. :)

Jin Yao

diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 35e9848734d6..56a0a36d0653 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -259,6 +259,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
  	struct perf_counts_values *aggr = &evsel->counts->aggr;
  	static struct perf_counts_values zero;
  	bool skip = false;
+	u64 val;
if (check_per_pkg(evsel, count, cpu, &skip)) {
  		pr_err("failed to read per-pkg counter\n");
@@ -270,6 +271,9 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
switch (config->aggr_mode) {
  	case AGGR_THREAD:
+		val = count->val * evsel->scale;
+		perf_stat__update_shadow_stats(evsel, &val, 0);
+		break;
  	case AGGR_CORE:
  	case AGGR_SOCKET:
  	case AGGR_NONE: