perf session: Fallback to unordered processing if no sample_id_all
[deliverable/linux.git] / tools / perf / builtin-buildid-list.c
1 /*
2 * builtin-buildid-list.c
3 *
4 * Builtin buildid-list command: list buildids in perf.data
5 *
6 * Copyright (C) 2009, Red Hat Inc.
7 * Copyright (C) 2009, Arnaldo Carvalho de Melo <acme@redhat.com>
8 */
9 #include "builtin.h"
10 #include "perf.h"
11 #include "util/build-id.h"
12 #include "util/cache.h"
13 #include "util/debug.h"
14 #include "util/parse-options.h"
15 #include "util/session.h"
16 #include "util/symbol.h"
17
18 static char const *input_name = "perf.data";
19 static bool force;
20 static bool with_hits;
21
22 static const char * const buildid_list_usage[] = {
23 "perf buildid-list [<options>]",
24 NULL
25 };
26
27 static const struct option options[] = {
28 OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"),
29 OPT_STRING('i', "input", &input_name, "file",
30 "input file name"),
31 OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
32 OPT_INCR('v', "verbose", &verbose,
33 "be more verbose"),
34 OPT_END()
35 };
36
37 static int __cmd_buildid_list(void)
38 {
39 int err = -1;
40 struct perf_session *session;
41
42 session = perf_session__new(input_name, O_RDONLY, force, false,
43 &build_id__mark_dso_hit_ops);
44 if (session == NULL)
45 return -1;
46
47 if (with_hits)
48 perf_session__process_events(session, &build_id__mark_dso_hit_ops);
49
50 perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
51
52 perf_session__delete(session);
53 return err;
54 }
55
56 int cmd_buildid_list(int argc, const char **argv, const char *prefix __used)
57 {
58 argc = parse_options(argc, argv, options, buildid_list_usage, 0);
59 setup_pager();
60 return __cmd_buildid_list();
61 }
This page took 0.05387 seconds and 5 git commands to generate.