Re: [PATCH 5/5] trace-cmd: split: Handle splitting files with multiple instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/19/24 17:41, Pierre Gondois wrote:
Hello Steven,

On 1/12/24 17:18, Steven Rostedt wrote:
On Fri, 12 Jan 2024 09:39:45 +0100
Pierre Gondois <pierre.gondois@xxxxxxx> wrote:

trace-cmd can record events in multiple instances:
    $ trace-cmd record -e sched_wakeup -B test_instance -e sched_switch

When trying to split a trace.dat file recorded with the above command,
only the events located in the main buffer seems to be split. The
events recorded in the test_instance buffer seem to be discarded:
    $ trace-cmd split -i trace.dat -o trace_2.dat 284443 284444
    $ trace-cmd report trace_2.dat
      cpus=8
             <...>-525991 [004] 284443.173879: sched_wakeup: [...]
             <...>-525991 [004] 284443.173879: sched_wakeup: [...]
             <...>-525990 [007] 284443.173885: sched_wakeup: [...]
             <...>-525990 [007] 284443.173885: sched_wakeup: [...]
(no sign of sched_switch events)



Make use of the previous patches to split all the instances of
a trace.

This shouldn't be in the change log. As the change log is for history.
Think about reading this 5 years from now. Would it make sense about
"previous patches"?

Thanks for doing this, I'll try to set some time next week to review them.
I want to release 3.3 soon.

Would you be able to add a way to split out an instance into its own
trace.dat file?  Or to choose what you want.

   $ trace-cmd record -e sched_wakeup -B test_instance -e sched_switch

   $ trace-cmd split -B test_instance -o test.dat

Would make test_instance the main buffer in test.dat.

If you add more than one instance:

   $ trace-cmd record -e sched_wakeup -B test_instance -e sched_switch -B timer_instance -e timer

   $ trace-cmd split -B test_instance -o test.dat -B timer_instance

This would make "test_instance" the main buffer, and keep "timer_instance"
as an instance.

The "-o file" placement is important. It will make whatever came before it
the main buffer. And perhaps even split out more than one!

   $ trace-cmd split -B test_instance -o test.dat -B timer_instance -o timer.dat

Would place the "test_instance" as the main instance in test.dat, and the
"timer_instance" as the main instance in timer.dat.

I think it might be difficult to select the main instance and name it in
the output file this way. As it has no specific name. I suggest to also add a '-b' parameter to designate
the main buffer. So with the following record command:

	$ trace-cmd record -e sched_wakeup -B switch_instance -e sched_switch -B timer_instance -e timer

	$ trace-cmd split -B switch_instance -B timer_instance -o test.dat
test.dat:
- switch_instance as the main instance
- timer_instance as a side instance (still named 'timer_instance')

	$ trace-cmd split -b -B switch_instance -o test.dat
test.dat:
- main instance as the main instance
- switch_instance as a side instance (still named 'switch_instance')

	$ trace-cmd split -B switch_instance -b -o test.dat
test.dat:
- switch_instance as the main instance
- main instance as a side instance (named 'main' [1])

	$ trace-cmd split -B switch_instance -o test.dat -B timer_instance
test.dat:
- switch_instance as the main instance
trace.dat.1
- timer_instance as the main instance.
    No output file is specified, so the default name is used as the output name.

	$ trace-cmd split -B switch_instance -o test.dat -b
test.dat:
- switch_instance as the main instance
trace.dat.1:
- main instance as the main instance.
    No output file is specified, so the default name is used as the output name.

	$ trace-cmd split -B switch_instance -o switch.dat -b -o main.dat -B timer_instance -o timer.dat
switch.dat:
- switch_instance as the main instance
main.dat:
- main instance as the main instance
timer.dat:
- timer_instance as the main instance

[1]
As the main buffer doesn't have a default name, it might be necessary
to hardcode the name, as 'main', or as 'main.X' (X being an increasing number)
if there is already a main instance in the trace


It would also mean that:
	$ trace-cmd split -B switch_instance -b -o switch.dat -B timer_instance -b -o timer.dat
switch.dat:
- switch_instance as the main instance
- main instance as a side instance, named 'main'
timer.dat:
- timer_instance as the main instance
- main instance as a side instance, named 'main'

And the usage of the function would be:
	$ trace-cmd split [-i file] [options] [[-b -B instance] -o file] [start [end]]
I.e. the options and start/end parameters would be common to all instances/output files.


Does it seems ok to you ?

Regards,
Pierre


Thoughts?

-- Steve




Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=218357
Signed-off-by: Pierre Gondois <pierre.gondois@xxxxxxx>
---





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux