Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205349
b: refs/heads/master
c: 669336e
h: refs/heads/master
i:
  205347: dec676b
v: v3
  • Loading branch information
Frederic Weisbecker committed Aug 1, 2010
1 parent 689d88e commit 0331cc4
Show file tree
Hide file tree
Showing 26 changed files with 658 additions and 1,257 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: d65a458b348cd458413b3cfec66e43ebd0367646
refs/heads/master: 669336e4cf3e1cb95800f3f5924558a76d723c21
6 changes: 3 additions & 3 deletions trunk/kernel/trace/trace_event_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ void perf_trace_destroy(struct perf_event *p_event)
tp_event->class->reg(tp_event, TRACE_REG_PERF_UNREGISTER);

/*
* Ensure our callback won't be called anymore. See
* tracepoint_probe_unregister() and __DO_TRACE().
* Ensure our callback won't be called anymore. The buffers
* will be freed after that.
*/
synchronize_sched();
tracepoint_synchronize_unregister();

free_percpu(tp_event->perf_events);
tp_event->perf_events = NULL;
Expand Down
8 changes: 4 additions & 4 deletions trunk/tools/perf/Documentation/perf-buildid-cache.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ SYNOPSIS

DESCRIPTION
-----------
This command manages the build-id cache. It can add and remove files to/from
the cache. In the future it should as well purge older entries, set upper
limits for the space used by the cache, etc.
This command manages the build-id cache. It can add and remove files to the
cache. In the future it should as well purge older entries, set upper limits
for the space used by the cache, etc.

OPTIONS
-------
Expand All @@ -23,7 +23,7 @@ OPTIONS
Add specified file to the cache.
-r::
--remove=::
Remove specified file from the cache.
Remove specified file to the cache.
-v::
--verbose::
Be more verbose.
Expand Down
4 changes: 3 additions & 1 deletion trunk/tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ static int __cmd_buildid_list(void)
if (session == NULL)
return -1;

if (with_hits)
if (with_hits) {
symbol_conf.full_paths = true;
perf_session__process_events(session, &build_id__mark_dso_hit_ops);
}

perf_session__fprintf_dsos_buildid(session, stdout, with_hits);

Expand Down
2 changes: 2 additions & 0 deletions trunk/tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ static const struct option options[] = {
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
"load module symbols - WARNING: use only with -k and LIVE kernel"),
OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
"Don't shorten the pathnames taking into account the cwd"),
OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
"only consider symbols in these dsos"),
OPT_STRING('C', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/builtin-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
}
return 0;
}

37 changes: 7 additions & 30 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ static void atexit_header(void)

process_buildids();
perf_header__write(&session->header, output, true);
perf_session__delete(session);
symbol__exit();
}
}

Expand Down Expand Up @@ -560,15 +558,12 @@ static int __cmd_record(int argc, const char **argv)
if (!file_new) {
err = perf_header__read(session, output);
if (err < 0)
goto out_delete_session;
return err;
}

if (have_tracepoints(attrs, nr_counters))
perf_header__set_feat(&session->header, HEADER_TRACE_INFO);

/*
* perf_session__delete(session) will be called at atexit_header()
*/
atexit(atexit_header);

if (forks) {
Expand Down Expand Up @@ -773,10 +768,6 @@ static int __cmd_record(int argc, const char **argv)
bytes_written / 24);

return 0;

out_delete_session:
perf_session__delete(session);
return err;
}

static const char * const record_usage[] = {
Expand Down Expand Up @@ -833,7 +824,7 @@ static const struct option options[] = {

int cmd_record(int argc, const char **argv, const char *prefix __used)
{
int i, j, err = -ENOMEM;
int i,j;

argc = parse_options(argc, argv, options, record_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
Expand Down Expand Up @@ -872,7 +863,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
} else {
all_tids=malloc(sizeof(pid_t));
if (!all_tids)
goto out_symbol_exit;
return -ENOMEM;

all_tids[0] = target_tid;
thread_num = 1;
Expand All @@ -882,13 +873,13 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
for (j = 0; j < MAX_COUNTERS; j++) {
fd[i][j] = malloc(sizeof(int)*thread_num);
if (!fd[i][j])
goto out_free_fd;
return -ENOMEM;
}
}
event_array = malloc(
sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
if (!event_array)
goto out_free_fd;
return -ENOMEM;

if (user_interval != ULLONG_MAX)
default_interval = user_interval;
Expand All @@ -904,22 +895,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
default_interval = freq;
} else {
fprintf(stderr, "frequency and count are zero, aborting\n");
err = -EINVAL;
goto out_free_event_array;
exit(EXIT_FAILURE);
}

err = __cmd_record(argc, argv);

out_free_event_array:
free(event_array);
out_free_fd:
for (i = 0; i < MAX_NR_CPUS; i++) {
for (j = 0; j < MAX_COUNTERS; j++)
free(fd[i][j]);
}
free(all_tids);
all_tids = NULL;
out_symbol_exit:
symbol__exit();
return err;
return __cmd_record(argc, argv);
}
2 changes: 2 additions & 0 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ static const struct option options[] = {
"pretty printing style key: normal raw"),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent"),
OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
"Don't shorten the pathnames taking into account the cwd"),
OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
"Show sample percentage for different cpu modes"),
OPT_STRING('p', "parent", &parent_pattern, "regex",
Expand Down
18 changes: 0 additions & 18 deletions trunk/tools/perf/util/build-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "event.h"
#include "symbol.h"
#include <linux/kernel.h>
#include "debug.h"

static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
{
Expand All @@ -35,27 +34,10 @@ static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
return 0;
}

static int event__exit_del_thread(event_t *self, struct perf_session *session)
{
struct thread *thread = perf_session__findnew(session, self->fork.tid);

dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid,
self->fork.ppid, self->fork.ptid);

if (thread) {
rb_erase(&thread->rb_node, &session->threads);
session->last_match = NULL;
thread__delete(thread);
}

return 0;
}

