* [PATCH] perf/tools : remove default system_wide in sched record
@ 2017-10-24  7:45 Cheng Jian
  2017-10-24 13:46 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Cheng Jian @ 2017-10-24  7:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin
  Cc: linux-kernel, linux-perf-users, xiexiuqi, huawei.libin,
	cj.chengjian, zhangmengting
When running perf sched record, there is a bug.
It's system_wide when we specify a command line.
$ perf sched record ls
$ perf script
         swapper     0 [001] 1312209.826144:
sched:sched_wakeup: crash:21979 [120] success=1 CPU:001
         swapper     0 [001] 1312209.826148:
sched:sched_switch: swapper/1:0 [120] R ==> crash:21979 [120]
           crash 21979 [001] 1312209.826151:
sched:sched_stat_runtime: comm=crash pid=21979
runtime=8161 [ns] vruntime=1591295759555 [ns]
           crash 21979 [001] 1312209.826185:
sched:sched_switch: crash:21979 [120] S ==> swapper/1:0 [120]
              ls 148873 [169] 1312209.826818:
sched:sched_stat_runtime: comm=ls pid=148873
runtime=999532 [ns] vruntime=8099789362030 [ns]
            perf 148872 [109] 1312209.826818:
sched:sched_stat_runtime: comm=perf pid=148872
runtime=1001606 [ns] vruntime=7794318690006 [ns]
This is because '-a'(system_wide) is set in record_args.
so just remove it.
After :
	  swapper     0 [109] 1313349.767284:
sched:sched_wakeup: comm=perf pid=149865 prio=120 success=1 target_cpu=109
              ls 149865 [133] 1313349.769066: sched:sched_stat_runtime:
comm=ls pid=149865 runtime=1001167 [ns] vruntime=7871277236086 [ns]
              ls 149865 [133] 1313349.770062:
sched:sched_stat_runtime: comm=ls pid=149865
runtime=998985 [ns] vruntime=7871278235071 [ns]
              ls 149865 [133] 1313349.770731:
sched:sched_wakeup: comm=kworker/133:2 pid=137042
prio=120 success=1 target_cpu=133
Signed-off-by: Cheng Jian <cj.chengjian@huawei.com>
Signed-off-by: Zhang MengTing <zhangmengting@huawei.com>
---
 tools/perf/builtin-sched.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 322b4de..47b79fc 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -3248,7 +3248,6 @@ static int __cmd_record(int argc, const char **argv)
 	const char **rec_argv;
 	const char * const record_args[] = {
 		"record",
-		"-a",
 		"-R",
 		"-m", "1024",
 		"-c", "1",
-- 
1.8.3.1
^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] perf/tools : remove default system_wide in sched record
  2017-10-24  7:45 [PATCH] perf/tools : remove default system_wide in sched record Cheng Jian
@ 2017-10-24 13:46 ` Arnaldo Carvalho de Melo
  2017-10-25  2:23   ` Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-10-24 13:46 UTC (permalink / raw)
  To: Cheng Jian
  Cc: peterz, mingo, alexander.shishkin, linux-kernel, linux-perf-users,
	xiexiuqi, huawei.libin, zhangmengting
Em Tue, Oct 24, 2017 at 03:45:34PM +0800, Cheng Jian escreveu:
> When running perf sched record, there is a bug.
> 
> It's system_wide when we specify a command line.
Humm, isn't this because if you trace just a workload you will miss the
sched-in events?
Perhaps with PERF_RECORD_SWITCH we can solve that... I.e. still get the
sched-in events while tracing just one workload, not requiring
system_wide like it is the case now, right?
- Arnaldo
 
