aboutsummaryrefslogtreecommitdiffstats
path: root/trace-cmd.c
Commit message (Collapse)AuthorAge
* trace-cmd: Add trace-cmd report -v optionSteven Rostedt2010-02-16
| | | | | | | | | | | | | Add a -v option to trace-cmd report to negate all filters specified after it. That is, records that match those filters will not be displayed. ./trace-cmd report -F sched -v -F 'sched_switch: next_prio > 100' This will display all sched events except sched_switch events where the next_prio is greater than 100. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* parse-events: Add event filtering on event fieldsSteven Rostedt2010-02-15
| | | | | | | | | | | | | | | Add the ability to filter on event fields. This patch implements the filter on trace-cmd report. Using the following: trace-cmd report -F 'sched.sched_switch:next_prio < 100 || (prev_comm != "swapper" && next_comm != "swapper")' Will return a report where prios are under 100 (Real-time) and does not include any context switch with the swapper task. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Relicense the library files under LGPLSteven Rostedt2010-02-15
| | | | | | | | | | | | | | | | | | | | All the files that are used to create the libraries: libparsevent and libtracecmd are converted to the LGPL as well as the files to create the plugins. All files now have a boilerplate header that states which license that the file is under. A README file is created as well as the COPYING.LIB which contains the text of the LGPL. All authors of the code that created these files have given their Acks. Acked-by: Darren Hart <dvhltc@us.ibm.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not die if seting pid for sched events failsSteven Rostedt2010-02-03
| | | | | | | | | Older kernels do not handle filtering well. The -F flag causes the filter to sched_wakeup and sched_switch to be set for next pid, and if it fails to set, just ignore it. It should not interfere with the trace anyway. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Handle zeroing of set_ftrace_pid on older kernelsSteven Rostedt2010-02-03
| | | | | | | | | Older kernels require a "-1" be passed into set_ftrace_pid to zero it out. Newer kernels need just an empty string. The sad part is that using the wrong one will cause the write to fail. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Reset ftrace pid on disable allSteven Rostedt2010-02-02
| | | | | | | Reset the ftrace pid on disable all and also fix the reset of the file to perform a O_TRUNC, otherwise it keeps the previous pids. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Disable all filters before starting a traceSteven Rostedt2010-02-01
| | | | | | | Disable the filters before starting the trace. Then we can enable just the filters that we want to add. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix the compare to none in the filter fileSteven Rostedt2010-02-01
| | | | | | | | The compare to the filter contents should only check the first for characters to show that an empty filter is none, otherwise the whitespace may screw it up. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add sched_switch to and wake up of pid to filterSteven Rostedt2010-02-01
| | | | | | | | | If the -F option is set, include events that wake up that pid or switch to it. That is, even if the event is done by another task, if that task calls the wakeup event to the filtered pid, it should also be shown, as well as the context switches to the filtered task. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Consolidate the code between enable and disabling eventsSteven Rostedt2010-02-01
| | | | | | | | | The code that enables the events is very similar to the code that disables the events. In fact, the code that disables events has been suffering from a little bit rot. This patch consolidates the two bringing disable_event up to par with the latest code. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Only enable filtering on the second call to enable_eventsSteven Rostedt2010-02-01
| | | | | | | The enable_events is also used to update the filtering for the -F option. But it should not be doing the work of enabling events again. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix extract to enable tracingSteven Rostedt2010-02-01
| | | | | | The filtering code made the extract command not enable tracing. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not enable tracing until execSteven Rostedt2010-02-01
| | | | | | | | Wait till the last moment to enable tracing. Otherwise we trace the trace-cmd utility setting up the program and waste a lot of the data file. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add tracing of only the current taskSteven Rostedt2010-02-01
| | | | | | | | Add the trace-cmd record -F option that will set up all the filters to only trace the task that is given on the command line, or the shell if no command is given. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add filtering of eventsSteven Rostedt2010-02-01
| | | | | | | | Add the option "-f filter" to come after an event, to enable a filter. trace-cmd record -e sched_switch -f next_pid==2314 Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Clean up trace_empty()Steven Rostedt2010-02-01
| | | | | | The code that checks if the trace_empty() can been cleaned up a little. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Use glob() library call to enable eventsSteven Rostedt2010-02-01
| | | | | | | Use of the glob() library call makes the enabling of events more robust. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not read entire file in trace_empty()Steven Rostedt2010-02-01
| | | | | | | | | The function to test if the trace is empty should stop when it detects a line that is not empty, and report it. It actually had a bug where it would reach the end of the file and report that the trace was not empty. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Cache tracing_on file descriptorSteven Rostedt2010-01-18
| | | | | | | | Cache the tracing_on file descriptor to have the disable_tracing() be able to shut down tracing without having to reopen the tracing_on file. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add split featureSteven Rostedt2010-01-13
| | | | | | | | | | | | | | | | | | | trace-cmd split [options] -o file [start [end]] -o output file to write to (file.1, file.2, etc) -s n split file up by n seconds -m n split file up by n milliseconds -u n split file up by n microseconds -e n split file up by n events -p n split file up by n pages -r repeat from start to end -c per cpu, that is -p 2 will be 2 pages for each CPU if option is specified, it will split the file up starting at start, and ending at end start - decimal start time in seconds (ex: 75678.923853) if left out, will start at beginning of file end - decimal end time in seconds Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd/kernelshark: Implement versioning of the toolsSteven Rostedt2010-01-08
| | | | | | | Have the versions of the tools in the Makefile and automate the updating of them when the numbers in the Makefile change. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-view: Separate out view from trace-cmdSteven Rostedt2009-12-21
| | | | | | | trace-cmd is going to be a command line only tool. The viewer is going to go into a separate utility. This patch separates it out. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Merge branch 'trace-cmd' into trace-viewSteven Rostedt2009-12-18
|\ | | | | | | | | | | | | Fixed up the trace-graph and trace-cmd view to handle the new API Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| * trace-cmd: Add trace-cmd extractSteven Rostedt2009-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a way to extract a current trace into the data file. That is, you can run a ftrace outside of trace-cmd, or use trace-cmd start and trace-cmd stop to get a trace. Then to pull it into a file, use trace-cmd extract Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* | Add GTK viewer for reading trace dataSteven Rostedt2009-12-17
|/ | | | | | This is the start of adding a GTK front end to read the trace data. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add negating of eventsSteven Rostedt2009-12-15
| | | | | | | | | | | Add the '-v' option to disable events. This is advantageous with: trace-cmd record -e all -v -e lock -e syscalls This will enable all events and then disable lock and syscall events before executing the command. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Show ring buffer stastics at the end of tracingSteven Rostedt2009-12-15
| | | | | | | When the tracer is completed, show the ring buffer statistics to give a good idea about overruns and such. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add sleep_time between splice readsSteven Rostedt2009-12-15
| | | | | | | | | | | | I found that tracing few events causes trace-cmd to almost spin in a busy loop since it can constantly read a page, and the process of reading that page causes it to run again. We end up just causing events to read. This adds a -s sleep time option that forces trace-cmd to sleep. The default is 1ms. But it can be disabled with 0. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix invalid write due to cpus and cpu_count confusionDarren Hart2009-12-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix invalid write due to cpus and cpu_count confusion trace-cmd would fail with: # ./trace-cmd record -e sched ls -ltr enable sched cpus: 8 cpu_count: 0 *** glibc detected *** ./trace-cmd: free(): invalid next size (normal): 0x0000000000e760b0 *** ======= Backtrace: ========= /lib64/libc.so.6[0x3f18671ce2] /lib64/libc.so.6(cfree+0x8c)[0x3f1867590c] /lib64/libc.so.6(fclose+0x14b)[0x3f18660d0b] ./trace-cmd[0x40397e] ./trace-cmd(main+0x7df)[0x404777] /lib64/libc.so.6(__libc_start_main+0xf4)[0x3f1861d974] ./trace-cmd[0x4029f9] ======= Memory map: ======== 00400000-00418000 r-xp 00000000 08:04 1922384 /test/dvhart/source/trace-cmd.git/trace-cmd 00617000-00618000 rw-p 00017000 08:04 1922384 /test/dvhart/source/trace-cmd.git/trace-cmd 00e76000-00e97000 rw-p 00000000 00:00 0 [heap] 3f18200000-3f1821c000 r-xp 00000000 08:03 327334 /lib64/ld-2.5.so 3f1841b000-3f1841c000 r--p 0001b000 08:03 327334 /lib64/ld-2.5.so 3f1841c000-3f1841d000 rw-p 0001c000 08:03 327334 /lib64/ld-2.5.so 3f18600000-3f1874c000 r-xp 00000000 08:03 327335 /lib64/libc-2.5.so 3f1874c000-3f1894c000 ---p 0014c000 08:03 327335 /lib64/libc-2.5.so 3f1894c000-3f18950000 r--p 0014c000 08:03 327335 /lib64/libc-2.5.so 3f18950000-3f18951000 rw-p 00150000 08:03 327335 /lib64/libc-2.5.so 3f18951000-3f18956000 rw-p 00000000 00:00 0 3f18a00000-3f18a02000 r-xp 00000000 08:03 327341 /lib64/libdl-2.5.so 3f18a02000-3f18c02000 ---p 00002000 08:03 327341 /lib64/libdl-2.5.so 3f18c02000-3f18c03000 r--p 00002000 08:03 327341 /lib64/libdl-2.5.so 3f18c03000-3f18c04000 rw-p 00003000 08:03 327341 /lib64/libdl-2.5.so 3f19a00000-3f19a0d000 r-xp 00000000 08:03 327350 /lib64/libgcc_s-4.1.2-20080825.so.1 3f19a0d000-3f19c0d000 ---p 0000d000 08:03 327350 /lib64/libgcc_s-4.1.2-20080825.so.1 3f19c0d000-3f19c0e000 rw-p 0000d000 08:03 327350 /lib64/libgcc_s-4.1.2-20080825.so.1 7f4ef8000000-7f4ef8021000 rw-p 00000000 00:00 0 7f4ef8021000-7f4efc000000 ---p 00000000 00:00 0 7f4effbea000-7f4effbec000 rw-p 00000000 00:00 0 7f4effc00000-7f4effc03000 rw-p 00000000 00:00 0 7ffffb0c5000-7ffffb0da000 rw-p 00000000 00:00 0 [stack] 7ffffb1ff000-7ffffb200000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted The cpus and cpu_count line above I added to understand the ambiguity of those variables. The cpus variable appears redundant. This patch uses the global cpu_count directly. If cpu_count should not be updated until later for some reason, then the code could be updated to use cpus instead. The way it was however tries to write to pids[] which has a size of 0. Signed-off-by: Darren Hart <dvhltc@us.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Move writing to data file to librarySteven Rostedt2009-12-14
| | | | | | | | We need a way to have other applications easily make the output file. This moves the recording of the trace.dat file to the trace-cmd library. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Have trace-cmd record not need a commandSteven Rostedt2009-12-11
| | | | | | | | Currently trace-cmd record requires a command to exec. This patch will just record what is happening if no command is given and will stop when the user hits Ctrl^C. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Let trace-cmd start disable function tracingSteven Rostedt2009-12-10
| | | | | | | The disabling of the function tracer was hidden in the trace-cmd record branch. Move it to be used by both record and start. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Do not record if no plugin or event was specifiedSteven Rostedt2009-12-09
| | | | | | | | | An new user may just try doing a record and see what happens, and will be surprised when there is no output to show. This patch adds an error message if no event or plugin is specified. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Added trace-cmd start, stop and resetSteven Rostedt2009-12-09
| | | | | | | | | | | | | | Sometimes it is nice to just kick off the tracer without having to record it into a trace data file. Instead of having to always echo the commands into the tracing debugfs directory, this patch adds the trace-cmd start, which acts like the trace-cmd record, but does not start a command or record the trace via splice. It simply enables the tracer. trace-cmd stop - will stop tracing (echo 0 > tracing_on) trace-cmd reset - will reset the tracer (echo nop > current_tracer) Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Start of creating libtracecmd.a librarySteven Rostedt2009-11-25
| | | | | | | | Have libtracecmd.a contain libparevent.a and include trace-util.c. Create a trace-local.h file to be used by the trace-cmd exec itself. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* remove unused codeJohannes Berg2009-11-25
| | | | | | | write_trace(), find_trace_type() and consequently old_ftrace_name are unused, so remove for now. Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
* Added trace-cmd.hSteven Rostedt2009-11-24
| | | | | | Move trace-cmd specific items from parse-event.h to new trace-cmd.h. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Print out the event files stored in a data fileSteven Rostedt2009-11-23
| | | | | | Add -E option to print out the event files stored in a data file. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Handle old formatSteven Rostedt2009-11-20
| | | | | | | | | Update to read the old file format for 2.6.30. It is very limited, but can process a little. Unfortunately, the printk_formats file is broken for 2.6.30. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* reset max latencySteven Rostedt2009-11-20
| | | | | | When running one of the latency tracers, reset the max latency. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* don't fail if ftrace_enable is not thereSteven Rostedt2009-11-16
| | | | | | | We should still be able to do tracing if the kernel was not compiled with function tracer. Don't fail on failure to read ftrace_enable. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* make the code closer to what is in perfSteven Rostedt2009-10-14
| | | | Signed-off-by: Steven Rostedt <srostedt@redhat.com>
* port over changes from perfFrederic Weisbecker2009-10-14
| | | | | | | Frederic Weisbecker added a bunch of changes to the perf code. This is a port of his work to trace-cmd. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
* add way to enable options in recordingSteven Rostedt2009-10-13
| | | | | | | Although most of the options are for print output, that does not even affect the report function. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* remove debug functionSteven Rostedt2009-10-13
| | | | Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* clean up temp files when doneSteven Rostedt2009-10-13
| | | | | | | Due to the logic between cleaning up threads and deleting temp files, the temp files were never deleted. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* add latency format option to all outputSteven Rostedt2009-10-13
| | | | | | | All traces have info about interrupts disabled, preempt count and needing rescheduling. Add an option to expose these. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* do not exit when parser fails on an eventSteven Rostedt2009-10-13
| | | | | | If an event fails to parse, just warn about it, and continue. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* free(NULL) works just fine.Josh Triplett2009-08-05
| | | | Signed-off-by: Josh Triplett <josh@joshtriplett.org>
* enable_event: append to set_event, to avoid disabling previous events.Josh Triplett2009-08-05
| | | | | | | Writing to set_event, rather than appending, disables all other events first. Signed-off-by: Josh Triplett <josh@joshtriplett.org>