struct perf_event_ops build_id__mark_dso_hit_ops = {
.sample = build_id__mark_dso_hit,
.mmap = event__process_mmap,
.fork = event__process_task,
.exit = event__exit_del_thread,
};

char *dso__build_id_filename(struct dso *self, char *bf, size_t size)
Expand Down
42 changes: 21 additions & 21 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,29 +340,30 @@ int event__synthesize_kernel_mmap(event__handler_t process,
return process(&ev, session);
}

static void thread__comm_adjust(struct thread *self, struct hists *hists)
static void thread__comm_adjust(struct thread *self)
{
char *comm = self->comm;

if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
(!symbol_conf.comm_list ||
strlist__has_entry(symbol_conf.comm_list, comm))) {
u16 slen = strlen(comm);
unsigned int slen = strlen(comm);

if (hists__new_col_len(hists, HISTC_COMM, slen))
hists__set_col_len(hists, HISTC_THREAD, slen + 6);
if (slen > comms__col_width) {
comms__col_width = slen;
threads__col_width = slen + 6;
}
}
}

static int thread__set_comm_adjust(struct thread *self, const char *comm,
struct hists *hists)
static int thread__set_comm_adjust(struct thread *self, const char *comm)
{
int ret = thread__set_comm(self, comm);

if (ret)
return ret;

thread__comm_adjust(self, hists);
thread__comm_adjust(self);

return 0;
}
Expand All @@ -373,8 +374,7 @@ int event__process_comm(event_t *self, struct perf_session *session)

dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid);

if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm,
&session->hists)) {
if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) {
dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
return -1;
}
Expand Down Expand Up @@ -456,7 +456,6 @@ static int event__process_kernel_mmap(event_t *self,
goto out_problem;

map->dso->short_name = name;
map->dso->sname_alloc = 1;
map->end = map->start + self->mmap.len;
} else if (is_kernel_mmap) {
const char *symbol_name = (self->mmap.filename +
Expand Down Expand Up @@ -515,13 +514,12 @@ int event__process_mmap(event_t *self, struct perf_session *session)
if (machine == NULL)
goto out_problem;
thread = perf_session__findnew(session, self->mmap.pid);
if (thread == NULL)
goto out_problem;
map = map__new(&machine->user_dsos, self->mmap.start,
self->mmap.len, self->mmap.pgoff,
self->mmap.pid, self->mmap.filename,
MAP__FUNCTION);
if (map == NULL)
MAP__FUNCTION, session->cwd, session->cwdlen);

if (thread == NULL || map == NULL)
goto out_problem;

thread__insert_map(thread, map);
Expand Down Expand Up @@ -643,13 +641,16 @@ void thread__find_addr_location(struct thread *self,
al->sym = NULL;
}

static void dso__calc_col_width(struct dso *self, struct hists *hists)
static void dso__calc_col_width(struct dso *self)
{
if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
(!symbol_conf.dso_list ||
strlist__has_entry(symbol_conf.dso_list, self->name))) {
u16 slen = dso__name_len(self);
hists__new_col_len(hists, HISTC_DSO, slen);
u16 slen = self->short_name_len;
if (verbose)
slen = self->long_name_len;
if (dsos__col_width < slen)
dsos__col_width = slen;
}

self->slen_calculated = 1;
Expand Down Expand Up @@ -728,17 +729,16 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
* sampled.
*/
if (!sort_dso.elide && !al->map->dso->slen_calculated)
dso__calc_col_width(al->map->dso, &session->hists);
dso__calc_col_width(al->map->dso);

al->sym = map__find_symbol(al->map, al->addr, filter);
} else {
const unsigned int unresolved_col_width = BITS_PER_LONG / 4;

if (hists__col_len(&session->hists, HISTC_DSO) < unresolved_col_width &&
if (dsos__col_width < unresolved_col_width &&
!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
!symbol_conf.dso_list)
hists__set_col_len(&session->hists, HISTC_DSO,
unresolved_col_width);
dsos__col_width = unresolved_col_width;
}

if (symbol_conf.sym_list && al->sym &&
Expand Down
Loading

0 comments on commit 0331cc4

Please sign in to comment.