| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
This is the start of adding a GTK front end to read the trace data.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To speed up the reading of cmdlines to pid mappings, an unsorted list
is used first to register comms (cmdlines). Once the list is
used to seach, the list is converted to a sorted array to allow
for fast binary searches. But once this was done, there was no way
to add more cmdlines mappings.
This now adds a slower version to add new cmdlines after the list
has been made, but still makes it possible.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
Add the function pevent_pid_is_registered() that returns 1 if the
given pid has a cmdline mapped to it, and 0 otherwise.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
Need to use the python-config script instead of having hard coded
includes.
Reported-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a python ctracecmd module for use in rapidly prototyping
tracing applications. The interface description is provided in
ctracecmd.i, it identifies which functions are available from within
python. A test python script is provided as tracecmd-test.py.
These bindings are expected to change significantly. Eventually I
would like to wrap this automated binding with more pythonic objects,
most likely including Trace and Event objects which merge the
functionality of tracecmd-input, pevent, record, and event structures.
This will make development of python apps much more accessible to many
application developers.
For now, this is mostly a proof of concept and is no where near
complete. It can however open a trace file and read all the events from
it, displaying them by CPU in chronological order.
V2: o Simplified interface file with SWIG ifdefs in the header files
V3: o Move attribute removal to interface file
o Remove proxy classes and rename module to ctracecmd
o Use the Makefile with a phony python target instead of swig.sh
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
LKML-Reference: <4B2A7878.6060209@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Rename tracecmd_open() to tracecmd_open_fd and add a new
tracecmd_open() to take the name of a file.
Also added the API for tracecmd_close() but still need to do
proper clean up. It just frees the handle, but does nothing with
everything else it allocated.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
Clean up, to get rid of leftover externs in the trace-cmd.h
header file.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The caller of the pevent accessor functions:
pevent_data_pid(pevent, data) for example
Already have a struct record. Let them send that directly:
pevent_data_pid(pevent, record)
This decouples the API from the struct implementation and facilitates
language bindings which use opaque pointers for passing the C structs
around.
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
LKML-Reference: <4B297C79.2090004@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
The timestamp was getting messed up by various reads of
tracecmd_read_at(). This resets the page everytime that
function is used.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
The free_record inline function uses free, and requires
the stdlib.h header.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
| |
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
This adds a wrapper for freeing the records.
It also fixes a comment in tracecmd_peek_data, where
the record returned must not be freed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
| |
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
The algorithm in tracecmd_set_cpu_to_timestamp() depends on
the timestamp of the page being for the page. With reading
data off the page, the timestamp gets incremented. This resets
the timestamp back to the first record on the current page.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
Both read and mmap do the same thing except the mmap version
needs to unmap the page on free. The condition should hold
the mmap version.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
get_page() already manages the size field of cpu_data, it should
also reset index. This does not need to be done in get_next_page().
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
If the offset of the page is modified, reset the timestamp
as well. The tracecmd_set_cpu_to_timestamp depends on the
timestamp being in sync with the offset.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
The offset was set at the beginning and again during updating
of the page in get_page.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
| |
The test for first and last element was left on.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
| |
If the search for a record comes down to being on a page
where the timestamp is greater than the page but less then the
next page to look for, the code will go into an infinite loop.
This is because the next page to look for will be the same as
the starting page, and it will never continue to move forward.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
| |
Add a interface to get the first and last item per CPU.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
We need to read the page info when a page is mapped, not when
the first element is read.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Fix a bug where we tried to read more than needed if a second read
is needed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
This adds an API to set the CPU data field to the location
specified by a timestamp. It looks for the page that contains or
is before the timestamp to allow for walking forward to find
the specified event.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
| |
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
The get_page code shoud calculate the page calculations of the cpu
index, offset and size.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
The trace-cmd command line does not use tracecmd_read_at, but it
still needs to be tested. This allows easy access to test the
tracecmd_read_at routine.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
The capturing of a page with tracecmd_read_at was a hack that used
get_next_page by forcing the index to the previous page. Now that we
have a more generic get_page, this patch changes tracecmd_read_at to
use that.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
This patch adds a generic mmap page reading that simply
swaps the old mmap with a new mapping. This avoids needing to use
get_next_page in an awkward and error prone fashion.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
The event output for scheduler context switches and wakeups changed
the output format. This adds a plugin to make those changes look
more like the sched_switch plugin.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
If a constant has a negative number in processing symbols, the
parser will fail. This patch adds handling of both negative numbers
and subtraction.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
Sometimes we need to see the event formats that are stored in a data
file. This patch adds the options "--events" that prints out these
formats.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Older kernels have a bug that prints out the macro name instead of
what it should represent. This breaks parsing the data from userspace.
This especially affects the mac80211 trace events.
This adds a work around in the tool to handle the bug when executed
on older kernels.
See Linux kernel commit 811cb50baf63461ce0bdb234927046131fc7fa8b
for details.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
|
|
|
|
|
|
|
| |
We will soon be adding write functionality to the tracecmd
library. This will require a new and separate handle than what
is used by the file reader.
"handle" is too generic. Rename it to "input" so we can make
the output handle called tracecmd_output.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
Currently pevent uses global variables to store the event types.
This will eventually bite us since we may someday want to be able
to read multiple files with different formats. This patch adds
a handle to pevent, to keep it encapsulated.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
|
| |
When we reach the end of the data file and unmap the page, we
must also reset the page offset, otherwise the tracecmd_read_at
gets confused, and may think that a page can be mapped when it is
not.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
The data for the events in the output looks better if most of them
are lined up in a column.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
|
| |
Added trace_seq_terminate that zeros out the buffer if the buffer
is not full. This is useful when data being returned may be used
in a printf directly or more data will be added to the trace_seq.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|
|
|
|
|
|
|
| |
This adds the function pevent_list_events that returns a list
of event pointers. One can pass in a sort algorithm too.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
|