perf: make events stream always parsable
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / events / core.c
index 928fae7..15d0f24 100644 (file)
@@ -1213,6 +1213,9 @@ static void perf_event__id_header_size(struct perf_event *event)
        if (sample_type & PERF_SAMPLE_TIME)
                size += sizeof(data->time);
 
+       if (sample_type & PERF_SAMPLE_IDENTIFIER)
+               size += sizeof(data->id);
+
        if (sample_type & PERF_SAMPLE_ID)
                size += sizeof(data->id);
 
@@ -4280,7 +4283,7 @@ static void __perf_event_header__init_id(struct perf_event_header *header,
        if (sample_type & PERF_SAMPLE_TIME)
                data->time = perf_clock();
 
-       if (sample_type & PERF_SAMPLE_ID)
+       if (sample_type & (PERF_SAMPLE_ID | PERF_SAMPLE_IDENTIFIER))
                data->id = primary_event_id(event);
 
        if (sample_type & PERF_SAMPLE_STREAM_ID)
@@ -4319,6 +4322,9 @@ static void __perf_event__output_id_sample(struct perf_output_handle *handle,
 
        if (sample_type & PERF_SAMPLE_CPU)
                perf_output_put(handle, data->cpu_entry);
+
+       if (sample_type & PERF_SAMPLE_IDENTIFIER)
+               perf_output_put(handle, data->id);
 }
 
 void perf_event__output_id_sample(struct perf_event *event,
@@ -4432,6 +4438,9 @@ void perf_output_sample(struct perf_output_handle *handle,
 
        perf_output_put(handle, *header);
 
+       if (sample_type & PERF_SAMPLE_IDENTIFIER)
+               perf_output_put(handle, data->id);
+
        if (sample_type & PERF_SAMPLE_IP)
                perf_output_put(handle, data->ip);