aboutsummaryrefslogtreecommitdiffstats
path: root/trace-read.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>
* trace-cmd: Free filters at and of reportSteven Rostedt2010-02-16
| | | | | | Need to call pevent_filter_free() when finished with reporting. 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: Move free of record out of show_data in trace-cmd readSteven Rostedt2010-02-12
| | | | | | | There is no reason that the record that is passed to show_data should be freed by show_data. Free it from the location that allocated it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix trace-read to do a read not a peekSteven Rostedt2010-02-12
| | | | | | | A previous change broke the cpu filtering and had the trace-read return a peek and not a read. This would later be freed incorrectly. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix printf compile warningsDarren Hart2010-02-03
| | | | | | Signed-off-by: Darren Hart <dvhltc@us.ibm.com> LKML-Reference: <1265043026-24987-3-git-send-email-dvhltc@us.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Move merge sort of reading records into librarySteven Rostedt2010-01-13
| | | | | | | | The merge sort of reading the record timestamps and ording the records by time, regardless of CPU, has been moved from the trace-cmd.c file into the libtracecmd library code trace-input.c. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Rename tracecmd_open to tracecmd_allocSteven Rostedt2010-01-11
| | | | | | | | | | | | The tracecmd_open() currently returns a tracecmd_input descriptor that is not finished. The headers still need to be read and data needs to be initialized. Rename tracecmd_open and tracecmd_open_fd to tracecmd_alloc and tracecmd_alloc_fd respectively, and create a new tracecmd_open() and tracecmd_open_fd() that returns a usable descriptor. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add final memory clean upsSteven Rostedt2009-12-23
| | | | | | | Made the trace-cmd report free up all memory that it allocated. Thanks to valgrind! Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix up a lot of memory leaksSteven Rostedt2009-12-23
| | | | | | | Using valgrind --leak-check=full -v I found and fixed a lot of memory leaks. Also added a bit of memory clean up as well. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix uninitialized and poorly allocated variablesSteven Rostedt2009-12-23
| | | | | | | Used valgrind to discover a lot of memory allocation errors and fixed them up. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd/pevent: Remove passing of cpu to pevent prasing functionsSteven Rostedt2009-12-18
| | | | | | | Now that the struct record holds the cpu information, there's no need to pass the cpu number to the pevent parsing routines. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Pass in record to pevent functionsSteven Rostedt2009-12-18
| | | | | | | | | | Instead of passing in the data, size and timestamp to the pevent parsing routines, pass in the record itself. This allows the pevent parsing routines to have a bit more control and facilitates the need of future work where we need to know more about the record in the parser. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Rename struct event to struct event_formatSteven Rostedt2009-12-17
| | | | | | | | Calling the event format parser "struct event" may lead to confusion about if the struct actually represents an instance of an event instead of what it really is: a format descriptor. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Change tracecmd_open() to take file nameSteven Rostedt2009-12-17
| | | | | | | | | | | 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>
* Add free_record() to use to free records readSteven Rostedt2009-12-15
| | | | | | | | | 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>
* Disable first / last testingSteven Rostedt2009-12-15
| | | | | | The test for first and last element was left on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Add tracecmd_read_cpu_first() and last()Steven Rostedt2009-12-14
| | | | | | Add a interface to get the first and last item per CPU. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Add tracecmd_set_cpu_to_timestamp()Steven Rostedt2009-12-12
| | | | | | | | | 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>
* Add test to trace-cmd command line to test tracecmd_read_atSteven Rostedt2009-12-12
| | | | | | | | 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>
* Add command to show event formats from the data fileSteven Rostedt2009-12-09
| | | | | | | | 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>
* Rename tracecmd_handle to tracecmd_inputSteven Rostedt2009-12-04
| | | | | | | | | | | 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>
* Add handler to pevent functionsSteven Rostedt2009-12-04
| | | | | | | | | 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>
* Add way to retrieve all eventsSteven Rostedt2009-12-01
| | | | | | | 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>
* Remove global trace_handleSteven Rostedt2009-11-30
| | | | | | | | The trace_handel was used as a work around for the function graph tracer needing to reference a handel. This has been fixed, and the global trace_handle is no longer needed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Remove trace_read_data() and trace_peek_data()Steven Rostedt2009-11-26
| | | | | | | | | | | | | | | | | | The trace_read_data and trace_peek_data() required a global file descriptor for reading. This was kept because the library libparsevent had the function graph tracer implementation and required a callback to read. This code has been moved out of parse_events.c and into a special override function. Now it still uses the global read, but since libtracecmd has a little more scope than libparsevent, we added a thread variable tracecmd_curr_thread_handle This is unique per thread, and is set right after data is read. Yes there are some races, but we can deal with it for now. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Move cpu_data into tracecmd_handle structureSteven Rostedt2009-11-25
| | | | | | | | | | | Make the cpu_data part of the tracecmd handle. Also did some more clean ups in returns. Added the libparsevent hack for trace_read_data to handle the function graph output. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Move reading of data into libtracecmd librarySteven Rostedt2009-11-25
| | | | | | | | | | | | Moved the functions that deal with reading the trace file from trace-read.c to trace-input.c. Tried to not modify as much as I could, but I needed to convert some of the utils to use the library routines as well as pass around the handler through function parameters. Also added a hack to keep trace_peek_data that is used by libparsevent for the function graph tracer. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Convert libtracecmd to be more self sufficientSteven Rostedt2009-11-25
| | | | | | | Convent the API to use the handler for tracecmd. Also convert the read code to not die on error. A library should not kill the app. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Move most read functions from trace-read.c to new trace-input.cSteven Rostedt2009-11-25
| | | | | | | | | | | | | | The trace-input.c file belongs to the libtracecmd library. Move the functions from trace-read that will be used as an interface for the library. Note, this commit is a basic move. Only some changing from static to global was done to some functions and variables to keep the code working. But this is a transition commit. This shows the move. The next commits will show the changes to these functions to make the library API more practical. 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>
* move trailing newline into trace-readJohannes Berg2009-11-25
| | | | | | | | | The seq buffer filled by pevent_print_event could overflow, and in that case we still want the output to have a newline at the end. Therefore, change the API to not include it in the printed buffer and output it manually. Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
* Add method to load plugins at trace-cmd report timeSteven Rostedt2009-11-24
| | | | | | | | | | | | | | | | | | | | | | | This adds a method to load a plugin. It looks in the users directory ~/.trace-cmd/plugins and tries to load any file there. To create a plugin simply make a C file that has this minimum format: #include "parse-events.h" int PEVENT_PLUGIN_LOADER(void) { ... } Then compile it with the following method: gcc -c plugin.c -fPIC -o plugin.o gcc -shared -nostartfiles -o plugin Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* 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>
* Rename parse_event_file to pevent_parse_event and remove parse_ftrace_fileSteven Rostedt2009-11-24
| | | | | | Remove all users of parse_ftrace_file, and now use pevent_parse_event(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Rename print_event to pevent_print_eventSteven Rostedt2009-11-24
| | | | Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Rename print_printk to pevent_print_printkSteven Rostedt2009-11-24
| | | | Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Rename print_funcs to pevent_print_funcsSteven Rostedt2009-11-24
| | | | | | All global functions in libparsevent must have pevent_ as a prefix. 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 large trace entriesSteven Rostedt2009-11-23
| | | | | | | | | | | | During testing, all the events fit in the small event catagory. I never was able to test large events. I added a "die" command so that I would know of a large event to make sure it got tested. Finally, I got around to testing the large events, as others have been hitting the die statement. Reported-by: Johannes Berg <johannes@sipsolutions.net> 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>
* Separate out tracing setup functionsSteven Rostedt2009-11-16
| | | | | | | The functions that set up reading the data files may be used by other routines. Separate them out into their own functions. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* fix reading of string from fileSteven Rostedt2009-11-16
| | | | | | | | Reading the string from the trace file did not zero out the end of the string. This caused funny characters to appear at the end of the version listing. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Convert parse-envents.c to use trace_seq for outputSteven Rostedt2009-11-16
| | | | | | | To allow other users to take adavantage of the parse-events code, convert it to trace_seq. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* change input_fd to globalSteven Rostedt2009-11-16
| | | | | | | Other parts of the tracer may need to reference the data file. Make it global. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* 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 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>
* Fix typo: s/peak/peek/Josh Triplett2009-08-05
| | | | Signed-off-by: Josh Triplett <josh@joshtriplett.org>
* handle bprint eventsSteven Rostedt2009-07-21
| | | | | | | | The ftrace bprint uses a special binary format to record trace_print events. This patch changes trace-cmd to handle the format. Part of that is to read (and record) the printk_formats file in the trace.dat. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>