Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-24 Thread Arnaldo Carvalho de Melo
Em Fri, Aug 24, 2012 at 05:32:21PM +0400, Andrey Wagin escreveu:
> Hello Arnaldo,
> 
> What do you think about this series?
> 
> It has been fixed according with your comments to the previous
> patches. Are you going to take it?

I've put them in a perf/sleep branch in my tree, waiting on Frédéric
that is reviewing it.

- Arnaldo
 
> 2012/8/7 Andrew Vagin :
> > This functionality helps to analize where a task sleeps or waits locks.
> > This feature can help to investigate a scalability problems.
> >
> > The main idea is that we can combine sched_switch and sched_stat_sleep 
> > events.
> > sched_switch contains a callchain, when a task starts sleeping.
> > sched_stat_sleep contains a time period for which a task slept.
> >
> > This series teaches "perf inject" to combine this events.
> >
> > All kernel related patches were committed committed in 3.6-rc1.
> >
> > Here is an example of a report:
> > $ cat ~/foo.c
> > 
> >   for (i = 0; i <  10; i++) {
> >   ts1.tv_sec = 0;
> >   ts1.tv_nsec = 1000;
> >   nanosleep(&ts1, NULL);
> >
> >   tv1.tv_sec = 0;
> >   tv1.tv_usec = 4;
> >   select(0, NULL, NULL, NULL,&tv1);
> >   }
> > ...
> >
> > $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
> > -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 
> > samples) ]
> > $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
> > $ ./perf report -i ~/perf.data
> > # Samples: 40  of event 'sched:sched_switch'
> > # Event count (approx.): 1005527702
> > #
> > # Overhead  Command  Shared Object  Symbol
> > #   ...  .  ..
> > #
> >100.00%  foo  [kernel.kallsyms]  [k] __schedule
> > |
> > --- __schedule
> > schedule
> >|
> >|--79.81%-- schedule_hrtimeout_range_clock
> >|  schedule_hrtimeout_range
> >|  poll_schedule_timeout
> >|  do_select
> >|  core_sys_select
> >|  sys_select
> >|  system_call_fastpath
> >|  __select
> >|  __libc_start_main
> >|
> > --20.19%-- do_nanosleep
> >   hrtimer_nanosleep
> >   sys_nanosleep
> >   system_call_fastpath
> >   __GI___libc_nanosleep
> >   __libc_start_main
> >
> > Andrew Vagin (3):
> >   perf: teach "perf inject" to work with files
> >   perf: teach perf inject to merge sched_stat_* and sched_switch events
> >   perf: mark a dso if it's used
> >
> >  tools/perf/builtin-inject.c |  139 
> > ---
> >  tools/perf/util/build-id.c  |2 +-
> >  tools/perf/util/build-id.h  |5 ++
> >  3 files changed, 137 insertions(+), 9 deletions(-)
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-24 Thread Andrey Wagin
Hello Arnaldo,

What do you think about this series?

It has been fixed according with your comments to the previous
patches. Are you going to take it?

