Skip to contentSkip to conversation

perf report: Add raw displaying of per-thread counters

PATCH In review Brice Goglin 2 participants 3 messages Aug 10, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: Add raw displaying of per-thread counters

If --pretty=raw is given to perf report -T, it now displays one line per-thread per-counter with the raw event id added.

We get:

#   PID    TID              Name  Raw    Count
  18608  18609      cache-misses  28e   416744
  18608  18609  cache-references  28f  6456792
  18608  18608      cache-misses  28e   448219
  18608  18608  cache-references  28f  7270244
instead of:
#   PID    TID  cache-misses  cache-references
  18608  18609        416744           6456792
  18608  18608        448219           7270244
tools/perf/builtin-report.c +10 -1
index 4163918..2357c66 100644
@@ -57,6 +57,9 @@ static int		show_nr_samples;
 static int		show_threads;
 static struct perf_read_values	show_threads_values;
 
+static char		default_pretty_printing_style[] = "normal";
+static char		*pretty_printing_style = default_pretty_printing_style;
+
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
@@ -1401,6 +1404,9 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
 	size_t ret = 0;
 	unsigned int width;
 	char *col_width = col_width_list_str;
+	int raw_printing_style;
+
+	raw_printing_style = !strcmp(pretty_printing_style, "raw");
 
 	init_rem_hits();
 
@@ -1478,7 +1484,8 @@ print_entries:
 	free(rem_sq_bracket);
 
 	if (show_threads)
-		perf_read_values_display(fp, &show_threads_values);
+		perf_read_values_display(fp, &show_threads_values,
+					 raw_printing_style);
 
 	return ret;
 }
@@ -2091,6 +2098,8 @@ static const struct option options[] = {
 		    "Show a column with the number of samples"),
 	OPT_BOOLEAN('T', "threads", &show_threads,
 		    "Show per-thread event counters"),
+	OPT_STRING(0, "pretty", &pretty_printing_style, "key",
+		   "pretty printing style key: normal raw"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): pid, comm, dso, symbol, parent"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
tools/perf/util/values.c +61 -1

71 lines not on this page · raw message

tools/perf/util/values.h +2 -1
index e41be5e..f8960fd 100644
@@ -21,6 +21,7 @@ void perf_read_values_add_value(struct perf_read_values *values,
 				u32 pid, u32 tid,
 				u64 rawid, char *name, u64 value);
 
-void perf_read_values_display(FILE *fp, struct perf_read_values *values);
+void perf_read_values_display(FILE *fp, struct perf_read_values *values,
+			      int raw);
 
 #endif /* _PERF_VALUES_H */
#1 lore raw
Commit-ID:  9f8666971185b86615a074bcac67c90fdf8af8bc
Gitweb:     http://git.kernel.org/tip/9f8666971185b86615a074bcac67c90fdf8af8bc
Author:     Brice Goglin <[email protected]>
AuthorDate: Mon, 10 Aug 2009 15:26:32 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 10 Aug 2009 15:48:17 +0200

perf report: Add raw displaying of per-thread counters

If --pretty=raw is given to perf report -T, it now displays one line per-thread per-counter with the raw event id added.

We get:

 #   PID    TID              Name  Raw    Count
   18608  18609      cache-misses  28e   416744
   18608  18609  cache-references  28f  6456792
   18608  18608      cache-misses  28e   448219
   18608  18608  cache-references  28f  7270244

instead of:

# PID TID cache-misses cache-references

   18608  18609        416744           6456792
   18608  18608        448219           7270244

LKML-Reference: <[email protected]>

---
 tools/perf/builtin-report.c |   11 +++++++-
 tools/perf/util/values.c    |   62 ++++++++++++++++++++++++++++++++++++++++++-
 tools/perf/util/values.h    |    3 +-
 3 files changed, 73 insertions(+), 3 deletions(-)
tools/perf/builtin-report.c +10 -1
index 4163918..2357c66 100644
@@ -57,6 +57,9 @@ static int		show_nr_samples;
 static int		show_threads;
 static struct perf_read_values	show_threads_values;
 
+static char		default_pretty_printing_style[] = "normal";
+static char		*pretty_printing_style = default_pretty_printing_style;
+
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
@@ -1401,6 +1404,9 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
 	size_t ret = 0;
 	unsigned int width;
 	char *col_width = col_width_list_str;
+	int raw_printing_style;
+
+	raw_printing_style = !strcmp(pretty_printing_style, "raw");
 
 	init_rem_hits();
 
