Re: [PATCH 6/7] perf record: Add switch-output size option argument
From: Arnaldo Carvalho de Melo
Date: Tue Jan 03 2017 - 09:53:12 EST
Em Tue, Jan 03, 2017 at 03:32:32PM +0100, Jiri Olsa escreveu:
> On Tue, Jan 03, 2017 at 11:20:27AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Jan 03, 2017 at 09:19:59AM +0100, Jiri Olsa escreveu:
> > > It's now possible to specify the threshold size for
> > > perf.data like:
> > >
> > > $ perf record --switch-output=2G ...
> > >
> > > Once it's reached, the current data are dumped in to the
> > > perf.data.<timestamp> file and session does on.
> >
> > s/does/goes/g
> >
> > But:
> >
> > [root@jouet ~]# perf record -F9000 -a --switch-output=1K sleep 5
> > [ perf record: dump data: Woken up 0 times ]
> > [ perf record: Dump perf.data.2017010311185502 ]
> > [ perf record: dump data: Woken up 1 times ]
> > [ perf record: Dump perf.data.2017010311190003 ]
> > [ perf record: Woken up 0 times to write data ]
> > [ perf record: Dump perf.data.2017010311190020 ]
> > [ perf record: Captured and wrote 2.240 MB perf.data.<timestamp> ]
> > [root@jouet ~]# ls -larth perf.data.*
> > -rw-------. 1 root root 2.3M Jan 3 11:18 perf.data.2017010311181984
> > -rw-------. 1 root root 2.3M Jan 3 11:18 perf.data.2017010311182002
> > -rw-------. 1 root root 2.3M Jan 3 11:18 perf.data.2017010311185502
> > -rw-------. 1 root root 2.3M Jan 3 11:19 perf.data.2017010311190003
> > -rw-------. 1 root root 2.3M Jan 3 11:19 perf.data.2017010311190020
> > [root@jouet ~]#
> >
> > What is that I am missing?
>
> hum, I think the size you configured is smaller then the size
> of the shared kernel buffer and perf gets woken up by default
> only when we cross some level of data that's in.. would need
> to check
>
> also I dont think 1K won't fit even the perf.data
> header.. are you trying to break it? ;-)
I'm trying to follow the documentation ;-) Your explanation sounds
reasonable, could you get this code to check those constraints and emit
a sensible error message?
- Arnaldo