2012/8/7 Andrew Vagin :
> This functionality helps to analize where a task sleeps or waits locks.
> This feature can help to investigate a scalability problems.
>
> The main idea is that we can combine sched_switch and sched_stat_sleep events.
> sched_switch contains a callchain, when a task starts sleeping.
> sched_stat_sleep contains a time period for which a task slept.
>
> This series teaches "perf inject" to combine this events.
>
> All kernel related patches were committed committed in 3.6-rc1.
>
> Here is an example of a report:
> $ cat ~/foo.c
> 
>   for (i = 0; i <  10; i++) {
>   ts1.tv_sec = 0;
>   ts1.tv_nsec = 1000;
>   nanosleep(&ts1, NULL);
>
>   tv1.tv_sec = 0;
>   tv1.tv_usec = 4;
>   select(0, NULL, NULL, NULL,&tv1);
>   }
> ...
>
> $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
> -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 samples) 
> ]
> $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
> $ ./perf report -i ~/perf.data
> # Samples: 40  of event 'sched:sched_switch'
> # Event count (approx.): 1005527702
> #
> # Overhead  Command  Shared Object  Symbol
> #   ...  .  ..
> #
>100.00%  foo  [kernel.kallsyms]  [k] __schedule
> |
> --- __schedule
> schedule
>|
>|--79.81%-- schedule_hrtimeout_range_clock
>|  schedule_hrtimeout_range
>|  poll_schedule_timeout
>|  do_select
>|  core_sys_select
>|  sys_select
>|  system_call_fastpath
>|  __select
>|  __libc_start_main
>|
> --20.19%-- do_nanosleep
>   hrtimer_nanosleep
>   sys_nanosleep
>   system_call_fastpath
>   __GI___libc_nanosleep
>   __libc_start_main
>
> Andrew Vagin (3):
>   perf: teach "perf inject" to work with files
>   perf: teach perf inject to merge sched_stat_* and sched_switch events
>   perf: mark a dso if it's used
>
>  tools/perf/builtin-inject.c |  139 
> ---
>  tools/perf/util/build-id.c  |2 +-
>  tools/perf/util/build-id.h  |5 ++
>  3 files changed, 137 insertions(+), 9 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-09 Thread Andrey Wagin
2012/8/9 Namhyung Kim :
> The usage like this is too specific and hard to use IMHO. How about
> putting it somehow into perf sched or new command?
>
> /me don't have an idea though. :-)
>

 I'm going to add a script, so the usage will look like this:
 $ perf script record sched-stat -e sched:sched_stat_sleep 
 This command will collect sched_stat_* and proper sched_switch events
>>>
>>> ???  That means '-e sched:sched_stat_sleep' part can be removed from
>>> command line, no?
>>
>> No. My method works for all kind of sched_stat_* events, so you need
>> to specify an event type which should be traced.
>
> Ok, so can it be like 'perf script record sched-stat -t sleep '?

Yes, it can. Thanks for your feedback. I'm going to write the script,
when this series will be committed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-08 Thread Namhyung Kim
On Wed, 8 Aug 2012 11:24:34 +0400, Andrey Wagin wrote:
> 2012/8/8 Namhyung Kim :
>> On Wed, 8 Aug 2012 09:02:18 +0400, Andrey Wagin wrote:
>>> 2012/8/8 Namhyung Kim :
>
> $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
>   -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
>>>
>>> Actually this string is not completed, because sched:sched_switch
>>> should be filtered by state.
>>>
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 
> samples) ]
> $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
> $ ./perf report -i ~/perf.data

 The usage like this is too specific and hard to use IMHO. How about
 putting it somehow into perf sched or new command?

 /me don't have an idea though. :-)

>>>
>>> I'm going to add a script, so the usage will look like this:
>>> $ perf script record sched-stat -e sched:sched_stat_sleep 
>>> This command will collect sched_stat_* and proper sched_switch events
>>
>> ???  That means '-e sched:sched_stat_sleep' part can be removed from
>> command line, no?
>
> No. My method works for all kind of sched_stat_* events, so you need
> to specify an event type which should be traced.

Ok, so can it be like 'perf script record sched-stat -t sleep '?

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-08 Thread Andrey Wagin
2012/8/8 Namhyung Kim :
> On Wed, 8 Aug 2012 09:02:18 +0400, Andrey Wagin wrote:
>> 2012/8/8 Namhyung Kim :

 $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
   -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
>>
>> Actually this string is not completed, because sched:sched_switch
>> should be filtered by state.
>>
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 
 samples) ]
 $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
 $ ./perf report -i ~/perf.data
>>>
>>> The usage like this is too specific and hard to use IMHO. How about
>>> putting it somehow into perf sched or new command?
>>>
>>> /me don't have an idea though. :-)
>>>
>>
>> I'm going to add a script, so the usage will look like this:
>> $ perf script record sched-stat -e sched:sched_stat_sleep 
>> This command will collect sched_stat_* and proper sched_switch events
>
> ???  That means '-e sched:sched_stat_sleep' part can be removed from
> command line, no?

