All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Perf: Question about continuous background data collection
       [not found]   ` <YVv4B4syx36Co/0+@krava>
@ 2021-10-06 21:29     ` Renjith Ponnappan
       [not found]     ` <CAPNhM=YRUMw2VuHg3e5RH33UTCDG0guiqvCrfwb_kW_PkLvipw@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Renjith Ponnappan @ 2021-10-06 21:29 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, jolsa, linux-perf-users

Hello Arnaldo & Jiri,

Thank you for your response.

The perf daemon is the closest implementation for what I was looking
for. Here we run perf in the back-ground, keep overwriting the samples
being collected and use the SIGUSR2 to signal to the perf daemon to
collect the perf data to a file. This fulfills the following
requirements:

1. Run perf in the background to collect data
2. A method to signal perf to collect the samples for the current cycle.

The last part of the requirement which  was:

1. The data-collection in step 2 above, rather than writing the data
to file store it in in-memory datastructure via pointer manipulation.
We can have a list of such samples stored in memory until the next
step. This helps free up the CPU cycles used by perf for writing to
file for applications.
2. A method to signal perf to dump all the collected samples into
separate files. This way the user can collect the stored samples when
the CPU is relatively free.

Let me know whether we have support for storing samples as in-memory samples.

Thanks in advance for your help!

cheers,
Renjith
cheers,
Renjith

On Tue, Oct 5, 2021 at 12:00 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Thu, Sep 30, 2021 at 10:39:21PM -0300, Arnaldo Carvalho de Melo wrote:
> >
> >
> > On September 30, 2021 10:28:28 PM GMT-03:00, Renjith Ponnappan <renjithponnapps@gmail.com> wrote:
> > >Hello Peter/Ingo/Arnaldo,
> > >
> > >First of all, apologies if I bombarded you with an irrelevant question in
> > >your busy day and ignore this if the question is irrelevant.
> > >
> > >I had a question about continuous background data-collection with perf and
> > >hope you are the right person to answer this. If not, it would be great if
> > >you can redirect me to the right person.
> > >
> > >I am trying to build a CPU profiling system (on an embedded ARM Platform
> > >with CPU/memory constraints) which has CPU Samples already collected when
> > >an application CPU starvation scenario occurs based on perf. The
> > >implementation I am trying to use is:
> > >
> > >   1. Run perf in the background collecting samples for the entire system
> >
> >
> > This is already in perf:
> >
> > https://www.spinics.net/lists/linux-perf-users/msg11455.html
> >
> >
> > Reply adding linux-perf-users@vger.kernel.org.
> >
> > - Arnaldo
> >
> >
> > >   with a sleep period of 60 seconds
> > >   2. When an application CPU starvation scenario occurs (detected and
> > >   raised by applications) notify the collection process to store the last
> > >   perf collection as data to be analyzed offline.
> > >
> > >Have you come across such a scenario and any recommendations on this?
> > >
> > >The following are the two implementations I have on the above:
> > >
> > >   1. An external process which instructs perf to record the 60 seconds by
> > >   providing unique filenames each time. This approach was taking around 40%
> > >   CPU of a CPU core, everytime the perf record was getting written (once for
> > >   each 60 seconds cycle). This isn't okay as it could cause aggravation of
> > >   the CPU starvation situation.
> > >   2. I tinkered with Perf Code to add the logic of looping and writing the
> > >   file incase of an event only. This did reduce the CPU to only the case when
> > >   an event was detected.
>
> hi,
> and there's also perf daemon to run perf sessions on background:
> https://lore.kernel.org/lkml/20210130234856.271282-19-jolsa@kernel.org/
>
> jirka
>
> > >
> > >Would like to hear your opinion on whether approach 2 is the right way here
> > >and any suggestion/guidance you may have.
> > >
> > >Thanks in advance for this help!
> > >
> > >*cheers,*
> > >*Renjith*
> >
>

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

* Re: Perf: Question about continuous background data collection
       [not found]     ` <CAPNhM=YRUMw2VuHg3e5RH33UTCDG0guiqvCrfwb_kW_PkLvipw@mail.gmail.com>
@ 2021-10-07  9:17       ` Arnaldo Carvalho de Melo
  2021-10-07 16:52         ` Jiri Olsa
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-10-07  9:17 UTC (permalink / raw)
  To: Renjith Ponnappan, Jiri Olsa
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, jolsa,
	linux-perf-users