@@ -1478,7 +1484,8 @@ print_entries:
 	free(rem_sq_bracket);
 
 	if (show_threads)
-		perf_read_values_display(fp, &show_threads_values);
+		perf_read_values_display(fp, &show_threads_values,
+					 raw_printing_style);
 
 	return ret;
 }
@@ -2091,6 +2098,8 @@ static const struct option options[] = {
 		    "Show a column with the number of samples"),
 	OPT_BOOLEAN('T', "threads", &show_threads,
 		    "Show per-thread event counters"),
+	OPT_STRING(0, "pretty", &pretty_printing_style, "key",
+		   "pretty printing style key: normal raw"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): pid, comm, dso, symbol, parent"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
tools/perf/util/values.c +61 -1

71 lines not on this page · raw message

tools/perf/util/values.h +2 -1
index e41be5e..f8960fd 100644
@@ -21,6 +21,7 @@ void perf_read_values_add_value(struct perf_read_values *values,
 				u32 pid, u32 tid,
 				u64 rawid, char *name, u64 value);
 
-void perf_read_values_display(FILE *fp, struct perf_read_values *values);
+void perf_read_values_display(FILE *fp, struct perf_read_values *values,
+			      int raw);
 
 #endif /* _PERF_VALUES_H */
#2 lore raw
Quoted 12 lines · tip-bot for Brice Goglin
Commit-ID:  9f8666971185b86615a074bcac67c90fdf8af8bc
Gitweb:     http://git.kernel.org/tip/9f8666971185b86615a074bcac67c90fdf8af8bc
Author:     Brice Goglin <[email protected]>
AuthorDate: Mon, 10 Aug 2009 15:26:32 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 10 Aug 2009 15:48:17 +0200

perf report: Add raw displaying of per-thread counters

If --pretty=raw is given to perf report -T, it now displays one line per-thread per-counter with the raw event id added.

Quoted 6 lines

We get:

 #   PID    TID              Name  Raw    Count
   18608  18609      cache-misses  28e   416744
   18608  18609  cache-references  28f  6456792
   18608  18608      cache-misses  28e   448219
   18608  18608  cache-references  28f  7270244

btw., this is the full output we do:

aldebaran:~> perf record -f -n -s ./hackbench 1
aldebaran:~> perf report -T --pretty=raw

# Samples: 0
#

# Overhead    Command  Shared Object  Symbol
# ........  .........  .............  ......

#
#
# (For a higher level overview, try: perf report --sort comm,dso) #

# PID TID Name Raw Count

  17937  17937  cycles   3b  11590867
  17935  17935  cycles   3b  11461700
  17942  17942  cycles   3b  10912077
  17927  17927  cycles   3b  10904967
  17924  17924  cycles   3b  13313815
  17934  17934  cycles   3b  11639158
  17939  17939  cycles   3b  10803818
  17931  17931  cycles   3b  11802979
  17925  17925  cycles   3b  11303473
  17926  17926  cycles   3b  12243882
  17936  17936  cycles   3b   9997099
  17938  17938  cycles   3b  11255911
  17932  17932  cycles   3b  11957781
  17929  17929  cycles   3b  12936176
  17933  17933  cycles   3b  12685907
  17930  17930  cycles   3b  12455278
  17928  17928  cycles   3b  13187215
  17940  17940  cycles   3b  15426327
  17923  17923  cycles   3b  15754461
  17903  17903  cycles   3b  11156016
  17905  17905  cycles   3b   9747782
  17904  17904  cycles   3b   8743904
  17907  17907  cycles   3b  10827088
  17906  17906  cycles   3b  10109984
  17908  17908  cycles   3b  11092446
  17909  17909  cycles   3b   8167235
  17910  17910  cycles   3b  12132769
  17911  17911  cycles   3b   9469716
  17912  17912  cycles   3b   9541507
  17914  17914  cycles   3b   8612516
  17913  17913  cycles   3b   9805519
  17915  17915  cycles   3b  10021933
  17916  17916  cycles   3b  10763787
  17917  17917  cycles   3b  10519547
  17918  17918  cycles   3b   9749113
  17919  17919  cycles   3b  10582943
  17921  17921  cycles   3b   8717079
  17920  17920  cycles   3b   9113000
  17922  17922  cycles   3b  12102473
  17941  17941  cycles   3b  15668897
  17902  17902  cycles   3b   9148959

I think we should supress the header portion, as it's highly confusing in this case when we dont sample RIPs but only counts, right?

Ingo