linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
@ 2015-11-18 19:01 William Cohen
  2015-11-18 19:08 ` David Ahern
  2015-11-19 15:52 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: William Cohen @ 2015-11-18 19:01 UTC (permalink / raw)
  To: linux-perf-users

Hi,

I was experimenting with the sched:sched_switch tracepoint to look at
the time that a process spend off the processor.  As a really simple
experiment record data with:

$ sudo perf record -e sched:sched_switch -- du

Then examine the data with:

$ sudo perf script

The output only shows the sched:sched_switch when the process is moved
off the processor.  However, there is no data showing when the process is
scheduled back onto the processor:

              du 20960 [007] 339893.429394: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.429411: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.429544: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.429556: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.429561: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.429567: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
              du 20960 [007] 339893.430150: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]

Would it be possible to make perf's process filtering more inclusive so
that output also includes sched:sched_switch tracepoints for pid that
are also being scheduled onto the processor?  The alternative of
recording all sched:sched_switch events system-wide and filtering out
all the unwanted pid's is undesirable.

-Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
  2015-11-18 19:01 RFE: More inclusive pid filtering of sched:sched_switch tracepoint events William Cohen
@ 2015-11-18 19:08 ` David Ahern
  2015-11-18 19:16   ` William Cohen
  2015-11-19 15:52 ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 6+ messages in thread
From: David Ahern @ 2015-11-18 19:08 UTC (permalink / raw)
  To: William Cohen, linux-perf-users, Adrian Hunter,
	Arnaldo Carvalho de Melo

On 11/18/15 12:01 PM, William Cohen wrote:
> Hi,
>
> I was experimenting with the sched:sched_switch tracepoint to look at
> the time that a process spend off the processor.  As a really simple
> experiment record data with:
>
> $ sudo perf record -e sched:sched_switch -- du
>
> Then examine the data with:
>
> $ sudo perf script
>
> The output only shows the sched:sched_switch when the process is moved
> off the processor.  However, there is no data showing when the process is
> scheduled back onto the processor:
>
>                du 20960 [007] 339893.429394: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.429411: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.429544: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.429556: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.429561: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.429567: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>                du 20960 [007] 339893.430150: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>
> Would it be possible to make perf's process filtering more inclusive so
> that output also includes sched:sched_switch tracepoints for pid that
> are also being scheduled onto the processor?  The alternative of
> recording all sched:sched_switch events system-wide and filtering out
> all the unwanted pid's is undesirable.

Known pain point. I thought Adrian had new sched tracepoints added to 
handle it, but I lost track of whether it was accepted.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
  2015-11-18 19:08 ` David Ahern
@ 2015-11-18 19:16   ` William Cohen
  2015-11-18 19:18     ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: William Cohen @ 2015-11-18 19:16 UTC (permalink / raw)
  To: David Ahern, linux-perf-users, Adrian Hunter,
	Arnaldo Carvalho de Melo

On 11/18/2015 02:08 PM, David Ahern wrote:
> On 11/18/15 12:01 PM, William Cohen wrote:
>> Hi,
>>
>> I was experimenting with the sched:sched_switch tracepoint to look at
>> the time that a process spend off the processor.  As a really simple
>> experiment record data with:
>>
>> $ sudo perf record -e sched:sched_switch -- du
>>
>> Then examine the data with:
>>
>> $ sudo perf script
>>
>> The output only shows the sched:sched_switch when the process is moved
>> off the processor.  However, there is no data showing when the process is
>> scheduled back onto the processor:
>>
>>                du 20960 [007] 339893.429394: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.429411: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.429544: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.429556: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.429561: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.429567: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>                du 20960 [007] 339893.430150: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>>
>> Would it be possible to make perf's process filtering more inclusive so
>> that output also includes sched:sched_switch tracepoints for pid that
>> are also being scheduled onto the processor?  The alternative of
>> recording all sched:sched_switch events system-wide and filtering out
>> all the unwanted pid's is undesirable.
> 
> Known pain point. I thought Adrian had new sched tracepoints added to handle it, but I lost track of whether it was accepted.
> 

Okay,

As a workaround can use the filtering to cut down some of data being recorded with:

export PID=<process_of_interest>
sudo perf record -a -e sched:sched_switch --filter "next_pid == $PID || prev_pid == $PID" --

Is the following the correct thread discussing those new sched tracepoints?

https://lkml.org/lkml/2015/6/9/513

-Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
  2015-11-18 19:16   ` William Cohen
