Skip to contentSkip to conversation

perf evsel: Move some methods from session.[ch] to evsel.[ch]

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

lore
Share & tools
lore
#0 lore raw
Commit-ID:  e20ab86e51218f9949f41fb39a6c4f63b662f135
Gitweb:     http://git.kernel.org/tip/e20ab86e51218f9949f41fb39a6c4f63b662f135
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 12 Apr 2016 15:16:15 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 13 Apr 2016 10:11:52 -0300

perf evsel: Move some methods from session.[ch] to evsel.[ch]

Those were converted to be evsel methods long ago, move the source to where it belongs.

---
 tools/perf/builtin-script.c |  14 ++---
 tools/perf/builtin-trace.c  |   6 +-
 tools/perf/util/evsel.c     | 131 ++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.h     |  13 +++++
 tools/perf/util/session.c   | 130 -------------------------------------------
 tools/perf/util/session.h   |  13 -----
 6 files changed, 154 insertions(+), 153 deletions(-)
tools/perf/builtin-script.c +7 -7
index ddd5b79e..838c0bc 100644
@@ -317,19 +317,19 @@ static void set_print_ip_opts(struct perf_event_attr *attr)
 
 	output[type].print_ip_opts = 0;
 	if (PRINT_FIELD(IP))
-		output[type].print_ip_opts |= PRINT_IP_OPT_IP;
+		output[type].print_ip_opts |= EVSEL__PRINT_IP;
 
 	if (PRINT_FIELD(SYM))
-		output[type].print_ip_opts |= PRINT_IP_OPT_SYM;
+		output[type].print_ip_opts |= EVSEL__PRINT_SYM;
 
 	if (PRINT_FIELD(DSO))
-		output[type].print_ip_opts |= PRINT_IP_OPT_DSO;
+		output[type].print_ip_opts |= EVSEL__PRINT_DSO;
 
 	if (PRINT_FIELD(SYMOFFSET))
-		output[type].print_ip_opts |= PRINT_IP_OPT_SYMOFFSET;
+		output[type].print_ip_opts |= EVSEL__PRINT_SYMOFFSET;
 
 	if (PRINT_FIELD(SRCLINE))
-		output[type].print_ip_opts |= PRINT_IP_OPT_SRCLINE;
+		output[type].print_ip_opts |= EVSEL__PRINT_SRCLINE;
 }
 
 /*
@@ -574,9 +574,9 @@ static void print_sample_bts(struct perf_sample *sample,
 			printf("\n");
 		} else {
 			printf(" ");
-			if (print_opts & PRINT_IP_OPT_SRCLINE) {
+			if (print_opts & EVSEL__PRINT_SRCLINE) {
 				print_srcline_last = true;
-				print_opts &= ~PRINT_IP_OPT_SRCLINE;
+				print_opts &= ~EVSEL__PRINT_SRCLINE;
 			}
 		}
 		perf_evsel__fprintf_sym(evsel, sample, al, 0, print_opts,
tools/perf/builtin-trace.c +3 -3
index a6e05e1..b842ddd 100644
@@ -2119,9 +2119,9 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_evsel *evse
 {
 	struct addr_location al;
 	/* TODO: user-configurable print_opts */
-	const unsigned int print_opts = PRINT_IP_OPT_SYM |
-				        PRINT_IP_OPT_DSO |
-				        PRINT_IP_OPT_UNKNOWN_AS_ADDR;
+	const unsigned int print_opts = EVSEL__PRINT_SYM |
+				        EVSEL__PRINT_DSO |
+				        EVSEL__PRINT_UNKNOWN_AS_ADDR;
 
 	if (sample->callchain == NULL)
 		return 0;
tools/perf/util/evsel.c +131 -0

137 lines not on this page · raw message

tools/perf/util/evsel.h +13 -0
index 1bd6c2e..36edd3c 100644
@@ -387,12 +387,25 @@ struct perf_attr_details {
 int perf_evsel__fprintf(struct perf_evsel *evsel,
 			struct perf_attr_details *details, FILE *fp);
 
+#define EVSEL__PRINT_IP			(1<<0)
+#define EVSEL__PRINT_SYM		(1<<1)
+#define EVSEL__PRINT_DSO		(1<<2)
+#define EVSEL__PRINT_SYMOFFSET		(1<<3)
+#define EVSEL__PRINT_ONELINE		(1<<4)
+#define EVSEL__PRINT_SRCLINE		(1<<5)
+#define EVSEL__PRINT_UNKNOWN_AS_ADDR	(1<<6)
+
 int perf_evsel__fprintf_callchain(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);
+
 bool perf_evsel__fallback(struct perf_evsel *evsel, int err,
 			  char *msg, size_t msgsize);
 int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
tools/perf/util/session.c +0 -130

136 lines not on this page · raw message

tools/perf/util/session.h +0 -13
index 4257fac..4bd7585 100644
@@ -36,14 +36,6 @@ struct perf_session {
 	struct perf_tool	*tool;
 };
 
-#define PRINT_IP_OPT_IP		(1<<0)
-#define PRINT_IP_OPT_SYM		(1<<1)
-#define PRINT_IP_OPT_DSO		(1<<2)
-#define PRINT_IP_OPT_SYMOFFSET	(1<<3)
-#define PRINT_IP_OPT_ONELINE	(1<<4)
-#define PRINT_IP_OPT_SRCLINE	(1<<5)
-#define PRINT_IP_OPT_UNKNOWN_AS_ADDR (1<<6)
-
 struct perf_tool;
 
 struct perf_session *perf_session__new(struct perf_data_file *file,
@@ -105,11 +97,6 @@ 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);
 
-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);