perf buildid-list: No need to process the header sections again
[linux-2.6.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/cache.h"
12 #include "util/debug.h"
13 #include "util/parse-options.h"
14 #include "util/session.h"
15 #include "util/symbol.h"
16
17 static char const *input_name = "perf.data";
18 static int force;
19
20 static const char * const buildid_list_usage[] = {
21         "perf buildid-list [<options>]",
22         NULL
23 };
24
25 static const struct option options[] = {
26         OPT_STRING('i', "input", &input_name, "file",
27                     "input file name"),
28         OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
29         OPT_BOOLEAN('v', "verbose", &verbose,
30                     "be more verbose"),
31         OPT_END()
32 };
33
34 static int __cmd_buildid_list(void)
35 {
36         int err = -1;
37         struct perf_session *session;
38
39         session = perf_session__new(input_name, O_RDONLY, force);
40         if (session == NULL)
41                 return -1;
42
43         dsos__fprintf_buildid(stdout);
44
45         perf_session__delete(session);
46         return err;
47 }
48
49 int cmd_buildid_list(int argc, const char **argv, const char *prefix __used)
50 {
51         argc = parse_options(argc, argv, options, buildid_list_usage, 0);
52         setup_pager();
53         return __cmd_buildid_list();
54 }