aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-11-11 19:28:50 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 07:37:29 -0500
commit81e36bffad95e015af9741b5b1ee16afe08aab05 (patch)
tree3468b3f8e1109e8e1d89d5d910d3a533bf6da70e /tools/perf/util/session.c
parentd04b35f8085f0d4c5c874515b8f65e7664357148 (diff)
perf evlist: Introduce id_hdr_size method out of perf_session
We will need this when not using perf_session in cases like 'perf top' and strace where no perf.data file is created nor consumed. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-za923wjc41q5xot5vrhuhj3j@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index a76666f17767..675e080f66b6 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -78,39 +78,12 @@ out_close:
78 return -1; 78 return -1;
79} 79}
80 80
81static void perf_session__id_header_size(struct perf_session *session)
82{
83 struct perf_sample *data;
84 u64 sample_type = session->sample_type;
85 u16 size = 0;
86
87 if (!session->sample_id_all)
88 goto out;
89
90 if (sample_type & PERF_SAMPLE_TID)
91 size += sizeof(data->tid) * 2;
92
93 if (sample_type & PERF_SAMPLE_TIME)
94 size += sizeof(data->time);
95
96 if (sample_type & PERF_SAMPLE_ID)
97 size += sizeof(data->id);
98
99 if (sample_type & PERF_SAMPLE_STREAM_ID)
100 size += sizeof(data->stream_id);
101
102 if (sample_type & PERF_SAMPLE_CPU)
103 size += sizeof(data->cpu) * 2;
104out:
105 session->id_hdr_size = size;
106}
107
108void perf_session__update_sample_type(struct perf_session *self) 81void perf_session__update_sample_type(struct perf_session *self)
109{ 82{
110 self->sample_type = perf_evlist__sample_type(self->evlist); 83 self->sample_type = perf_evlist__sample_type(self->evlist);
111 self->sample_size = __perf_evsel__sample_size(self->sample_type); 84 self->sample_size = __perf_evsel__sample_size(self->sample_type);
112 self->sample_id_all = perf_evlist__sample_id_all(self->evlist); 85 self->sample_id_all = perf_evlist__sample_id_all(self->evlist);
113 perf_session__id_header_size(self); 86 self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist);
114} 87}
115 88
116int perf_session__create_kernel_maps(struct perf_session *self) 89int perf_session__create_kernel_maps(struct perf_session *self)