perf tools: Speed-up perf report by using multi thread (v2)
Namhyung Kim
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
In reply to Arnaldo Carvalho de MeloQuoted 17 lines · Arnaldo Carvalho de Melo
Em Mon, May 18, 2015 at 09:30:50AM +0900, Namhyung Kim escreveu:
Quoted 12 lines
When perf creates a new child to profile, the events are enabled on
exec(). And in this case, it doesn't synthesize any event for the child since they'll be generated duringexec(). But there's an window between the enabling and the event generation.It used to be overcome since samples are only in kernel (so we always have the map) and the comm is overridden by a later COMM event. However it won't work anymore since those samples will go to a missing thread now but the COMM event will create a (current) thread. This leads to those early samples (like
native_write_msr_safe) not having a comm but pid (like ':15328').Quoted 3 lines
So it needs to synthesize COMM event for the child explicitly before enabling so that it can have a correct comm. But at this time, the comm will be "perf" since it's not exec-ed yet.
Quoted 5 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.
Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree. That's the reason why I didn't put it in a generic place like you said.
However I changed not to use the separate tree - the purpose of the tree was to reduce lock acquisition on thread searching but it already grabs a rwlock with thread refcounting change.
Will check whether this is still needed..
Thanks,
Namhyung
Quoted 84 lines
I also wonder if we can't overcome this without using /proc, i.e. actually moving the "start the workload" to just before the fork, so that the kernel covers that as well.
Or, alternatively, the thread can be created without having to look at /proc at all, but by directly creating the struct thread, with the correct COMM, pid, etc, that we know, since we forked it, etc.
- Arnaldo
Quoted 68 lines
Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/builtin-record.c | 18 +++++++++++++++++- tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-)tools/perf/builtin-record.c +17
-1@@ -766,8 +766,24 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)/* * Let the child rip */ -if (forks) +if (forks) { +union perf_event *comm_event; + + comm_event =malloc (sizeof (*comm_event) + machine->id_hdr_size); +if (comm_event ==NULL ) + goto out_child; + + err =perf_event__synthesize_comm (tool, comm_event, + rec->evlist->workload.pid, + process_synthesized_event, + machine); +free (comm_event); + +if (err <0 ) + goto out_child; +perf_evlist__start_workload (rec->evlist); + }if (opts->initial_delay) {usleep (opts->initial_delay *1000 );tools/perf/util/event.c +1
-1@@ -165,7 +165,7 @@ static int perf_event__prepare_comm(union perf_event *event, pid_t pid,return 0 ; } -static pid_t perf_event__synthesize_comm (struct perf_tool *tool, +pid_t perf_event__synthesize_comm (struct perf_tool *tool,union perf_event *event,pid_t pid,perf_event__handler_t process,struct machine *machine)tools/perf/util/event.h +5
-0@@ -452,6 +452,11 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,struct machine *machine, bool mmap_data); +pid_t perf_event__synthesize_comm (struct perf_tool *tool, +union perf_event *event,pid_t pid, +perf_event__handler_t process, +struct machine *machine); +size_t perf_event__fprintf_comm (union perf_event *event,FILE *fp);size_t perf_event__fprintf_mmap (union perf_event *event,FILE *fp);size_t perf_event__fprintf_mmap2 (union perf_event *event,FILE *fp);Signature · 1 line
2.4.0--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Em Tue, May 19, 2015 at 04:46:43PM +0900, Namhyung Kim escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Mon, May 18, 2015 at 09:30:50AM +0900, Namhyung Kim escreveu:
Quoted 15 lines
When perf creates a new child to profile, the events are enabled on
exec(). And in this case, it doesn't synthesize any event for the child since they'll be generated duringexec(). But there's an window between the enabling and the event generation.It used to be overcome since samples are only in kernel (so we always have the map) and the comm is overridden by a later COMM event. However it won't work anymore since those samples will go to a missing thread now but the COMM event will create a (current) thread. This leads to those early samples (like
native_write_msr_safe) not having a comm but pid (like ':15328').So it needs to synthesize COMM event for the child explicitly before enabling so that it can have a correct comm. But at this time, the comm will be "perf" since it's not exec-ed yet.
Quoted 8 lines
Quoted 5 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
- Arnaldo
Quoted 97 lines
That's the reason why I didn't put it in a generic place like you said.
However I changed not to use the separate tree - the purpose of the tree was to reduce lock acquisition on thread searching but it already grabs a rwlock with thread refcounting change.
Will check whether this is still needed..
Thanks,
NamhyungQuoted 84 lines
I also wonder if we can't overcome this without using /proc, i.e. actually moving the "start the workload" to just before the fork, so that the kernel covers that as well.
Or, alternatively, the thread can be created without having to look at /proc at all, but by directly creating the struct thread, with the correct COMM, pid, etc, that we know, since we forked it, etc.
- Arnaldo
Quoted 68 lines
Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/builtin-record.c | 18 +++++++++++++++++- tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-)tools/perf/builtin-record.c +17
-1@@ -766,8 +766,24 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)/* * Let the child rip */ -if (forks) +if (forks) { +union perf_event *comm_event; + + comm_event =malloc (sizeof (*comm_event) + machine->id_hdr_size); +if (comm_event ==NULL ) + goto out_child; + + err =perf_event__synthesize_comm (tool, comm_event, + rec->evlist->workload.pid, + process_synthesized_event, + machine); +free (comm_event); + +if (err <0 ) + goto out_child; +perf_evlist__start_workload (rec->evlist); + }if (opts->initial_delay) {usleep (opts->initial_delay *1000 );tools/perf/util/event.c +1
-1@@ -165,7 +165,7 @@ static int perf_event__prepare_comm(union perf_event *event, pid_t pid,return 0 ; } -static pid_t perf_event__synthesize_comm (struct perf_tool *tool, +pid_t perf_event__synthesize_comm (struct perf_tool *tool,union perf_event *event,pid_t pid,perf_event__handler_t process,struct machine *machine)tools/perf/util/event.h +5
-0@@ -452,6 +452,11 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,struct machine *machine, bool mmap_data); +pid_t perf_event__synthesize_comm (struct perf_tool *tool, +union perf_event *event,pid_t pid, +perf_event__handler_t process, +struct machine *machine); +size_t perf_event__fprintf_comm (union perf_event *event,FILE *fp);size_t perf_event__fprintf_mmap (union perf_event *event,FILE *fp);size_t perf_event__fprintf_mmap2 (union perf_event *event,FILE *fp);Signature · 1 line
2.4.0--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Namhyung Kim
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Quoted 25 lines · Arnaldo Carvalho de Melo
Em Tue, May 19, 2015 at 04:46:43PM +0900, Namhyung Kim escreveu:
Quoted 24 lines · Arnaldo Carvalho de Melo
Quoted 22 lines
Em Mon, May 18, 2015 at 09:30:50AM +0900, Namhyung Kim escreveu:
Quoted 12 lines
When perf creates a new child to profile, the events are enabled on
exec(). And in this case, it doesn't synthesize any event for the child since they'll be generated duringexec(). But there's an window between the enabling and the event generation.It used to be overcome since samples are only in kernel (so we always have the map) and the comm is overridden by a later COMM event. However it won't work anymore since those samples will go to a missing thread now but the COMM event will create a (current) thread. This leads to those early samples (like
native_write_msr_safe) not having a comm but pid (like ':15328').Quoted 3 lines
So it needs to synthesize COMM event for the child explicitly before enabling so that it can have a correct comm. But at this time, the comm will be "perf" since it's not exec-ed yet.
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.
Quoted 8 lines
Quoted 2 lines
Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
But as I said before, later COMM event will override thread->comm to a proper string as long as it can find a matching thread. So I think it has no problem in the current code.
In the old version of this patchset (v3), indexing made it impossible for COMM event to find a matching thread since it used to have a separate tree for threads that have sampled before any FORK/COMM event came. I think it doesn't apply to the current version anymore, I will check it tomorrow.
Thanks,
Namhyung
Quoted 24 lines
- Arnaldo
Quoted 21 lines
That's the reason why I didn't put it in a generic place like you said.
However I changed not to use the separate tree - the purpose of the tree was to reduce lock acquisition on thread searching but it already grabs a rwlock with thread refcounting change.
Will check whether this is still needed..
Thanks,
NamhyungQuoted 8 lines
I also wonder if we can't overcome this without using /proc, i.e. actually moving the "start the workload" to just before the fork, so that the kernel covers that as well.
Or, alternatively, the thread can be created without having to look at /proc at all, but by directly creating the struct thread, with the correct COMM, pid, etc, that we know, since we forked it, etc.
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Em Wed, May 20, 2015 at 12:12:45AM +0900, Namhyung Kim escreveu:
Quoted 29 lines · Arnaldo Carvalho de Melo
Quoted 28 lines
Em Tue, May 19, 2015 at 04:46:43PM +0900, Namhyung Kim escreveu:
Quoted 26 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Mon, May 18, 2015 at 09:30:50AM +0900, Namhyung Kim escreveu:
Quoted 12 lines
When perf creates a new child to profile, the events are enabled on
exec(). And in this case, it doesn't synthesize any event for the child since they'll be generated duringexec(). But there's an window between the enabling and the event generation.It used to be overcome since samples are only in kernel (so we always have the map) and the comm is overridden by a later COMM event. However it won't work anymore since those samples will go to a missing thread now but the COMM event will create a (current) thread. This leads to those early samples (like
native_write_msr_safe) not having a comm but pid (like ':15328').Quoted 3 lines
So it needs to synthesize COMM event for the child explicitly before enabling so that it can have a correct comm. But at this time, the comm will be "perf" since it's not exec-ed yet.
Quoted 5 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Quoted 7 lines
Quoted 5 lines
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
But as I said before, later COMM event will override
thread->commto a
But what happens for samples that take place before this "later COMM event"? Even tho we know the COMM (we're starting the workload) we will show just the pid, right?
Think about processing the samples with minimum delay (perf trace), ordered by timestamp, but only ordering the head of the ring buffers, not with a perf.data file.
- Arnaldo
Quoted 37 lines
proper string as long as it can find a matching thread. So I think it has no problem in the current code.
In the old version of this patchset (v3), indexing made it impossible for COMM event to find a matching thread since it used to have a separate tree for threads that have sampled before any FORK/COMM event came. I think it doesn't apply to the current version anymore, I will check it tomorrow.
Thanks,
NamhyungQuoted 24 lines
- Arnaldo
Quoted 21 lines
That's the reason why I didn't put it in a generic place like you said.
However I changed not to use the separate tree - the purpose of the tree was to reduce lock acquisition on thread searching but it already grabs a rwlock with thread refcounting change.
Will check whether this is still needed..
Thanks,
NamhyungQuoted 8 lines
I also wonder if we can't overcome this without using /proc, i.e. actually moving the "start the workload" to just before the fork, so that the kernel covers that as well.
Or, alternatively, the thread can be created without having to look at /proc at all, but by directly creating the struct thread, with the correct COMM, pid, etc, that we know, since we forked it, etc.
Re: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
In reply to Namhyung KimOn Wed, May 20, 2015 at 12:12:45AM +0900, Namhyung Kim wrote:
SNIP
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.Quoted 8 lines
Quoted 2 lines
Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
Quoted 3 lines
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.
I can see the issue in the current script code and the patch cured it ;-)
before:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]
:29236 29236 350869.479255: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
:29236 29236 350869.479260: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
:29236 29236 350869.479261: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
:29236 29236 350869.479263: 122 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
:29236 29236 350869.479264: 2303 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
:29236 29236 350869.479266: 49582 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
true 29236 350869.479283: 1041734 cycles: ffffffff81190a4a perf_output_begin ([kernel.kallsyms])after:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]
perf 28041 350801.438466: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
perf 28041 350801.438471: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
perf 28041 350801.438472: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
perf 28041 350801.438473: 140 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
perf 28041 350801.438475: 3721 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
perf 28041 350801.438476: 94744 cycles: ffffffff8118e270 perf_event_comm ([kernel.kallsyms])
true 28041 350801.438508: 1604677 cycles: ffffffff811d0781 do_mmap_pgoff ([kernel.kallsyms])jirka
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
Quoted 20 lines · Namhyung Kim
SNIP
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 6 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
Quoted 5 lines
Quoted 3 lines
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.I can see the issue in the current script code and the patch cured it ;-)
Exactly, this is my point, this is not something new :-)
- Arnaldo
Quoted 27 lines
before:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]:29236 29236 350869.479255: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479260: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479261: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479263: 122 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479264: 2303 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479266: 49582 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy true 29236 350869.479283: 1041734 cycles: ffffffff81190a4a perf_output_begin ([kernel.kallsyms])after:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]perf 28041 350801.438466: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438471: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438472: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438473: 140 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438475: 3721 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438476: 94744 cycles: ffffffff8118e270 perf_event_comm ([kernel.kallsyms]) true 28041 350801.438508: 1604677 cycles: ffffffff811d0781 do_mmap_pgoff ([kernel.kallsyms])jirka
Namhyung Kim
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Quoted 21 lines · Arnaldo Carvalho de Melo
Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
Quoted 20 lines · Namhyung Kim
SNIP
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 6 lines
This looks reasonable, but I think it probably needs to be done somewhere in
perf_evlist__prepare_workload()orperf_evlist__start_workload(), as this affects other tools as well, like 'top', 'trace' and any other that may want to do this start-workload use case.Hmm.. I need to look at this again as it only affects on processing indexed data files which used to have a separate missing threads tree.
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.I can see the issue in the current script code and the patch cured it ;-)
Exactly, this is my point, this is not something new :-)
Ah, okay. The perf script shows samples before processing comm events while perf report shows after processing all events.
But to move it under generic place like perf_evlist__{prepare,start}_ workload(), it seems we need to pass an additional callback and data.
I'll try to write a patch.
Thanks,
Namhyung
Quoted 35 lines
- Arnaldo
Quoted 26 lines
before:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]:29236 29236 350869.479255: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479260: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479261: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479263: 122 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479264: 2303 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy :29236 29236 350869.479266: 49582 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy true 29236 350869.479283: 1041734 cycles: ffffffff81190a4a perf_output_begin ([kernel.kallsyms])after:
[jolsa@krava perf]$ ./perf record -o - true | ./perf script [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]perf 28041 350801.438466: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438471: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438472: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438473: 140 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438475: 3721 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy perf 28041 350801.438476: 94744 cycles: ffffffff8118e270 perf_event_comm ([kernel.kallsyms]) true 28041 350801.438508: 1604677 cycles: ffffffff811d0781 do_mmap_pgoff ([kernel.kallsyms])Quoted 1 line
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Em Wed, May 20, 2015 at 08:56:58AM +0900, Namhyung Kim escreveu:
Quoted 12 lines · Arnaldo Carvalho de Melo
Quoted 10 lines
Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I can see the issue in the current script code and the patch cured it ;-)
Exactly, this is my point, this is not something new :-)
Ah, okay. The perf script shows samples before processing comm events while perf report shows after processing all events.
I.e. 'perf script' behaves like 'perf trace' and 'perf top'. 'perf report' is the odd one out, and I think it should be not, i.e. you should try to think more about the non 'report' use cases when thinking about how to improve report :-)
But I digress, lets get back to the question at hand...
Quoted 2 lines
But to move it under generic place like perf_evlist__{prepare,start}_
workload(), it seems we need to pass an additional callback and data.
Only if you want to do it with perf_event__synthesize_comm(). I suggested writing a new synthesize routine that doesn't parses /proc, as we have all that we need, no?
I think that just doing something like:
thread = machine__findnew_thread(evlist->workload.pid, evlist->workload.pid); if (thread) thread__set_comm(thread, argv[0], timestamp);
Should be enough, no? I.e. no need for setting up a PERF_RECORD_FORK and a PERF_RECORD_COMM, read /proc, etc, just do it directly with the info we used to do the fork in perf_evlist__prepare_workload(), etc.
Quoted 1 line
I'll try to write a patch.
Great!
- Arnaldo
Namhyung Kim
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Quoted 17 lines · Arnaldo Carvalho de Melo
Em Wed, May 20, 2015 at 08:56:58AM +0900, Namhyung Kim escreveu:
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 14 lines
Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.I can see the issue in the current script code and the patch cured it ;-)
Exactly, this is my point, this is not something new :-)
Quoted 7 lines
Quoted 2 lines
Ah, okay. The perf script shows samples before processing comm events while perf report shows after processing all events.
I.e. 'perf script' behaves like 'perf trace' and 'perf top'. 'perf report' is the odd one out, and I think it should be not, i.e. you should try to think more about the non 'report' use cases when thinking about how to improve report :-)
I'll keep it in mind.
Quoted 9 lines
But I digress, lets get back to the question at hand...
Quoted 2 lines
But to move it under generic place like perf_evlist__{prepare,start}_
workload(), it seems we need to pass an additional callback and data.Only if you want to do it with
perf_event__synthesize_comm(). I suggested writing a new synthesize routine that doesn't parses /proc, as we have all that we need, no?
Agreed.
Quoted 10 lines
I think that just doing something like:
thread = machine__findnew_thread(evlist->workload.pid, evlist->workload.pid); if (thread) thread__set_comm(thread, argv[0], timestamp);Should be enough, no? I.e. no need for setting up a
PERF_RECORD_FORKand aPERF_RECORD_COMM, read /proc, etc, just do it directly with the info we used to do the fork inperf_evlist__prepare_workload(), etc.
For non-record use case it'd be enough. But for record, it needs to synthesize/write an event to data file so that perf report can recognize it later. That's why I think it needs callback.
Thanks,
Namhyung
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload
Em Wed, May 20, 2015 at 09:56:25AM +0900, Namhyung Kim escreveu:
Quoted 47 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Wed, May 20, 2015 at 08:56:58AM +0900, Namhyung Kim escreveu:
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 14 lines
Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Humm, you're thinking about where you managed to reproduce the problem, I am thinking outside indexing, etc, i.e. by definition we either enable the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we synthesize it either from /proc or directly (preferred) if we decide to do it after the fork/exec, right?
But as I said before, later COMM event will override
thread->commto a proper string as long as it can find a matching thread. So I think it has no problem in the current code.I can see the issue in the current script code and the patch cured it ;-)
Exactly, this is my point, this is not something new :-)
Quoted 7 lines
Quoted 2 lines
Ah, okay. The perf script shows samples before processing comm events while perf report shows after processing all events.
I.e. 'perf script' behaves like 'perf trace' and 'perf top'. 'perf report' is the odd one out, and I think it should be not, i.e. you should try to think more about the non 'report' use cases when thinking about how to improve report :-)
I'll keep it in mind.
Quoted 9 lines
But I digress, lets get back to the question at hand...
Quoted 2 lines
But to move it under generic place like perf_evlist__{prepare,start}_
workload(), it seems we need to pass an additional callback and data.Only if you want to do it with
perf_event__synthesize_comm(). I suggested writing a new synthesize routine that doesn't parses /proc, as we have all that we need, no?Agreed.
Quoted 7 lines
I think that just doing something like:
thread = machine__findnew_thread(evlist->workload.pid, evlist->workload.pid); if (thread) thread__set_comm(thread, argv[0], timestamp);
Quoted 7 lines
Quoted 3 lines
Should be enough, no? I.e. no need for setting up a
PERF_RECORD_FORKand aPERF_RECORD_COMM, read /proc, etc, just do it directly with the info we used to do the fork inperf_evlist__prepare_workload(), etc.For non-record use case it'd be enough. But for record, it needs to synthesize/write an event to data file so that perf report canout recognize it later. That's why I think it needs callback.
You have a point, then probably it is better to have it as a function to be called by each kind of tool, as needed.
- Arnaldo
Namhyung Kim
maintainerPATCH 36/40 perf tools: Fix progress ui to support multi thread
In reply to Namhyung KimSplit ui_progress struct into global and local one. Each thread updates local struct without lock and only updates global one if meaningful progress is done (with lock).
To do that, pass struct ui_progress to __perf_session__process_event() and set it for the total size of multi-file storage.
--- tools/perf/util/hist.c | 5 ++-- tools/perf/util/hist.h | 3 +- tools/perf/util/session.c | 71 ++++++++++++++++++++++++++++++++++++++--------- tools/perf/util/tool.h | 3 ++ 4 files changed, 66 insertions(+), 16 deletions(-)
tools/perf/util/hist.c +3 -2
@@ -1052,12 +1052,13 @@ void hists__collapse_resort(struct hists *hists, struct ui_progress *prog)__hists__collapse_resort (hists, root, prog); } -void hists__mt_resort (struct hists *dst,struct hists *src) +void hists__mt_resort (struct hists *dst,struct hists *src, +struct ui_progress *prog) {struct rb_root *root = src->entries_in; sort__need_collapse =1 ; -__hists__collapse_resort (dst, root,NULL ); +__hists__collapse_resort (dst, root, prog); }static int hist_entry__sort (struct hist_entry *a,struct hist_entry *b)
tools/perf/util/hist.h +2 -1
@@ -122,7 +122,8 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *bf, size_t size,void hist_entry__delete (struct hist_entry *he);void hists__output_resort (struct hists *hists,struct ui_progress *prog); -void hists__mt_resort (struct hists *dst,struct hists *src); +void hists__mt_resort (struct hists *dst,struct hists *src, +struct ui_progress *prog);void hists__collapse_resort (struct hists *hists,struct ui_progress *prog);void hists__decay_entries (struct hists *hists,bool zap_user,bool zap_kernel);
tools/perf/util/session.c +58 -13
191 lines not on this page · raw message
tools/perf/util/tool.h +3 -0
@@ -3,6 +3,7 @@#include <stdbool.h> #include "util/event.h" +#include "ui/progress.h" #include <linux/types.h>
@@ -66,6 +67,8 @@ struct perf_tool_mt {struct events_stats stats;struct hists *hists;struct perf_session *session; +struct ui_progress prog; +struct ui_progress *global_prog;int idx;void *priv;
Signature · 1 line
2.4.0
Namhyung Kim
maintainerPATCH 37/40 perf report: Add --multi-thread option and config item
In reply to Namhyung KimThe --multi-thread option is to enable parallel processing so user can force serial processing even for indexed data file. It default to false for now but users also can changes this by setting "report.multi_thread" config option in ~/.perfconfig file.
--- tools/perf/Documentation/perf-report.txt | 2 + tools/perf/builtin-report.c | 66 +++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 9 deletions(-)
tools/perf/Documentation/perf-report.txt +2 -0
@@ -353,6 +353,8 @@ OPTIONS To disable decoding entirely, use --no-itrace. +--multi-thread:: + Speed up report by parallelizing sample processing using multi-thread. include::callchain-overhead-calculation.txt[]
tools/perf/builtin-report.c +57 -9
118 lines not on this page · raw message
Signature · 1 line
2.4.0
Namhyung Kim
maintainerPATCH 38/40 perf session: Handle index files generally
In reply to Namhyung KimThe current code assumes that the number of index item and cpu are matched so it creates that number of threads. But it's not the case of non-system-wide session or data came from different machine.
Just creates threads at most number of online cpus and process data.
--- tools/perf/util/session.c | 79 ++++++++++++++++++++++++++++++++++------------- tools/perf/util/tool.h | 1 - 2 files changed, 58 insertions(+), 22 deletions(-)
tools/perf/util/session.c +58 -21
@@ -1679,25 +1679,50 @@ static struct ui_progress_ops mt_progress__ops = { .update = mt_progress__update, }; +static int perf_session__get_index (struct perf_session *session) +{ +int ret; +static unsigned idx =1 ; +static pthread_mutex_t idx_lock =PTHREAD_MUTEX_INITIALIZER ; + +pthread_mutex_lock (&idx_lock); +if (idx < session->header.nr_index) + ret = idx++; +else + ret =-1 ; +pthread_mutex_unlock (&idx_lock); + +return ret; +} +static void *processing_thread_idx (void *arg) {struct perf_tool_mt *mt_tool = arg;struct perf_session *session = mt_tool->session; -u64 offset = session->header.index[mt_tool->idx].offset; -u64 size = session->header.index[mt_tool->idx].size;u64 file_size =perf_data_file__size (session->file); +int idx; -ui_progress__init (&mt_tool->prog, size,"" ); +while ((idx =perf_session__get_index (session)) >=0 ) { +u64 offset = session->header.index[idx].offset; +u64 size = session->header.index[idx].size; +struct perf_tool_mt *mtt = &mt_tool[idx]; -pr_debug ("processing samples using thread [%d]\n" , mt_tool->idx); -if (__perf_session__process_events (session, &mt_tool->stats, - offset, size, file_size, - &mt_tool->prog) <0 ) { -pr_err ("processing samples failed (thread [%d])\n" , mt_tool->idx); -return NULL ; +if (size ==0 ) +continue ; + +pr_debug ("processing samples [index %d]\n" , idx); + +ui_progress__init (&mtt->prog, size,"" ); + +if (__perf_session__process_events (mtt->session, &mtt->stats, + offset, size, file_size, + &mtt->prog) <0 ) { +pr_err ("processing samples failed [index %d]\n" , idx); +return NULL ; + } +pr_debug ("processing samples done [index %d]\n" , idx); } -pr_debug ("processing samples done for thread [%d]\n" , mt_tool->idx);return arg; }
@@ -1717,6 +1742,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)int err, i, k;int nr_index = session->header.nr_index;u64 size =perf_data_file__size (file); +int nr_thread =sysconf (_SC_NPROCESSORS_ONLN);if (perf_data_file__is_pipe (file) || !session->header.index) {pr_err ("data file doesn't contain the index table\n" );
@@ -1753,15 +1779,18 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg) tool->ordered_events = false; -for (i =1 ; i < nr_index; i++) { +for (i =0 ; i < nr_index; i++) { ms = &mt_sessions[i]; mt = &mt_tools[i]; + ms->tool = &mt->tool; ms->file = session->file; ms->evlist = session->evlist; ms->header = session->header; ms->tevent = session->tevent; + ms->machines = session->machines; +ordered_events__init (&ms->ordered_events,NULL );memcpy (&mt->tool, tool,sizeof (*tool)); mt->hists =calloc (evlist->nr_entries,sizeof (*mt->hists));
@@ -1772,20 +1801,28 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)__hists__init (&mt->hists[k]); mt->session = ms; - mt->idx = i; mt->priv = arg; mt->global_prog = &prog; - -pthread_create (&th_id[i],NULL , processing_thread_idx, mt); } -for (i =1 ; i < nr_index; i++) { +if (nr_thread > nr_index -1 ) + nr_thread = nr_index -1 ; + + th_id =calloc (nr_thread,sizeof (*th_id)); +if (th_id ==NULL ) + goto out; + +for (i =0 ; i < nr_thread; i++) +pthread_create (&th_id[i],NULL , processing_thread_idx, mt_tools); + +for (i =0 ; i < nr_thread; i++) {pthread_join (th_id[i], (void **)&mt); -if (mt ==NULL ) { +if (mt ==NULL ) err = -EINVAL ; -continue ; - } + } +for (i =0 ; i < nr_index; i++) { + mt = &mt_tools[i];events_stats__add (&evlist->stats, &mt->stats);evlist__for_each (evlist, evsel) {
@@ -1801,7 +1838,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg) ui_progress__ops = orig_progress__ops;ui_progress__init (&prog, nr_entries,"Merging related events..." ); -for (i =1 ; i < nr_index; i++) { +for (i =0 ; i < nr_index; i++) { mt = &mt_tools[i];evlist__for_each (evlist, evsel) {
@@ -1829,7 +1866,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)perf_session__warn_about_errors (session, &evlist->stats);if (mt_tools) { -for (i =1 ; i < nr_index; i++) +for (i =0 ; i < nr_index; i++)free (mt_tools[i].hists);free (mt_tools); }
@@ -1839,7 +1876,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)return err; err: -while (i-- >1 ) { +while (i-- >0 ) {pthread_cancel (th_id[i]);pthread_join (th_id[i],NULL ); }
tools/perf/util/tool.h +0 -1
@@ -69,7 +69,6 @@ struct perf_tool_mt {struct perf_session *session;struct ui_progress prog;struct ui_progress *global_prog; -int idx;void *priv; };
Signature · 1 line
2.4.0
Re: [PATCH 38/40] perf session: Handle index files generally
Quoted 5 lines · Namhyung Kim
The current code assumes that the number of index item and cpu are matched so it creates that number of threads. But it's not the case of non-system-wide session or data came from different machine.
Just creates threads at most number of online cpus and process data.
-----8<-----
tools/perf/util/session.c int perf_session__process_events_mt(struct perf_session *session, void *arg) · line 1745
Quoted 5 lines
tools/perf/util/session.c +1
-0@@ -1717,6 +1742,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)int err, i, k;int nr_index = session->header.nr_index;u64 size =perf_data_file__size (file); +int nr_thread =sysconf (_SC_NPROCESSORS_ONLN);
It's not clear to me how this multi-threaded perf is going to work on large systems especially this patch if a system has holes in the active cpus. e.g,
# lscpu Architecture: sparc64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Big Endian CPU(s): 704 On-line CPU(s) list: 32-63,128-223,256-351,384-479,576-831,864-927,960-1023 Thread(s) per core: 12 Core(s) per socket: 18 Socket(s): 3 NUMA node(s): 4 NUMA node0 CPU(s): 32-63,128-223 NUMA node1 CPU(s): 256-351,384-479 NUMA node2 CPU(s): 576-767 NUMA node3 CPU(s): 768-831,864-927,960-1023
So you are going to spawn 704 threads? Each thread handles a per-cpu buffer?
yes, I still need to find time to take if for a test drive; maybe by the end of the week.
David
Namhyung Kim
maintainerRe: [PATCH 38/40] perf session: Handle index files generally
Hi David,
Quoted 33 lines · David Ahern
Quoted 5 lines · Namhyung Kim
The current code assumes that the number of index item and cpu are matched so it creates that number of threads. But it's not the case of non-system-wide session or data came from different machine.
Just creates threads at most number of online cpus and process data.
-----8<-----
tools/perf/util/session.c int perf_session__process_events_mt(struct perf_session *session, void *arg) · line 1745
Quoted 5 lines
tools/perf/util/session.c +1
-0@@ -1717,6 +1742,7 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)int err, i, k;int nr_index = session->header.nr_index;u64 size =perf_data_file__size (file); +int nr_thread =sysconf (_SC_NPROCESSORS_ONLN);It's not clear to me how this multi-threaded perf is going to work on large systems especially this patch if a system has holes in the active cpus. e.g,
# lscpu Architecture: sparc64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Big Endian CPU(s): 704 On-line CPU(s) list: 32-63,128-223,256-351,384-479,576-831,864-927,960-1023 Thread(s) per core: 12 Core(s) per socket: 18 Socket(s): 3 NUMA node(s): 4 NUMA node0 CPU(s): 32-63,128-223 NUMA node1 CPU(s): 256-351,384-479 NUMA node2 CPU(s): 576-767 NUMA node3 CPU(s): 768-831,864-927,960-1023
Quoted 1 line
So you are going to spawn 704 threads? Each thread handles a per-cpu buffer?
Oh, I need to add an option (and probably a config variable too) to specify number of thread to run.
Quoted 3 lines
yes, I still need to find time to take if for a test drive; maybe by the end of the week.
Oh, it'd be very nice if you can test and share the numbers on such a large machine. I'll send the --num-thread option patch soon on top of this series for you. :)
Thanks,
Namhyung
Quoted 7 lines
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Namhyung Kim
maintainer[PATCH 41/40] perf report: Add --num-thread option to control number of thread
The --num-thread is to control number of thread to process events when --multi-thread option is enabled. Default value is the number of cpu on the system that runs perf report. The config variable 'report.num-thread' is also added to set a different default value.
---
Also update the perf/threaded-v4 branch.
tools/perf/Documentation/perf-report.txt | 5 +++++ tools/perf/builtin-report.c | 29 +++++++++++++++++++++++++---- tools/perf/util/session.c | 4 ++-- tools/perf/util/session.h | 3 ++- 4 files changed, 34 insertions(+), 7 deletions(-)
tools/perf/Documentation/perf-report.txt +5 -0
@@ -356,6 +356,11 @@ OPTIONS --multi-thread:: Speed up report by parallelizing sample processing using multi-thread. +--num-thread:: + Number of thread to process sample events. Should be greater than or + equals to 2. Default is number of cpus on the system unless + report.num-thread config variable is set. + include::callchain-overhead-calculation.txt[] SEE ALSO
tools/perf/builtin-report.c +25 -4
@@ -54,6 +54,7 @@ struct report {bool header;bool header_only;bool multi_thread; +int nr_thread;int max_stack;struct perf_read_values show_threads_values;const char *pretty_printing_style;
@@ -89,6 +90,10 @@ static int report__config(const char *var, const char *value, void *cb) rep->multi_thread =perf_config_bool (var, value);return 0 ; } +if (!strcmp (var,"report.num-thread" )) { + rep->nr_thread =perf_config_int (var, value); +return 0 ; + }return perf_default_config (var, value, cb); }
@@ -522,7 +527,8 @@ static int __cmd_report(struct report *rep)if (rep->multi_thread) { rep->tool.sample = process_sample_event_mt; - ret =perf_session__process_events_mt (session, rep); + ret =perf_session__process_events_mt (session, rep->nr_thread, + rep); }else { ret =perf_session__process_events (session); }
@@ -664,6 +670,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) }, .max_stack = PERF_MAX_STACK_DEPTH, .pretty_printing_style = "normal", + .nr_thread = -1, };const struct option options[] = { OPT_STRING('i', "input", &input_name, "file",
@@ -774,6 +781,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) itrace_parse_synth_opts),OPT_BOOLEAN (0 ,"multi-thread" , &report.multi_thread,"Speed up sample processing using multi-thead" ), +OPT_INTEGER (0 ,"num-thread" , &report.nr_thread, +"Number of thread to process samples (>= 2)" ),OPT_END () }; struct perf_data_file file = {
@@ -820,9 +829,21 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) session->itrace_synth_opts = &itrace_synth_opts; -if (report.multi_thread && !perf_has_index) { -pr_debug ("fallback to single thread for normal data file.\n" ); - report.multi_thread = false; +if (report.multi_thread) { +if (!perf_has_index) { +pr_debug ("fallback to single thread for normal data file.\n" ); + report.multi_thread = false; + }else { +if (report.nr_thread ==-1 ) + report.nr_thread =sysconf (_SC_NPROCESSORS_ONLN); +else if (report.nr_thread <2 ) { +pr_err ("invalid number of thread: %d\n" , + report.nr_thread); +parse_options_usage (report_usage, options, +"num-thread" ,0 ); + goto error; + } + } } report.session = session;
tools/perf/util/session.c +2 -2
@@ -1726,7 +1726,8 @@ static void *processing_thread_idx(void *arg)return arg; } -int perf_session__process_events_mt (struct perf_session *session,void *arg) +int perf_session__process_events_mt (struct perf_session *session, +int nr_thread,void *arg) {struct perf_data_file *file = session->file;struct perf_evlist *evlist = session->evlist;
@@ -1742,7 +1743,6 @@ int perf_session__process_events_mt(struct perf_session *session, void *arg)int err, i, k;int nr_index = session->header.nr_index;u64 size =perf_data_file__size (file); -int nr_thread =sysconf (_SC_NPROCESSORS_ONLN);if (perf_data_file__is_pipe (file) || !session->header.index) {pr_err ("data file doesn't contain the index table\n" );
tools/perf/util/session.h +2 -1
@@ -56,7 +56,8 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, struct perf_sample *sample);int perf_session__process_events (struct perf_session *session); -int perf_session__process_events_mt (struct perf_session *session,void *arg); +int perf_session__process_events_mt (struct perf_session *session, +int nr_thread,void *arg);int perf_session__queue_event (struct perf_session *s,union perf_event *event,struct perf_sample *sample,u64 file_offset);
Signature · 1 line
2.4.0
Namhyung Kim
maintainerPATCH 39/40 perf data: Implement 'index' subcommand
In reply to Namhyung KimThe index command first splits a given data file into intermediate data files and merges them into a final data file with an index table so that it can processed using multi threads. The HEADER_DATA_INDEX feature bit is added to distinguish data file that has an index table.
--- tools/perf/Documentation/perf-data.txt | 25 ++- tools/perf/builtin-data.c | 351 ++++++++++++++++++++++++++++++++- 2 files changed, 372 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-data.txt +24 -1
@@ -22,6 +22,11 @@ COMMANDS like: perf --debug data-convert data convert ... +index:: + Build an index table for data file so that it can be processed + with multiple threads concurrently. + + OPTIONS for 'convert' --------------------- --to-ctf::
@@ -34,7 +39,25 @@ OPTIONS for 'convert' --verbose:: Be more verbose (show counter open errors, etc). +OPTIONS for 'index' +------------------- +-i:: +--input:: + Specify input perf data file path. + +-o:: +--output:: + Specify output perf data directory path. + +-v:: +--verbose:: + Be more verbose (show counter open errors, etc). + +-f:: +--force:: + Don't complain, do it. + SEE ALSO -------- -linkperf:perf[1] +linkperf:perf[1], linkperf:perf-report[1] [1] Common Trace Format - http://www.efficios.com/ctf
tools/perf/builtin-data.c +348 -3
376 lines not on this page · raw message
Signature · 1 line
2.4.0
Namhyung Kim
maintainerPATCH 40/40 perf tools: Disable thread refcount due to bug
In reply to Namhyung KimThis makes thread mg sharing test failed due to not decrement thread->refcnt on thread__put().
--- tools/perf/util/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread.c +1 -1
@@ -163,7 +163,7 @@ struct thread *thread__get(struct thread *thread)void thread__put (struct thread *thread) { -if (thread &&atomic_dec_and_test (&thread->refcnt)) { +if (thread &&atomic_dec_and_test (&thread->refcnt) &&0 ) {if (!RB_EMPTY_NODE (&thread->rb_node)) {struct machine *machine = thread->mg->machine;
Signature · 1 line
2.4.0
Arnaldo Carvalho de Melo
maintainerRe: [PATCH Not-for-merge 40/40] perf tools: Disable thread refcount due to bug
Em Mon, May 18, 2015 at 09:30:55AM +0900, Namhyung Kim escreveu:
Quoted 2 lines
This makes thread mg sharing test failed due to not decrement
thread->refcntonthread__put().
I fixed this one already:
No?
- Arnaldo
Quoted 20 lines
Not-signed-off-by Namhyung Kim <[email protected]>--- tools/perf/util/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/thread.c +1
-1@@ -163,7 +163,7 @@ struct thread *thread__get(struct thread *thread)void thread__put (struct thread *thread) { -if (thread &&atomic_dec_and_test (&thread->refcnt)) { +if (thread &&atomic_dec_and_test (&thread->refcnt) &&0 ) {if (!RB_EMPTY_NODE (&thread->rb_node)) {struct machine *machine = thread->mg->machine;Signature · 1 line
2.4.0
Namhyung Kim
maintainerRe: [PATCH Not-for-merge 40/40] perf tools: Disable thread refcount due to bug
Quoted 9 lines · Arnaldo Carvalho de Melo
Em Mon, May 18, 2015 at 09:30:55AM +0900, Namhyung Kim escreveu:
Quoted 2 lines
This makes thread mg sharing test failed due to not decrement
thread->refcntonthread__put().I fixed this one already:
No?
I meant that I added this patch not to segfault caused by the thread refcount, but as a side-effect it makes thread_mg_sharing test failed due to non-decremented refcount.
As of 70923bd26c73 ("perf tools: Make flex/bison calls honour V=1") I can reproduce the segfault.
Thanks,
Namhyung
Quoted 21 lines
Quoted 21 lines
Not-signed-off-by Namhyung Kim <[email protected]>--- tools/perf/util/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/thread.c +1
-1@@ -163,7 +163,7 @@ struct thread *thread__get(struct thread *thread)void thread__put (struct thread *thread) { -if (thread &&atomic_dec_and_test (&thread->refcnt)) { +if (thread &&atomic_dec_and_test (&thread->refcnt) &&0 ) {if (!RB_EMPTY_NODE (&thread->rb_node)) {struct machine *machine = thread->mg->machine;Signature · 1 line
2.4.0
Arnaldo Carvalho de Melo
maintainerRe: [PATCH Not-for-merge 40/40] perf tools: Disable thread refcount due to bug
Em Mon, May 18, 2015 at 09:21:31PM +0900, Namhyung Kim escreveu:
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 7 lines
Em Mon, May 18, 2015 at 09:30:55AM +0900, Namhyung Kim escreveu:
Quoted 2 lines
This makes thread mg sharing test failed due to not decrement
thread->refcntonthread__put().I fixed this one already:
Quoted 8 lines
Quoted 1 line
No?
I meant that I added this patch not to segfault caused by the thread refcount, but as a side-effect it makes
thread_mg_sharingtest failed due to non-decremented refcount.As of
70923bd26c73("perf tools: Make flex/bison calls honour V=1") I can reproduce the segfault.
Ok, I'll investigate that report, looks like one more case where longstanding bugs are exposed by work on multithreading.
- Arnaldo