Skip to contentSkip to conversation

perf evsel: Rename print_ip() to fprintf_sym()

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Apr 13, 2016 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  ff0c107806cf9d237e50e21de66d6909391071cd
Gitweb:     http://git.kernel.org/tip/ff0c107806cf9d237e50e21de66d6909391071cd
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 11 Apr 2016 11:14:06 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 11 Apr 2016 22:18:17 -0300

perf evsel: Rename print_ip() to fprintf_sym()

As it receives a FILE, and its more than just the IP, which can even be requested not to be printed.

For consistency with other similar methods in tools/perf/, name it as perf_evsel__fprintf_sym() and make it return the number of bytes printed, just like 'fprintf(3)'

---
 tools/perf/builtin-script.c | 10 ++++----
 tools/perf/builtin-trace.c  |  4 +--
 tools/perf/util/session.c   | 60 +++++++++++++++++++++------------------------
 tools/perf/util/session.h   |  8 +++---
 4 files changed, 39 insertions(+), 43 deletions(-)
tools/perf/builtin-script.c +5 -5
index 60fde9f..ddd5b79e 100644
@@ -579,8 +579,8 @@ static void print_sample_bts(struct perf_sample *sample,
 				print_opts &= ~PRINT_IP_OPT_SRCLINE;
 			}
 		}
-		perf_evsel__print_ip(evsel, sample, al, 0, print_opts,
-				     scripting_max_stack, stdout);
+		perf_evsel__fprintf_sym(evsel, sample, al, 0, print_opts,
+					scripting_max_stack, stdout);
 	}
 
 	/* print branch_to information */
@@ -788,9 +788,9 @@ static void process_event(struct perf_script *script,
 		else
 			printf("\n");
 
-		perf_evsel__print_ip(evsel, sample, al, 0,
-				     output[attr->type].print_ip_opts,
-				     scripting_max_stack, stdout);
+		perf_evsel__fprintf_sym(evsel, sample, al, 0,
+					output[attr->type].print_ip_opts,
+					scripting_max_stack, stdout);
 	}
 
 	if (PRINT_FIELD(IREGS))
tools/perf/builtin-trace.c +2 -2
index 8c587a8..a0d5c68 100644
@@ -2203,8 +2203,8 @@ signed_print:
 			       event->header.type);
 			goto out_put;
 		}
-		perf_evsel__print_ip(evsel, sample, &al, 38, print_opts,
-				     scripting_max_stack, trace->output);
+		perf_evsel__fprintf_sym(evsel, sample, &al, 38, print_opts,
+					scripting_max_stack, trace->output);
 	}
 out:
 	ttrace->entry_pending = false;
tools/perf/util/session.c +28 -32

117 lines not on this page · raw message

tools/perf/util/session.h +4 -4
index a6bc4dd..ac83490 100644
@@ -104,10 +104,10 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
 struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 					    unsigned int type);
 
-void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
-			  struct addr_location *al, int left_alignment,
-			  unsigned int print_opts, unsigned int stack_depth,
-			  FILE *fp);
+int perf_evsel__fprintf_sym(struct perf_evsel *evsel, struct perf_sample *sample,
+			    struct addr_location *al, int left_alignment,
+			    unsigned int print_opts, unsigned int stack_depth,
+			    FILE *fp);
 
 int perf_session__cpu_bitmap(struct perf_session *session,
 			     const char *cpu_list, unsigned long *cpu_bitmap);