@ 2015-11-18 19:18     ` David Ahern
  2015-11-18 20:18       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2015-11-18 19:18 UTC (permalink / raw)
  To: William Cohen, linux-perf-users, Adrian Hunter,
	Arnaldo Carvalho de Melo

On 11/18/15 12:16 PM, William Cohen wrote:
> Okay,
>
> As a workaround can use the filtering to cut down some of data being recorded with:
>
> export PID=<process_of_interest>
> sudo perf record -a -e sched:sched_switch --filter "next_pid == $PID || prev_pid == $PID" --
>
> Is the following the correct thread discussing those new sched tracepoints?
>
> https://lkml.org/lkml/2015/6/9/513
>
> -Will

I believe so

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
  2015-11-18 19:18     ` David Ahern
@ 2015-11-18 20:18       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-18 20:18 UTC (permalink / raw)
  To: David Ahern; +Cc: William Cohen, linux-perf-users, Adrian Hunter

Em Wed, Nov 18, 2015 at 12:18:20PM -0700, David Ahern escreveu:
> On 11/18/15 12:16 PM, William Cohen wrote:
> >As a workaround can use the filtering to cut down some of data being recorded with:

> >export PID=<process_of_interest>
> >sudo perf record -a -e sched:sched_switch --filter "next_pid == $PID || prev_pid == $PID" --

> >Is the following the correct thread discussing those new sched tracepoints?

> >https://lkml.org/lkml/2015/6/9/513

> I believe so

Right, take a look at:

commit ae938802443732e77d01f8d5b52b900b9327ff30
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Tue Oct 6 17:46:46 2015 -0300

    perf python: Support the PERF_RECORD_SWITCH event
    
    To test it check tools/perf/python/twatch.py, after following the
    instructions there to enable context_switch, output looks like:
    
      [root@zoo linux]# tools/perf/python/twatch.py
      cpu: 1, pid: 31463, tid: 31463 { type: context_switch, next_prev_pid: 31463, next_prev_tid: 31463, switch_out: 0 }
      cpu: 2, pid: 31463, tid: 31496 { type: context_switch, next_prev_pid: 31463, next_prev_tid: 31496, switch_out: 0 

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFE: More inclusive pid filtering of sched:sched_switch tracepoint events
  2015-11-18 19:01 RFE: More inclusive pid filtering of sched:sched_switch tracepoint events William Cohen
  2015-11-18 19:08 ` David Ahern
@ 2015-11-19 15:52 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-19 15:52 UTC (permalink / raw)
  To: William Cohen; +Cc: linux-perf-users

Em Wed, Nov 18, 2015 at 02:01:13PM -0500, William Cohen escreveu:
> I was experimenting with the sched:sched_switch tracepoint to look at
> the time that a process spend off the processor.  As a really simple
> experiment record data with:
> 
> $ sudo perf record -e sched:sched_switch -- du
> 
> Then examine the data with:
> 
> $ sudo perf script
> 
> The output only shows the sched:sched_switch when the process is moved
> off the processor.  However, there is no data showing when the process is
> scheduled back onto the processor:
> 
>               du 20960 [007] 339893.429394: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.429411: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.429544: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.429556: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.429561: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.429567: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
>               du 20960 [007] 339893.430150: sched:sched_switch: du:20960 [120] R ==> kworker/7:0:16805 [120]
> 
> Would it be possible to make perf's process filtering more inclusive so
> that output also includes sched:sched_switch tracepoints for pid that
> are also being scheduled onto the processor?  The alternative of
> recording all sched:sched_switch events system-wide and filtering out
> all the unwanted pid's is undesirable.

So, on a recent kernel, no need to run with sudo:

[acme@zoo linux]$ perf record --switch-events -e dummy -- du > /dev/null
^[[A[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data ]
[acme@zoo linux]$ perf script --show-switch-events
              du  4026 103867.891889: PERF_RECORD_SWITCH OUT
              du  4026 103867.891980: PERF_RECORD_SWITCH IN 
              du  4026 103867.984411: PERF_RECORD_SWITCH OUT
              du  4026 103867.984424: PERF_RECORD_SWITCH IN 
[acme@zoo linux]$

[acme@zoo linux]$ perf report -D | grep PERF_RECORD_SWITCH
103867891889845 0x4260 [0x18]: PERF_RECORD_SWITCH OUT
103867891980760 0x4278 [0x18]: PERF_RECORD_SWITCH IN 
103867984411995 0x4290 [0x18]: PERF_RECORD_SWITCH OUT
103867984424725 0x42a8 [0x18]: PERF_RECORD_SWITCH IN 
[acme@zoo linux]$ 

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-19 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 19:01 RFE: More inclusive pid filtering of sched:sched_switch tracepoint events William Cohen
2015-11-18 19:08 ` David Ahern
2015-11-18 19:16   ` William Cohen
2015-11-18 19:18     ` David Ahern
2015-11-18 20:18       ` Arnaldo Carvalho de Melo
2015-11-19 15:52 ` Arnaldo Carvalho de Melo

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).