lkml.org 
[lkml]   [2014]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 08/37] perf tools: Handle multi-file session properly
Hi Jiri,

On Wed, Dec 31, 2014 at 9:01 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Wed, Dec 24, 2014 at 04:15:04PM +0900, Namhyung Kim wrote:
>> When perf detects multi-file data directory, process header file first
>> and then rest data files in a row. Note that the multi-file data is
>> recorded for each cpu/thread separately, it's already ordered with
>> respect to themselves so no need to use the ordered event queue
>> interface.

[SNIP]
>> @@ -1362,18 +1361,40 @@ int perf_session__process_events(struct perf_session *session,
>> struct perf_tool *tool)
>> {
>> u64 size = perf_data_file__size(session->file);
>> - int err;
>> + int err, i;
>>
>> if (perf_session__register_idle_thread(session) == NULL)
>> return -ENOMEM;
>>
>> - if (!perf_data_file__is_pipe(session->file))
>> - err = __perf_session__process_events(session,
>> - session->header.data_offset,
>> - session->header.data_size,
>> - size, tool);
>> - else
>> - err = __perf_session__process_pipe_events(session, tool);
>> + if (perf_data_file__is_pipe(session->file))
>> + return __perf_session__process_pipe_events(session, tool);
>> +
>> + err = __perf_session__process_events(session,
>> + perf_data_file__fd(session->file),
>> + session->header.data_offset,
>> + session->header.data_size,
>> + size, tool);
>> + if (!session->file->is_multi || err)
>> + return err;
>
> if we have file->is_multi true, the perf_data_file__fd(session->file)
> is the perf.header file right? So presumably, there's no data in it,
> and we dont need to call above __perf_session__process_events function?

Right, it's for perf.header file and has no samples but it has meta
events like fork, comm, mmap so it needs to be processed (before
processing samples).

Thanks,
Namhyung


>
>> +
>> + /*
>> + * For multi-file data storage, events are processed for each
>> + * cpu/thread so it's already ordered.
>> + */
>> + tool->ordered_events = false;
>> +
>> + for (i = 0; i < session->file->nr_multi; i++) {
>> + int fd = perf_data_file__multi_fd(session->file, i);
>> +
>> + size = lseek(fd, 0, SEEK_END);
>> + if (size == 0)
>> + continue;
>> +
>> + err = __perf_session__process_events(session, fd,
>> + 0, size, size, tool);
>> + if (err < 0)
>> + break;
>> + }
>>
>> return err;
>> }
>> --
>> 2.1.3
>>


\
 
 \ /
  Last update: 2014-12-31 16:01    [W:0.467 / U:1.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site