aboutsummaryrefslogtreecommitdiffstats
path: root/trace-input.c
Commit message (Collapse)AuthorAge
* Fixed debug messagingJonathan Herman2012-09-21
|
* Fixed performance / memory leak of mouse hoveringJonathan Herman2012-08-30
|
* rt-graph: real-time plots display info popupJonathan2012-03-06
| | | | | When you hover close enough to an events time, the event name will display. This time is based on _litmus_ time, not record time.
* trace-cmd: fix length calculation for padding eventsDavid Sharp2012-01-27
| | | | | | | | | | | | | Padding events store size in bytes, not words. Usually this ends up pushing the parser off the current page, but occasionally not, and when not, it ends up desynchronizing the parser from the event stream. This would manifest as a lot of "ug!" messages from trace-cmd, and kernelshark crashing before displaying the UI. Link: http://lkml.kernel.org/r/1327633215-4013-1-git-send-email-dhsharp@google.com Signed-off-by: David Sharp <dhsharp@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* parse-events: Modify header to work in C++ programsSteven Rostedt2011-10-17
| | | | | | | Replace keywords "private" and "bool" from parse-events.h to allow it to be used in C++ programs. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Allow report to ignore the date optionSteven Rostedt2011-09-02
| | | | | | | | | | | Add --nodate to trace-cmd report to ignore the date offset and give the raw timestamp count of the records. This also adds a flags field to the tracecmd_input struct and is set and cleared with tracecmd_set_flag() and tracecmd_clear_flag() respectively. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Have timestamp offset set at cpu descriptor not recordSteven Rostedt2011-09-02
| | | | | | | | | The cpu descriptor is referenced by many functions, and needs to include the ts_offset, otherwise those functions will be incorrect. The record->ts is based on the cpu descriptor timestamp, so by modifying the cpu timestamp the record->ts is also modified. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add --check-events to reportVaibhav Nagarnaik2011-08-18
| | | | | | | | | | | | | Add a new option --check-events to the report target which makes sure that the event formats in the trace data file can be parsed correctly on the machine that trace-cmd is running on. It returns EINVAL(22) for parsing failures and 0 for success. Cc: Michael Rubin <mrubin@google.com> Cc: David Sharp <dhsharp@google.com> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> Link: http://lkml.kernel.org/r/1313091459-12049-4-git-send-email-vnagarnaik@google.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add check for truncated filesVaibhav Nagarnaik2011-06-29
| | | | | | | | | | | | | | | | If the trace data file that is being read is truncated, mmap'ing its non-existent page does not give any error. When the page is read, the process dies with a SIGBUS. This patch adds a file size check while initializing the trace data and makes sure that the file size matches the expected size; otherwise an error is returned. Cc: Michael Rubin <mrubin@google.com> Cc: David Sharp <dhsharp@google.com> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> Link: http://lkml.kernel.org/r/1308615578-556-1-git-send-email-vnagarnaik@google.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* Fix address of the Free Software FoundationUwe Kleine-König2011-03-22
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add ftrace options with fgraph tailprint optionSteven Rostedt2011-03-18
| | | | | | | | | Added internal options for ftrace, and included a fgraph:tailprint option that will print the function names at the function exit. When the option is set, instead of just '}' the name will be added '} /* func_name */' Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add hack to report out blktraceSteven Rostedt2011-02-25
| | | | | | | | | | | | The blktrace never exported the ftrace events via the /debug/tracing/events directory. Not to mention, that the blktrace is much more complex data to read out. Add a hack into the trace-input that creates a event format that parse-events can read for the blktrace file, and also create a plugin to parse the complex data. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add trace.dat option TRACECMD_OPTION_DATESteven Rostedt2011-02-24
| | | | | | | | | | Add the DATE option to trace.dat to store an ASCII hex number starting with '0x' that contains the difference between the timestamps stored in the trace.dat file and the gettimeofday value. The DATE options units is microseconds. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add tracecmd_read_page_record()Steven Rostedt2011-02-24
| | | | | | | | Add new function tracecmd_read_page_record() that can parse records from a page without the need of a tracecmd_input handle. It requires a pevent, a page read from the ring buffer, the size of the page and the last_record. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Have translation functions not depend on tracecmd_inputSteven Rostedt2011-02-23
| | | | | | | Change the tracecmd input translation functions to only depend on the pevent instead of the tracecmd_input handle. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Remove redundant type field in list_for_each_entry()Steven Rostedt2011-02-22
| | | | | | | The type field in list_for_each_entry() is the same as the type that the ptr field points to. Use typeof(*ptr) instead. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add debugging to find where leaked records areSteven Rostedt2011-02-21
| | | | | | | | Add DEBUG_RECORD macro that records the address of the caller to get a record, and if there are leaked records existing, print out where the extra records were allocated from. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Reset record pointer in set_cpu_to_timestamp()Steven Rostedt2010-11-11
| | | | | | | | | | | | | | The code to reset the cpu to a specific timestamp some time fails if the time stamp does not match the current saved time stamp and we go to another page. Without resetting the timestamp for that page, the algorithm can get confused if the timestamp is currently in the middle of the page and the record we want is on the page but before the timestamp. Simply reset the timestamp to the start of the page when going to another page. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not let tracecmd_peek_data read past # of CPUsSteven Rostedt2010-10-15
| | | | | | | | tracecmd report --cpu # will segfault if # is greater than the last CPU defined in the trace.dat file. Prevent tracecmd_peek_data() from reading past the last CPU. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add ref counter to recordSteven Rostedt2010-09-17
| | | | | | | | Add tracecmd_record_ref() to let an application up the reference to a record to be used at a later moment. This makes sure the record is not freed by the calling function. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Don't try to read unmapped memory (v2).David Daney2010-07-20
| | | | | | | | | | | | | | | | | | | Under some circumstances, I'm not sure exactly which, a trace.dat file may contain a bunch of zeros at the end of one or more of the trace logs. This can lead to tracecmd_peek_data() attempting to read past the end of the mmaped log, causing SIGSEGV. This is a two part fix. 1) For 'new format' data, we always try to read 8 bytes of data. Make sure that they are all on the current page. 2) In pevent_print_event(), if record->size is negative, warn and then skip attempting to print it. Signed-off-by: David Daney <ddaney@caviumnetworks.com> LKML-Reference: <1279586810-29859-2-git-send-email-ddaney@caviumnetworks.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix trace-cmd function graph handling of its eventsSteven Rostedt2010-07-14
| | | | | | | | | | | | | The function graph needs to store the function graph return event for later use. This patch changes the function graph callbacks to use the context to store this information and initialize it when first referenced. The event data is now stored on the tracecmd_input handle, that allows more than one tracecmd_input handle to work with this code in one utility. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Load the default ftrace print handlers before pluginsSteven Rostedt2010-06-24
| | | | | | | | Load the ftrace function print handlers before loading the plugins. This allows for a loaded plugin to override one of the ftrace default output functions. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Remove free_record from tracecmd_read_prevSteven Rostedt2010-06-09
| | | | | | Missed a free_record in the revert of the need to free peek data. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Remove left over debuggingSteven Rostedt2010-06-09
| | | | Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Revert need to free peek eventSteven Rostedt2010-06-08
| | | | | | | | Freeing records that were returned via "peek event" made things a bit more complex. Since the original code was written to determine that peek events should not be freed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add back locked recordSteven Rostedt2010-06-08
| | | | | | | | To debug when a record is being freed and still referenced internally, the "locked" field is added. This will flag when a record has been freed when it should not have been. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: make records refcountedJohannes Berg2010-05-25
| | | | | | | | | | | | | | | If a callback wants to hold on to a record, it can then increase the refcount and keep it. This is most likely to happen with the upcoming python plugin. Since the underlying data pages are already refcounted, we can just add a refcount to struct record (rather than having the error checking with the 'locked' member). Acked-by: Darren Hart <dvhltc@us.ibm.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
* trace-cmd: Fix reading of print stringsSteven Rostedt2010-05-24
| | | | | | | | The code that cleaned up parsing the printk_format file never registered the formats to the pevent code. Any trace_printk() that used bprint() was not able to be parsed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* parse-events: Fix parenthesis parsing of filtersSteven Rostedt2010-04-01
| | | | | | | | | | | | | The parenthesis filter parsing was a bit broken and needed a rewrite. This redesigns the filter parsing to be a bit more sane when it comes to parenthesis. It lets the parenthesis be treated as what they resolve to be. Funny, the example used by kernelshark failed because of this bug: "next_prio < 100 && (prev_prio > 100 && prev_pid != 0)" Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Show lost events if buffer supports itSteven Rostedt2010-04-01
| | | | | | | | | | | If the ring buffer in the kernel sends information via the commit field of the sub buffer header. Than this patch will display where events were lost. If the sub buffer has space and can store the count of dropped events, this patch will show the count as well. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add options to trace.dat fileSteven Rostedt2010-03-23
| | | | | | | | Add the start of option to the trace.dat file. This will allow later versions of the file to add data without breaking older versions of trace-cmd. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Register plugins before reading eventsSteven Rostedt2010-03-10
| | | | | | | | Register plugins before events are read. This will remove warnings about events that can not be parsed event though a plugin will read that event anyway. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not bail on failing mmap on second CPU if first had no sizeSteven Rostedt2010-02-24
| | | | | | | | | | | | If the first CPU had no size, and the second CPU failed to mmap, do not fail the entire trace-cmd report. The mmap check is not done on CPUs with no size. If the mmap fails, then check the previous CPUs to see if any of them had size, and if so then bail. But if none did, then continue. 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: Add locked attribute to record and debug peek freeingSteven Rostedt2010-02-12
| | | | | | | | | | | Add a "locked" attribute to the record structure. This will be set when a peek is returned and cleared on read. This will help debug cases that incorrectly free a record returned by peek. The internal helper function free_next() is added to do the freeing of the next record used by peek. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add tracecmd_get_cursor()Steven Rostedt2010-02-12
| | | | | | | Add the helper routine tracecmd_get_cursor() that returns the offset of the next tracecmd_read_data() or tracecmd_peek_data(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add tracecmd_set_all_cpus_to_timestamp()Steven Rostedt2010-02-10
| | | | | | | Add the helper routine tracecmd_set_all_cpus_to_timestamp() to be used to initialize all CPUs to a given time. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add tracecmd_read_prev()Steven Rostedt2010-02-10
| | | | | | | Add the tracecmd_read_prev(handle, record) that returns the record before the given record. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add calc_page_offset() helper routineSteven Rostedt2010-02-10
| | | | | | | | | | Use calc_page_offset() to performe the: offset & (handle->page_size - 1) to prevent any typos and bugs. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Add new tracecmd_set_cursor() functionSteven Rostedt2010-02-08
| | | | | | | | | | | | | | | | | | | | | The tracecmd_set_cursor() takes an offset that will cause the next tracecmd_peek_data() or tracecmd_read_data() to return a record at that offset (given that the CPU matches). This is useful when iterating with tracecmd_read_data() and then needing to read a record out of sequence. One can do: while ((record = tracecmd_read_data(h, cpu))) { /* ... */ free_record(record); record = tracecmd_peek_data(h, cpu); save_offset = record->offset; free_record(record); record = tracecmd_read_at(h, o, NULL); /* ... */ tracecmd_set_cursor(h, cpu, save_offset); } Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Compare index of events to proper endSteven Rostedt2010-02-01
| | | | | | | | | The index is the offest from the end of the page, where as the page_size attribute is the offset from the beginning of the data. Fix the compare of the index and the page_size to compare at the same starting point. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Handle junk on last page for tracecmd_read_cpu_last()Steven Rostedt2010-02-01
| | | | | | | | If the last page (or last pages) have just junk on it (timestamps and discarded events), tracecmd_read_cpu_last should not return NULL. It needs to test previous pages. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix pointer adjustment when skipping paddingSteven Rostedt2010-02-01
| | | | | | | | | When a filter fails to discard an event due to another event writing to the buffer, it makes the first event just padding. But the algorithm to skip the padding added 4 bytes too much to get to the next record. This made the next record corrupted. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Do not return offset of empty CPU bufferSteven Rostedt2010-02-01
| | | | | | | | | | If a one CPU buffer is empty, and a tracecmd_read_at is made to the first page of the next CPU buffer, it mistakenly returns the empty buffer because the offsets still match. Fix this by only returning a CPU buffer if it contains something. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Handle empty CPUs without crashingSteven Rostedt2010-01-15
| | | | | | | | | | | | | The get_page() needs to return -1 on reading a CPU that has no data. Also added checks of get_page() return status that was missing from some callers. Have tracecmd_set_cpu_to_timestamp() also return -1 when reading an empty CPU. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Fix cursor on page with timestamp valueSteven Rostedt2010-01-13
| | | | | | | | If the timestamp of the current page matches the parameter, we still need to check if the cached record exists and it too matches the timestamp. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* trace-cmd: Unload plugins on tracecmd_close()Steven Rostedt2010-01-13
| | | | | | | When the handle is freed, we need to unload the plugins, otherwise we will keep loading them if an app closes and opens a new handle. 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: 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>