On October 6, 2021 6:25:57 PM GMT-03:00, Renjith Ponnappan <renjithponnapps@gmail.com> wrote:
>Hello Arnaldo & Jiri,
>
>Thank you for your response.
>
>The perf daemon is the closest implementation for what I was looking for.
>Here we run perf in the back-ground, keep overwriting the samples being
>collected and use the SIGUSR2 to signal to the perf daemon to collect the
>perf data to a file. This fulfills the following requirements:
>
>   1. Run perf in the background to collect data
>   2. A method to signal perf to collect the samples for the current cycle.
>
>The last part of the requirement which  was:
>
>   1. The data-collection in step 2 above, rather than writing the data to
>   file store it in in-memory datastructure via pointer manipulation. We can
>   have a list of such samples stored in memory until the next step. This
>   helps free up the CPU cycles used by perf for writing to file for
>   applications.
>   2. A method to signal perf to dump all the collected samples into
>   separate files. This way the user can collect the stored samples when the
>   CPU is relatively free.
>
>Let me know whether we have support for storing samples as in-memory
>samples.

Have you looked at the URL I pointed to you?

https://www.spinics.net/lists/linux-perf-users/msg11455.html

More specifically, read about 'perf record --overwrite"

- Arnaldo
>
>Thanks in advance for your help!
>
>*cheers,*
>*Renjith*
>
>
>On Tue, Oct 5, 2021 at 12:00 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
>> On Thu, Sep 30, 2021 at 10:39:21PM -0300, Arnaldo Carvalho de Melo wrote:
>> >
>> >
>> > On September 30, 2021 10:28:28 PM GMT-03:00, Renjith Ponnappan <
>> renjithponnapps@gmail.com> wrote:
>> > >Hello Peter/Ingo/Arnaldo,
>> > >
>> > >First of all, apologies if I bombarded you with an irrelevant question
>> in
>> > >your busy day and ignore this if the question is irrelevant.
>> > >
>> > >I had a question about continuous background data-collection with perf
>> and
>> > >hope you are the right person to answer this. If not, it would be great
>> if
>> > >you can redirect me to the right person.
>> > >
>> > >I am trying to build a CPU profiling system (on an embedded ARM Platform
>> > >with CPU/memory constraints) which has CPU Samples already collected
>> when
>> > >an application CPU starvation scenario occurs based on perf. The
>> > >implementation I am trying to use is:
>> > >
>> > >   1. Run perf in the background collecting samples for the entire
>> system
>> >
>> >
>> > This is already in perf:
>> >
>> > https://www.spinics.net/lists/linux-perf-users/msg11455.html
>> >
>> >
>> > Reply adding linux-perf-users@vger.kernel.org.
>> >
>> > - Arnaldo
>> >
>> >
>> > >   with a sleep period of 60 seconds
>> > >   2. When an application CPU starvation scenario occurs (detected and
>> > >   raised by applications) notify the collection process to store the
>> last
>> > >   perf collection as data to be analyzed offline.
>> > >
>> > >Have you come across such a scenario and any recommendations on this?
>> > >
>> > >The following are the two implementations I have on the above:
>> > >
>> > >   1. An external process which instructs perf to record the 60 seconds
>> by
>> > >   providing unique filenames each time. This approach was taking
>> around 40%
>> > >   CPU of a CPU core, everytime the perf record was getting written
>> (once for
>> > >   each 60 seconds cycle). This isn't okay as it could cause
>> aggravation of
>> > >   the CPU starvation situation.
>> > >   2. I tinkered with Perf Code to add the logic of looping and writing
>> the
>> > >   file incase of an event only. This did reduce the CPU to only the
>> case when
>> > >   an event was detected.
>>
>> hi,
>> and there's also perf daemon to run perf sessions on background:
>> https://lore.kernel.org/lkml/20210130234856.271282-19-jolsa@kernel.org/
>>
>> jirka
>>
>> > >
>> > >Would like to hear your opinion on whether approach 2 is the right way
>> here
>> > >and any suggestion/guidance you may have.
>> > >
>> > >Thanks in advance for this help!
>> > >
>> > >*cheers,*
>> > >*Renjith*
>> >
>>
>>

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

* Re: Perf: Question about continuous background data collection
  2021-10-07  9:17       ` Arnaldo Carvalho de Melo
@ 2021-10-07 16:52         ` Jiri Olsa
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2021-10-07 16:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Renjith Ponnappan, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, jolsa, linux-perf-users

On Thu, Oct 07, 2021 at 06:17:29AM -0300, Arnaldo Carvalho de Melo wrote:
> 
> 
> On October 6, 2021 6:25:57 PM GMT-03:00, Renjith Ponnappan <renjithponnapps@gmail.com> wrote:
> >Hello Arnaldo & Jiri,
> >
> >Thank you for your response.
> >
> >The perf daemon is the closest implementation for what I was looking for.
> >Here we run perf in the back-ground, keep overwriting the samples being
> >collected and use the SIGUSR2 to signal to the perf daemon to collect the
> >perf data to a file. This fulfills the following requirements:
> >
> >   1. Run perf in the background to collect data
> >   2. A method to signal perf to collect the samples for the current cycle.
> >
> >The last part of the requirement which  was:
> >
> >   1. The data-collection in step 2 above, rather than writing the data to
> >   file store it in in-memory datastructure via pointer manipulation. We can
> >   have a list of such samples stored in memory until the next step. This
> >   helps free up the CPU cycles used by perf for writing to file for
> >   applications.
> >   2. A method to signal perf to dump all the collected samples into
> >   separate files. This way the user can collect the stored samples when the
> >   CPU is relatively free.
> >
> >Let me know whether we have support for storing samples as in-memory
> >samples.
> 
> Have you looked at the URL I pointed to you?
> 
> https://www.spinics.net/lists/linux-perf-users/msg11455.html
> 
> More specifically, read about 'perf record --overwrite"

