perf tools: Move event__parse_sample to evsel.c
[pandora-kernel.git] / tools / perf / util / event.c
index 1478ab4..e4db8b8 100644 (file)
@@ -826,128 +826,3 @@ out_filtered:
        al->filtered = true;
        return 0;
 }
-
-static int event__parse_id_sample(const event_t *event,
-                                 struct perf_session *session,
-                                 struct sample_data *sample)
-{
-       const u64 *array;
-       u64 type;
-
-       sample->cpu = sample->pid = sample->tid = -1;
-       sample->stream_id = sample->id = sample->time = -1ULL;
-
-       if (!session->sample_id_all)
-               return 0;
-
-       array = event->sample.array;
-       array += ((event->header.size -
-                  sizeof(event->header)) / sizeof(u64)) - 1;
-       type = session->sample_type;
-
-       if (type & PERF_SAMPLE_CPU) {
-               u32 *p = (u32 *)array;
-               sample->cpu = *p;
-               array--;
-       }
-
-       if (type & PERF_SAMPLE_STREAM_ID) {
-               sample->stream_id = *array;
-               array--;
-       }
-
-       if (type & PERF_SAMPLE_ID) {
-               sample->id = *array;
-               array--;
-       }
-
-       if (type & PERF_SAMPLE_TIME) {
-               sample->time = *array;
-               array--;
-       }
-
-       if (type & PERF_SAMPLE_TID) {
-               u32 *p = (u32 *)array;
-               sample->pid = p[0];
-               sample->tid = p[1];
-       }
-
-       return 0;
-}
-
-int event__parse_sample(const event_t *event, struct perf_session *session,
-                       struct sample_data *data)
-{
-       const u64 *array;
-       u64 type;
-
-       if (event->header.type != PERF_RECORD_SAMPLE)
-               return event__parse_id_sample(event, session, data);
-
-       array = event->sample.array;
-       type = session->sample_type;
-
-       if (type & PERF_SAMPLE_IP) {
-               data->ip = event->ip.ip;
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_TID) {
-               u32 *p = (u32 *)array;
-               data->pid = p[0];
-               data->tid = p[1];
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_TIME) {
-               data->time = *array;
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_ADDR) {
-               data->addr = *array;
-               array++;
-       }
-
-       data->id = -1ULL;
-       if (type & PERF_SAMPLE_ID) {
-               data->id = *array;
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_STREAM_ID) {
-               data->stream_id = *array;
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_CPU) {
-               u32 *p = (u32 *)array;
-               data->cpu = *p;
-               array++;
-       } else
-               data->cpu = -1;
-
-       if (type & PERF_SAMPLE_PERIOD) {
-               data->period = *array;
-               array++;
-       }
-
-       if (type & PERF_SAMPLE_READ) {
-               pr_debug("PERF_SAMPLE_READ is unsuported for now\n");
-               return -1;
-       }
-
-       if (type & PERF_SAMPLE_CALLCHAIN) {
-               data->callchain = (struct ip_callchain *)array;
-               array += 1 + data->callchain->nr;
-       }
-
-       if (type & PERF_SAMPLE_RAW) {
-               u32 *p = (u32 *)array;
-               data->raw_size = *p;
-               p++;
-               data->raw_data = p;
-       }
-
-       return 0;
-}