perf session: Adopt the sample_type variable

All tools had copies, and perf diff would have to specify a
sample_type_check method just for copying it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260807780-19377-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-12-14 14:23:00 -02:00 committed by Ingo Molnar
parent a328626b61
commit c019879bcc
7 changed files with 34 additions and 58 deletions

View file

@ -61,8 +61,6 @@ static int cleanup_scripting(void)
static char const *input_name = "perf.data";
static u64 sample_type;
static int process_sample_event(event_t *event, struct perf_session *session)
{
struct sample_data data;
@ -73,7 +71,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
data.cpu = -1;
data.period = 1;
event__parse_sample(event, sample_type, &data);
event__parse_sample(event, session->sample_type, &data);
dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
event->header.misc,
@ -88,7 +86,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return -1;
}
if (sample_type & PERF_SAMPLE_RAW) {
if (session->sample_type & PERF_SAMPLE_RAW) {
/*
* FIXME: better resolve from pid from the struct trace_entry
* field, although it should be the same than this perf
@ -103,11 +101,9 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return 0;
}
static int sample_type_check(u64 type, struct perf_session *session __used)
static int sample_type_check(struct perf_session *session)
{
sample_type = type;
if (!(sample_type & PERF_SAMPLE_RAW)) {
if (!(session->sample_type & PERF_SAMPLE_RAW)) {
fprintf(stderr,
"No trace sample to read. Did you call perf record "
"without -R?");