Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177459
b: refs/heads/master
c: 75be6cf
h: refs/heads/master
i:
  177457: dcf7212
  177455: bd47bc3
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Dec 16, 2009
1 parent c91f399 commit 48bc656
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 81 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ef17aafc98406d01ebbf7fe98ef1332b70d20bb
refs/heads/master: 75be6cf48738aec68aac49b428423569492cfba3
14 changes: 6 additions & 8 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ struct sym_priv {
struct sym_ext *ext;
};

static struct symbol_conf symbol_conf = {
.priv_size = sizeof(struct sym_priv),
.try_vmlinux_path = true,
};

static const char *sym_hist_filter;

static int symbol_filter(struct map *map __used, struct symbol *sym)
Expand Down Expand Up @@ -464,10 +459,10 @@ static struct perf_event_ops event_ops = {

static int __cmd_annotate(void)
{
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
force, &symbol_conf);
int ret;
struct perf_session *session;

session = perf_session__new(input_name, O_RDONLY, force);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -523,7 +518,10 @@ static const struct option options[] = {

int cmd_annotate(int argc, const char **argv, const char *prefix __used)
{
if (symbol__init(&symbol_conf) < 0)
symbol_conf.priv_size = sizeof(struct sym_priv);
symbol_conf.try_vmlinux_path = true;

if (symbol__init() < 0)
return -1;

argc = parse_options(argc, argv, options, annotate_usage, 0);
Expand Down
5 changes: 3 additions & 2 deletions trunk/tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ static int perf_file_section__process_buildids(struct perf_file_section *self,
static int __cmd_buildid_list(void)
{
int err = -1;
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
force, NULL);
struct perf_session *session;

session = perf_session__new(input_name, O_RDONLY, force);
if (session == NULL)
return -1;

Expand Down
8 changes: 3 additions & 5 deletions trunk/tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ static char const *input_old = "perf.data.old",
static int force;
static bool show_percent;

struct symbol_conf symbol_conf;

static int perf_session__add_hist_entry(struct perf_session *self,
struct addr_location *al, u64 count)
{
Expand Down Expand Up @@ -226,8 +224,8 @@ static int __cmd_diff(void)
int ret, i;
struct perf_session *session[2];

session[0] = perf_session__new(input_old, O_RDONLY, force, &symbol_conf);
session[1] = perf_session__new(input_new, O_RDONLY, force, &symbol_conf);
session[0] = perf_session__new(input_old, O_RDONLY, force);
session[1] = perf_session__new(input_new, O_RDONLY, force);
if (session[0] == NULL || session[1] == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -267,7 +265,7 @@ static const struct option options[] = {

int cmd_diff(int argc, const char **argv, const char *prefix __used)
{
if (symbol__init(&symbol_conf) < 0)
if (symbol__init() < 0)
return -1;

setup_sorting(diff_usage, options);
Expand Down
5 changes: 2 additions & 3 deletions trunk/tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@ static void sort_result(void)
static int __cmd_kmem(void)
{
int err;
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, NULL);
struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -767,7 +766,7 @@ static int __cmd_record(int argc, const char **argv)

int cmd_kmem(int argc, const char **argv, const char *prefix __used)
{
symbol__init(0);
symbol__init();

argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);

Expand Down
14 changes: 6 additions & 8 deletions trunk/tools/perf/builtin-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static struct {
int nr_probe;
struct probe_point probes[MAX_PROBES];
struct strlist *dellist;
struct symbol_conf conf;
struct perf_session *psession;
struct map *kmap;
} session;
Expand Down Expand Up @@ -151,7 +150,7 @@ static const struct option options[] = {
OPT_BOOLEAN('v', "verbose", &verbose,
"be more verbose (show parsed arguments, etc)"),
#ifndef NO_LIBDWARF
OPT_STRING('k', "vmlinux", &session.conf.vmlinux_name,
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
#endif
OPT_BOOLEAN('l', "list", &session.list_events,
Expand Down Expand Up @@ -224,13 +223,12 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
}

/* Initialize symbol maps for vmlinux */
session.conf.sort_by_name = true;
if (session.conf.vmlinux_name == NULL)
session.conf.try_vmlinux_path = true;
if (symbol__init(&session.conf) < 0)
symbol_conf.sort_by_name = true;
if (symbol_conf.vmlinux_name == NULL)
symbol_conf.try_vmlinux_path = true;
if (symbol__init() < 0)
die("Failed to init symbol map.");
session.psession = perf_session__new(NULL, O_WRONLY, false,
&session.conf);
session.psession = perf_session__new(NULL, O_WRONLY, false);
if (session.psession == NULL)
die("Failed to init perf_session.");
session.kmap = map_groups__find_by_name(&session.psession->kmaps,
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static int __cmd_record(int argc, const char **argv)
exit(-1);
}

session = perf_session__new(output_name, O_WRONLY, force, NULL);
session = perf_session__new(output_name, O_WRONLY, force);
if (session == NULL) {
pr_err("Not enough memory for reading perf file header\n");
return -1;
Expand Down Expand Up @@ -632,7 +632,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
{
int counter;

symbol__init(0);
symbol__init();

argc = parse_options(argc, argv, options, record_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
Expand Down
7 changes: 2 additions & 5 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ static int exclude_other = 1;

static char callchain_default_opt[] = "fractal,0.5";

static struct symbol_conf symbol_conf;


static size_t
callchain__fprintf_left_margin(FILE *fp, int left_margin)
{
Expand Down Expand Up @@ -705,7 +702,7 @@ static int __cmd_report(void)
int ret;
struct perf_session *session;

session = perf_session__new(input_name, O_RDONLY, force, &symbol_conf);
session = perf_session__new(input_name, O_RDONLY, force);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -864,7 +861,7 @@ static void setup_list(struct strlist **list, const char *list_str,

int cmd_report(int argc, const char **argv, const char *prefix __used)
{
if (symbol__init(&symbol_conf) < 0)
if (symbol__init() < 0)
return -1;

argc = parse_options(argc, argv, options, report_usage, 0);
Expand Down
5 changes: 2 additions & 3 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,7 @@ static struct perf_event_ops event_ops = {
static int read_events(void)
{
int err;
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, NULL);
struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -1912,7 +1911,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
if (!strcmp(argv[0], "trace"))
return cmd_trace(argc, argv, prefix);

symbol__init(0);
symbol__init();
if (!strncmp(argv[0], "rec", 3)) {
return __cmd_record(argc, argv);
} else if (!strncmp(argv[0], "lat", 3)) {
Expand Down
5 changes: 2 additions & 3 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,7 @@ static struct perf_event_ops event_ops = {

static int __cmd_timechart(void)
{
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, NULL);
struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
int ret;

if (session == NULL)
Expand Down Expand Up @@ -1138,7 +1137,7 @@ static const struct option options[] = {

int cmd_timechart(int argc, const char **argv, const char *prefix __used)
{
symbol__init(0);
symbol__init();

argc = parse_options(argc, argv, options, timechart_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
Expand Down
6 changes: 2 additions & 4 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ static int dump_symtab = 0;
static bool hide_kernel_symbols = false;
static bool hide_user_symbols = false;
static struct winsize winsize;
static struct symbol_conf symbol_conf;

/*
* Source
Expand Down Expand Up @@ -1162,8 +1161,7 @@ static int __cmd_top(void)
* FIXME: perf_session__new should allow passing a O_MMAP, so that all this
* mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
*/
struct perf_session *session = perf_session__new(NULL, O_WRONLY, false,
&symbol_conf);
struct perf_session *session = perf_session__new(NULL, O_WRONLY, false);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -1284,7 +1282,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
(nr_counters + 1) * sizeof(unsigned long));
if (symbol_conf.vmlinux_name == NULL)
symbol_conf.try_vmlinux_path = true;
if (symbol__init(&symbol_conf) < 0)
if (symbol__init() < 0)
return -1;

if (delay_secs < 1)
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
exit(-1);
}

symbol__init(0);
symbol__init();

setup_scripting();

Expand All @@ -588,7 +588,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)

setup_pager();

session = perf_session__new(input_name, O_RDONLY, 0, NULL);
session = perf_session__new(input_name, O_RDONLY, 0);
if (session == NULL)
return -ENOMEM;

Expand Down
5 changes: 2 additions & 3 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ static int perf_session__open(struct perf_session *self, bool force)
return -1;
}

struct perf_session *perf_session__new(const char *filename, int mode,
bool force, struct symbol_conf *conf)
struct perf_session *perf_session__new(const char *filename, int mode, bool force)
{
size_t len = filename ? strlen(filename) + 1 : 0;
struct perf_session *self = zalloc(sizeof(*self) + len);
Expand All @@ -69,7 +68,7 @@ struct perf_session *perf_session__new(const char *filename, int mode,
self->cwdlen = 0;
map_groups__init(&self->kmaps);

if (perf_session__create_kernel_maps(self, conf) < 0)
if (perf_session__create_kernel_maps(self) < 0)
goto out_delete;

if (mode == O_RDONLY && perf_session__open(self, force) < 0)
Expand Down
5 changes: 1 addition & 4 deletions trunk/tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
struct ip_callchain;
struct thread;
struct symbol;
struct symbol_conf;

struct perf_session {
struct perf_header header;
Expand All @@ -26,7 +25,6 @@ struct perf_session {
int fd;
int cwdlen;
char *cwd;
bool use_modules;
bool use_callchain;
char filename[0];
};
Expand All @@ -48,8 +46,7 @@ struct perf_event_ops {
bool full_paths;
};

struct perf_session *perf_session__new(const char *filename, int mode,
bool force, struct symbol_conf *conf);
struct perf_session *perf_session__new(const char *filename, int mode, bool force);
void perf_session__delete(struct perf_session *self);

int perf_session__process_events(struct perf_session *self,
Expand Down
Loading

0 comments on commit 48bc656

Please sign in to comment.