Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205237
b: refs/heads/master
c: 41a37e2
h: refs/heads/master
i:
  205235: 7ecd342
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Jun 5, 2010
1 parent 8e24444 commit 17ab963
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 45 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: 45d8e8025a2b2a6996be92d769fb6763bfb3cbae
refs/heads/master: 41a37e20178b081193b08b228030d8f562bfee62
6 changes: 2 additions & 4 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ static int hists__add_entry(struct hists *self, struct addr_location *al)
static int process_sample_event(event_t *event, struct perf_session *session)
{
struct addr_location al;
struct sample_data data;

dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
event->ip.pid, event->ip.ip);

if (event__preprocess_sample(event, session, &al, NULL) < 0) {
if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
Expand Down
7 changes: 1 addition & 6 deletions trunk/tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
struct addr_location al;
struct sample_data data = { .period = 1, };

dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
event->ip.pid, event->ip.ip);

if (event__preprocess_sample(event, session, &al, NULL) < 0) {
if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
Expand All @@ -47,8 +44,6 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
if (al.filtered || al.sym == NULL)
return 0;

event__parse_sample(event, session->sample_type, &data);

if (hists__add_entry(&session->hists, &al, data.period)) {
pr_warning("problem incrementing symbol period, skipping event\n");
return -1;
Expand Down
26 changes: 1 addition & 25 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,31 +155,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
struct addr_location al;
struct perf_event_attr *attr;

event__parse_sample(event, session->sample_type, &data);

dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld cpu:%d\n",
event->header.misc, data.pid, data.tid, data.ip,
data.period, data.cpu);

if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
unsigned int i;

dump_printf("... chain: nr:%Lu\n", data.callchain->nr);

if (!ip_callchain__valid(data.callchain, event)) {
pr_debug("call-chain problem with event, "
"skipping it.\n");
return 0;
}

if (dump_trace) {
for (i = 0; i < data.callchain->nr; i++)
dump_printf("..... %2d: %016Lx\n",
i, data.callchain->ips[i]);
}
}

if (event__preprocess_sample(event, session, &al, NULL) < 0) {
if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type);
return -1;
Expand Down
4 changes: 3 additions & 1 deletion trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ static void event__process_sample(const event_t *self,
u64 ip = self->ip.ip;
struct sym_entry *syme;
struct addr_location al;
struct sample_data data;
struct machine *machine;
u8 origin = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;

Expand Down Expand Up @@ -1025,7 +1026,8 @@ static void event__process_sample(const event_t *self,
if (self->header.misc & PERF_RECORD_MISC_EXACT_IP)
exact_samples++;

if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
if (event__preprocess_sample(self, session, &al, &data,
symbol_filter) < 0 ||
al.filtered)
return;

Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/callchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "util.h"
#include "callchain.h"

bool ip_callchain__valid(struct ip_callchain *chain, event_t *event)
bool ip_callchain__valid(struct ip_callchain *chain, const event_t *event)
{
unsigned int chain_size = event->header.size;
chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event;
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/callchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ int register_callchain_param(struct callchain_param *param);
int append_chain(struct callchain_node *root, struct ip_callchain *chain,
struct map_symbol *syms);

bool ip_callchain__valid(struct ip_callchain *chain, event_t *event);
bool ip_callchain__valid(struct ip_callchain *chain, const event_t *event);
#endif /* __PERF_CALLCHAIN_H */
33 changes: 29 additions & 4 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,36 @@ static void dso__calc_col_width(struct dso *self)
}

int event__preprocess_sample(const event_t *self, struct perf_session *session,
struct addr_location *al, symbol_filter_t filter)
struct addr_location *al, struct sample_data *data,
symbol_filter_t filter)
{
u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct thread *thread = perf_session__findnew(session, self->ip.pid);
struct thread *thread;

event__parse_sample(self, session->sample_type, data);

dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld cpu:%d\n",
self->header.misc, data->pid, data->tid, data->ip,
data->period, data->cpu);

if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
unsigned int i;

dump_printf("... chain: nr:%Lu\n", data->callchain->nr);

if (!ip_callchain__valid(data->callchain, self)) {
pr_debug("call-chain problem with event, "
"skipping it.\n");
goto out_filtered;
}

if (dump_trace) {
for (i = 0; i < data->callchain->nr; i++)
dump_printf("..... %2d: %016Lx\n",
i, data->callchain->ips[i]);
}
}
thread = perf_session__findnew(session, self->ip.pid);
if (thread == NULL)
return -1;

Expand Down Expand Up @@ -724,9 +749,9 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
return 0;
}

int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
int event__parse_sample(const event_t *event, u64 type, struct sample_data *data)
{
u64 *array = event->sample.array;
const u64 *array = event->sample.array;

if (type & PERF_SAMPLE_IP) {
data->ip = event->ip.ip;
Expand Down
5 changes: 3 additions & 2 deletions trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ int event__process_task(event_t *self, struct perf_session *session);

struct addr_location;
int event__preprocess_sample(const event_t *self, struct perf_session *session,
struct addr_location *al, symbol_filter_t filter);
int event__parse_sample(event_t *event, u64 type, struct sample_data *data);
struct addr_location *al, struct sample_data *data,
symbol_filter_t filter);
int event__parse_sample(const event_t *event, u64 type, struct sample_data *data);

extern const char *event__name[];

Expand Down

0 comments on commit 17ab963

Please sign in to comment.