]> Pileus Git - ~andy/linux/blobdiff - tools/perf/builtin-report.c
perf probe: Check build-id of vmlinux
[~andy/linux] / tools / perf / builtin-report.c
index 5141cdccbb658e00917a42a7ffc84376b1ea476a..40389c0e38c6b72165facd2cf243caea068bfdd6 100644 (file)
@@ -52,9 +52,7 @@ static int            exclude_other = 1;
 
 static char            callchain_default_opt[] = "fractal,0.5";
 
-static u64             sample_type;
-
-struct symbol_conf     symbol_conf;
+static struct symbol_conf      symbol_conf;
 
 
 static size_t
@@ -557,7 +555,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
        memset(&data, 0, sizeof(data));
        data.period = 1;
 
-       event__parse_sample(event, sample_type, &data);
+       event__parse_sample(event, session->sample_type, &data);
 
        dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
                event->header.misc,
@@ -565,7 +563,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                (void *)(long)data.ip,
                (long long)data.period);
 
-       if (sample_type & PERF_SAMPLE_CALLCHAIN) {
+       if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
                unsigned int i;
 
                dump_printf("... chain: nr:%Lu\n", data.callchain->nr);
@@ -621,8 +619,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                return -1;
        }
 
-       event__stats.total += data.period;
-
+       session->events_stats.total += data.period;
        return 0;
 }
 
@@ -664,11 +661,9 @@ static int process_read_event(event_t *event, struct perf_session *session __use
        return 0;
 }
 
-static int sample_type_check(u64 type, struct perf_session *session)
+static int sample_type_check(struct perf_session *session)
 {
-       sample_type = type;
-
-       if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) {
+       if (!(session->sample_type & PERF_SAMPLE_CALLCHAIN)) {
                if (sort__has_parent) {
                        fprintf(stderr, "selected --sort parent, but no"
                                        " callchain data. Did you call"
@@ -735,8 +730,8 @@ static int __cmd_report(void)
                dsos__fprintf(stdout);
 
        perf_session__collapse_resort(session);
-       perf_session__output_resort(session, event__stats.total);
-       perf_session__fprintf_hist_entries(session, event__stats.total, stdout);
+       perf_session__output_resort(session, session->events_stats.total);
+       perf_session__fprintf_hist_entries(session, session->events_stats.total, stdout);
 
        if (show_threads)
                perf_read_values_destroy(&show_threads_values);
@@ -848,21 +843,6 @@ static const struct option options[] = {
        OPT_END()
 };
 
-static void setup_sorting(void)
-{
-       char *tmp, *tok, *str = strdup(sort_order);
-
-       for (tok = strtok_r(str, ", ", &tmp);
-                       tok; tok = strtok_r(NULL, ", ", &tmp)) {
-               if (sort_dimension__add(tok) < 0) {
-                       error("Unknown --sort key: `%s'", tok);
-                       usage_with_options(report_usage, options);
-               }
-       }
-
-       free(str);
-}
-
 static void setup_list(struct strlist **list, const char *list_str,
                       struct sort_entry *se, const char *list_name,
                       FILE *fp)
@@ -889,7 +869,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
 
        argc = parse_options(argc, argv, options, report_usage, 0);
 
-       setup_sorting();
+       setup_sorting(report_usage, options);
 
        if (parent_pattern != default_parent_pattern) {
                sort_dimension__add("parent");