> $ perf sched record ls
> $ perf script
>          swapper     0 [001] 1312209.826144:
> sched:sched_wakeup: crash:21979 [120] success=1 CPU:001
>          swapper     0 [001] 1312209.826148:
> sched:sched_switch: swapper/1:0 [120] R ==> crash:21979 [120]
>            crash 21979 [001] 1312209.826151:
> sched:sched_stat_runtime: comm=crash pid=21979
> runtime=8161 [ns] vruntime=1591295759555 [ns]
>            crash 21979 [001] 1312209.826185:
> sched:sched_switch: crash:21979 [120] S ==> swapper/1:0 [120]
>               ls 148873 [169] 1312209.826818:
> sched:sched_stat_runtime: comm=ls pid=148873
> runtime=999532 [ns] vruntime=8099789362030 [ns]
>             perf 148872 [109] 1312209.826818:
> sched:sched_stat_runtime: comm=perf pid=148872
> runtime=1001606 [ns] vruntime=7794318690006 [ns]
> 
> This is because '-a'(system_wide) is set in record_args.
> so just remove it.
> 
> After :
> 	  swapper     0 [109] 1313349.767284:
> sched:sched_wakeup: comm=perf pid=149865 prio=120 success=1 target_cpu=109
>               ls 149865 [133] 1313349.769066: sched:sched_stat_runtime:
> comm=ls pid=149865 runtime=1001167 [ns] vruntime=7871277236086 [ns]
>               ls 149865 [133] 1313349.770062:
> sched:sched_stat_runtime: comm=ls pid=149865
> runtime=998985 [ns] vruntime=7871278235071 [ns]
>               ls 149865 [133] 1313349.770731:
> sched:sched_wakeup: comm=kworker/133:2 pid=137042
> prio=120 success=1 target_cpu=133
> 
> Signed-off-by: Cheng Jian <cj.chengjian@huawei.com>
> Signed-off-by: Zhang MengTing <zhangmengting@huawei.com>
> ---
>  tools/perf/builtin-sched.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 322b4de..47b79fc 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -3248,7 +3248,6 @@ static int __cmd_record(int argc, const char **argv)
>  	const char **rec_argv;
>  	const char * const record_args[] = {
>  		"record",
> -		"-a",
>  		"-R",
>  		"-m", "1024",
>  		"-c", "1",
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH] perf/tools : remove default system_wide in sched record
  2017-10-24 13:46 ` Arnaldo Carvalho de Melo
@ 2017-10-25  2:23   ` Namhyung Kim
  2017-10-25 11:03     ` chengjian (D)
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2017-10-25  2:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Cheng Jian, peterz, mingo, alexander.shishkin, linux-kernel,
	linux-perf-users, xiexiuqi, huawei.libin, zhangmengting,
	kernel-team
On Tue, Oct 24, 2017 at 10:46:44AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Oct 24, 2017 at 03:45:34PM +0800, Cheng Jian escreveu:
> > When running perf sched record, there is a bug.
> > 
> > It's system_wide when we specify a command line.
> 
> Humm, isn't this because if you trace just a workload you will miss the
> sched-in events?
> 
> Perhaps with PERF_RECORD_SWITCH we can solve that... I.e. still get the
> sched-in events while tracing just one workload, not requiring
> system_wide like it is the case now, right?
Yes, but it will lose other task's comm, also (at least) sched-wakeup
(from other task) events are still needed.
Thanks,
Namhyung
> 
> - Arnaldo
>  
> > $ perf sched record ls
> > $ perf script
> >          swapper     0 [001] 1312209.826144:
> > sched:sched_wakeup: crash:21979 [120] success=1 CPU:001
> >          swapper     0 [001] 1312209.826148:
> > sched:sched_switch: swapper/1:0 [120] R ==> crash:21979 [120]
> >            crash 21979 [001] 1312209.826151:
> > sched:sched_stat_runtime: comm=crash pid=21979
> > runtime=8161 [ns] vruntime=1591295759555 [ns]
> >            crash 21979 [001] 1312209.826185:
> > sched:sched_switch: crash:21979 [120] S ==> swapper/1:0 [120]
> >               ls 148873 [169] 1312209.826818:
> > sched:sched_stat_runtime: comm=ls pid=148873
> > runtime=999532 [ns] vruntime=8099789362030 [ns]
> >             perf 148872 [109] 1312209.826818:
> > sched:sched_stat_runtime: comm=perf pid=148872
> > runtime=1001606 [ns] vruntime=7794318690006 [ns]
> > 
> > This is because '-a'(system_wide) is set in record_args.
> > so just remove it.
> > 
> > After :
> > 	  swapper     0 [109] 1313349.767284:
> > sched:sched_wakeup: comm=perf pid=149865 prio=120 success=1 target_cpu=109
> >               ls 149865 [133] 1313349.769066: sched:sched_stat_runtime:
> > comm=ls pid=149865 runtime=1001167 [ns] vruntime=7871277236086 [ns]
> >               ls 149865 [133] 1313349.770062:
> > sched:sched_stat_runtime: comm=ls pid=149865
> > runtime=998985 [ns] vruntime=7871278235071 [ns]
> >               ls 149865 [133] 1313349.770731:
> > sched:sched_wakeup: comm=kworker/133:2 pid=137042
> > prio=120 success=1 target_cpu=133
> > 
> > Signed-off-by: Cheng Jian <cj.chengjian@huawei.com>
> > Signed-off-by: Zhang MengTing <zhangmengting@huawei.com>
> > ---
> >  tools/perf/builtin-sched.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> > index 322b4de..47b79fc 100644
> > --- a/tools/perf/builtin-sched.c
> > +++ b/tools/perf/builtin-sched.c
> > @@ -3248,7 +3248,6 @@ static int __cmd_record(int argc, const char **argv)
> >  	const char **rec_argv;
> >  	const char * const record_args[] = {
> >  		"record",
> > -		"-a",
> >  		"-R",
> >  		"-m", "1024",
> >  		"-c", "1",
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH] perf/tools : remove default system_wide in sched record
  2017-10-25  2:23   ` Namhyung Kim