also there's example with flight recorder in perf-daemon man page:
https://man7.org/linux/man-pages/man1/perf-daemon.1.html

jirka

> 
> - Arnaldo
> >
> >Thanks in advance for your help!
> >
> >*cheers,*
> >*Renjith*
> >
> >
> >On Tue, Oct 5, 2021 at 12:00 AM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> >> On Thu, Sep 30, 2021 at 10:39:21PM -0300, Arnaldo Carvalho de Melo wrote:
> >> >
> >> >
> >> > On September 30, 2021 10:28:28 PM GMT-03:00, Renjith Ponnappan <
> >> renjithponnapps@gmail.com> wrote:
> >> > >Hello Peter/Ingo/Arnaldo,
> >> > >
> >> > >First of all, apologies if I bombarded you with an irrelevant question
> >> in
> >> > >your busy day and ignore this if the question is irrelevant.
> >> > >
> >> > >I had a question about continuous background data-collection with perf
> >> and
> >> > >hope you are the right person to answer this. If not, it would be great
> >> if
> >> > >you can redirect me to the right person.
> >> > >
> >> > >I am trying to build a CPU profiling system (on an embedded ARM Platform
> >> > >with CPU/memory constraints) which has CPU Samples already collected
> >> when
> >> > >an application CPU starvation scenario occurs based on perf. The
> >> > >implementation I am trying to use is:
> >> > >
> >> > >   1. Run perf in the background collecting samples for the entire
> >> system
> >> >
> >> >
> >> > This is already in perf:
> >> >
> >> > https://www.spinics.net/lists/linux-perf-users/msg11455.html
> >> >
> >> >
> >> > Reply adding linux-perf-users@vger.kernel.org.
> >> >
> >> > - Arnaldo
> >> >
> >> >
> >> > >   with a sleep period of 60 seconds
> >> > >   2. When an application CPU starvation scenario occurs (detected and
> >> > >   raised by applications) notify the collection process to store the
> >> last
> >> > >   perf collection as data to be analyzed offline.
> >> > >
> >> > >Have you come across such a scenario and any recommendations on this?
> >> > >
> >> > >The following are the two implementations I have on the above:
> >> > >
> >> > >   1. An external process which instructs perf to record the 60 seconds
> >> by
> >> > >   providing unique filenames each time. This approach was taking
> >> around 40%
> >> > >   CPU of a CPU core, everytime the perf record was getting written
> >> (once for
> >> > >   each 60 seconds cycle). This isn't okay as it could cause
> >> aggravation of
> >> > >   the CPU starvation situation.
> >> > >   2. I tinkered with Perf Code to add the logic of looping and writing
> >> the
> >> > >   file incase of an event only. This did reduce the CPU to only the
> >> case when
> >> > >   an event was detected.
> >>
> >> hi,
> >> and there's also perf daemon to run perf sessions on background:
> >> https://lore.kernel.org/lkml/20210130234856.271282-19-jolsa@kernel.org/
> >>
> >> jirka
> >>
> >> > >
> >> > >Would like to hear your opinion on whether approach 2 is the right way
> >> here
> >> > >and any suggestion/guidance you may have.
> >> > >
> >> > >Thanks in advance for this help!
> >> > >
> >> > >*cheers,*
> >> > >*Renjith*
> >> >
> >>
> >>
> 


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

end of thread, other threads:[~2021-10-07 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAPNhM=aGeiKAVFDHWuP=GcAbgUz=JgWwtKfoRgmuxoG0gNfciQ@mail.gmail.com>
     [not found] ` <DA2A1D0F-1877-41D1-BC87-C0AE70D3E18C@gmail.com>
     [not found]   ` <YVv4B4syx36Co/0+@krava>
2021-10-06 21:29     ` Perf: Question about continuous background data collection Renjith Ponnappan
     [not found]     ` <CAPNhM=YRUMw2VuHg3e5RH33UTCDG0guiqvCrfwb_kW_PkLvipw@mail.gmail.com>
2021-10-07  9:17       ` Arnaldo Carvalho de Melo
2021-10-07 16:52         ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.