No. My method works for all kind of sched_stat_* events, so you need
to specify an event type which should be traced.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-07 Thread Namhyung Kim
On Wed, 8 Aug 2012 09:02:18 +0400, Andrey Wagin wrote:
> 2012/8/8 Namhyung Kim :
>>>
>>> $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
>>>   -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
>
> Actually this string is not completed, because sched:sched_switch
> should be filtered by state.
>
>>> [ perf record: Woken up 1 times to write data ]
>>> [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 
>>> samples) ]
>>> $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
>>> $ ./perf report -i ~/perf.data
>>
>> The usage like this is too specific and hard to use IMHO. How about
>> putting it somehow into perf sched or new command?
>>
>> /me don't have an idea though. :-)
>>
>
> I'm going to add a script, so the usage will look like this:
> $ perf script record sched-stat -e sched:sched_stat_sleep 
> This command will collect sched_stat_* and proper sched_switch events

???  That means '-e sched:sched_stat_sleep' part can be removed from
command line, no?

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-07 Thread Andrey Wagin
2012/8/8 Namhyung Kim :
>>
>> $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
>>   -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo

Actually this string is not completed, because sched:sched_switch
should be filtered by state.

>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 
>> samples) ]
>> $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
>> $ ./perf report -i ~/perf.data
>
> The usage like this is too specific and hard to use IMHO. How about
> putting it somehow into perf sched or new command?
>
> /me don't have an idea though. :-)
>

I'm going to add a script, so the usage will look like this:
$ perf script record sched-stat -e sched:sched_stat_sleep 
This command will collect sched_stat_* and proper sched_switch events
$ perf script report sched-stat
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] perf: Teach perf tool to profile sleep times (v2)

2012-08-07 Thread Namhyung Kim
Hi, Andrew

On Tue,  7 Aug 2012 16:56:01 +0400, Andrew Vagin wrote:
> This functionality helps to analize where a task sleeps or waits locks.
> This feature can help to investigate a scalability problems.
>
Looks like a nice feature.


> The main idea is that we can combine sched_switch and sched_stat_sleep events.
> sched_switch contains a callchain, when a task starts sleeping.
> sched_stat_sleep contains a time period for which a task slept.
>
> This series teaches "perf inject" to combine this events.
>
> All kernel related patches were committed committed in 3.6-rc1.
>
> Here is an example of a report:
> $ cat ~/foo.c
> 
>   for (i = 0; i <  10; i++) {
>   ts1.tv_sec = 0;
>   ts1.tv_nsec = 1000;
>   nanosleep(&ts1, NULL);
>
>   tv1.tv_sec = 0;
>   tv1.tv_usec = 4;
>   select(0, NULL, NULL, NULL,&tv1);
>   }
> ...
>
> $ ./perf record -e sched:sched_stat_sleep -e sched:sched_switch \
>   -e sched:sched_process_exit -gP -o ~/perf.data.raw ~/foo
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.015 MB /root/perf.data.raw (~661 samples) 
> ]
> $ ./perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
> $ ./perf report -i ~/perf.data

The usage like this is too specific and hard to use IMHO. How about
putting it somehow into perf sched or new command?

/me don't have an idea though. :-)


> # Samples: 40  of event 'sched:sched_switch'
> # Event count (approx.): 1005527702
> #
> # Overhead  Command  Shared Object  Symbol
> #   ...  .  ..
> #
>100.00%  foo  [kernel.kallsyms]  [k] __schedule
> |
> --- __schedule
> schedule
>|  
>|--79.81%-- schedule_hrtimeout_range_clock
>|  schedule_hrtimeout_range
>|  poll_schedule_timeout
>|  do_select
>|  core_sys_select
>|  sys_select
>|  system_call_fastpath
>|  __select
>|  __libc_start_main
>|  
> --20.19%-- do_nanosleep
>   hrtimer_nanosleep
>   sys_nanosleep
>   system_call_fastpath
>   __GI___libc_nanosleep
>   __libc_start_main
>
> Andrew Vagin (3):
>   perf: teach "perf inject" to work with files
>   perf: teach perf inject to merge sched_stat_* and sched_switch events
>   perf: mark a dso if it's used
>

Seems to be outdated.

Thanks,
Namhyung


>  tools/perf/builtin-inject.c |  139 
> ---
>  tools/perf/util/build-id.c  |2 +-
>  tools/perf/util/build-id.h  |5 ++
>  3 files changed, 137 insertions(+), 9 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/