@ 2017-10-25 11:03     ` chengjian (D)
  0 siblings, 0 replies; 4+ messages in thread
From: chengjian (D) @ 2017-10-25 11:03 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo
  Cc: peterz, mingo, alexander.shishkin, linux-kernel, linux-perf-users,
	xiexiuqi, huawei.libin, zhangmengting, kernel-team
On 2017/10/25 10:23, Namhyung Kim wrote:
> On Tue, Oct 24, 2017 at 10:46:44AM -0300, Arnaldo Carvalho de Melo wrote:
>> Em Tue, Oct 24, 2017 at 03:45:34PM +0800, Cheng Jian escreveu:
>>> When running perf sched record, there is a bug.
>>>
>>> It's system_wide when we specify a command line.
>> Humm, isn't this because if you trace just a workload you will miss the
>> sched-in events?
>>
>> Perhaps with PERF_RECORD_SWITCH we can solve that... I.e. still get the
>> sched-in events while tracing just one workload, not requiring
>> system_wide like it is the case now, right?
> Yes, but it will lose other task's comm, also (at least) sched-wakeup
> (from other task) events are still needed.
>
> Thanks,
> Namhyung
>
I found that if the parameters -p and -a were specified at the same time,
PID/TID(-p/-t) would overwrite SYSTEM_WIDE (-a) in target__validate( ).
If we don't specify a process(-p) or a workload, it will make system 
wide (-a)
as the default target.
     /* Make system wide (-a) the default target. */
     if (!argc && target__none(&rec->opts.target))
         rec->opts.target.system_wide = true;
So don't -a and -p should have the same operation and feedback?
It also lose some events when use -p.
^ permalink raw reply	[flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-25 11:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24  7:45 [PATCH] perf/tools : remove default system_wide in sched record Cheng Jian
2017-10-24 13:46 ` Arnaldo Carvalho de Melo
2017-10-25  2:23   ` Namhyung Kim
2017-10-25 11:03     ` chengjian (D)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).