perf stat: Set child_pid after perf_evlist__prepare_workload()
Namhyung Kim
maintainerPATCH 1/1 perf stat: Set child_pid after perf_evlist__prepare_workload()
From: Namhyung Kim <[email protected]>
The commit acf2892270dc ("perf stat: Use perf_evlist__prepare/ start_workload()") converted to use the function but forgot to update child_pid. Fix it.
--- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-stat.c +1 -0
@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)perror ("failed to prepare workload" );return -1 ; } + child_pid = evsel_list->workload.pid; }if (group)
Signature · 1 line
1.7.11.7
Quoted 19 lines · Namhyung Kim
From: Namhyung Kim <[email protected]>
The commit
acf2892270dc("perf stat: Use perf_evlist__prepare/start_workload()") converted to use the function but forgot to updatechild_pid. Fix it.Cc David Ahern <[email protected]>Cc Stephane Eranian <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+)tools/perf/builtin-stat.c +0
-0
tools/perf/builtin-stat.c static int __run_perf_stat(int argc, const char **argv) · line 463
Quoted 7 lines
tools/perf/builtin-stat.c +1
-0@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)perror ("failed to prepare workload" );return -1 ; } + child_pid = evsel_list->workload.pid; }if (group)
Interesting. I can't find a test case where is matters ... perhaps a convenience of waitpid taking -1.
David
Em Mon, Sep 30, 2013 at 07:47:25AM -0600, David Ahern escreveu:
Quoted 25 lines · Namhyung Kim
Quoted 24 lines
From: Namhyung Kim <[email protected]>
The commit
acf2892270dc("perf stat: Use perf_evlist__prepare/start_workload()") converted to use the function but forgot to updatechild_pid. Fix it.Cc David Ahern <[email protected]>Cc Stephane Eranian <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+)tools/perf/builtin-stat.c +1
-0@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)perror ("failed to prepare workload" );return -1 ; } + child_pid = evsel_list->workload.pid; }
Quoted 5 lines
tools/perf/builtin-stat.c static int __run_perf_stat(int argc, const char **argv) · line 463
Quoted 2 lines
tools/perf/builtin-stat.c +0
-0if (group)Interesting. I can't find a test case where is matters ... perhaps a convenience of waitpid taking -1.
Yeah, the interval part initially used the fork return, then after acf2892270dc used the default value of child_pid, -1, which is ok as it waits for any children, but I wonder what would happen in workloads with multiple children.
But for correctness acf2892270dc should have kept the existing semantics, even if using -1 could in the end be ok.
- Arnaldo
Namhyung Kim
maintainerQuoted 32 lines · Arnaldo Carvalho de Melo
Em Mon, Sep 30, 2013 at 07:47:25AM -0600, David Ahern escreveu:
Quoted 25 lines · Namhyung Kim
Quoted 24 lines
From: Namhyung Kim <[email protected]>
The commit
acf2892270dc("perf stat: Use perf_evlist__prepare/start_workload()") converted to use the function but forgot to updatechild_pid. Fix it.Cc David Ahern <[email protected]>Cc Stephane Eranian <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+)tools/perf/builtin-stat.c +1
-0@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)perror ("failed to prepare workload" );return -1 ; } + child_pid = evsel_list->workload.pid; }Quoted 5 lines
tools/perf/builtin-stat.c static int __run_perf_stat(int argc, const char **argv) · line 463
Quoted 2 lines
tools/perf/builtin-stat.c +0
-0if (group)Interesting. I can't find a test case where is matters ... perhaps a convenience of waitpid taking -1.
Quoted 4 lines
Yeah, the interval part initially used the fork return, then after
acf2892270dcused the default value ofchild_pid, -1, which is ok as it waits for any children, but I wonder what would happen in workloads with multiple children.
Hmm.. right. And in fact what I actually concern was when killing child if create_perf_stat_counter() failed.
if (child_pid != -1) kill(child_pid, SIGTERM);
Quoted 3 lines
But for correctness
acf2892270dcshould have kept the existing semantics, even if using -1 could in the end be ok.
Agreed.
Thanks,
Namhyung
tip-bot for Namhyung Kim
merge botperf stat: Set child_pid after perf_evlist__prepare_workload()
Commit-ID: d20a47e70b57a77f4d1b0dba98a668e14c2f9bf9 Gitweb: http://git.kernel.org/tip/d20a47e70b57a77f4d1b0dba98a668e14c2f9bf9 Author: Namhyung Kim <[email protected]> AuthorDate: Mon, 30 Sep 2013 18:01:11 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Oct 2013 15:16:05 -0300
perf stat: Set child_pid after perf_evlist__prepare_workload()
The commit acf2892270dc ("perf stat: Use perf_evlist__prepare/ start_workload()") converted to use the function but forgot to update child_pid. Fix it.
--- tools/perf/builtin-stat.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-stat.c +1 -0
@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)perror ("failed to prepare workload" );return -1 ; } + child_pid = evsel_list->workload.pid; }if (group)