aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-05-09trace-cmd report: Add -O offset for function pluginHEADmasterSteven Rostedt (VMware)1-2/+22
When -O offset is added to trace-cmd report with the function plugin enabled, it will display the offset of the functions along with their names. This helps in finding exactly where a function was called by its parent. trace-cmd report -O parent -O offset [..] rcuc/163-1330 [163] 740.653251: function: _raw_spin_lock+0x0 <-- rcu_cpu_kthread+0x4d8 Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd listen: Replace tab with spaces in help outputSteven Rostedt (VMware)1-1/+1
The bash completions of trace-cmd commands uses the -h to find the options to finish the completions with. trace-cmd listen -h had a tab before "-l" which caused the completions to miss it. Not to mention, it caused -l not to be in line with the other options. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd report: Fix pointer check in option -rSteven Rostedt (VMware)1-1/+1
The removal of malloc_or_die() cause a bad check for allocation failure for the option of '-r'. Fixes: b57a3336be81 ("trace-cmd: Remove malloc_or_die() form trace-read.c") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Add bash completion for trace-cmd report -OSteven Rostedt (VMware)1-0/+29
Show the available options with the bash completion of trace-cmd report -O Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Have bash completions look at all options by defaultSteven Rostedt (VMware)1-9/+38
Have all the trace-cmd commands have their options looked at for completion, even if there is not a specific function to handle them. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Add bash completions for instance buffers for -B optionSteven Rostedt (VMware)1-1/+39
Several trace-cmd commands use -B to work with buffer instances. When -B is used in such a way, then have it search the instance directory and list the available instances. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Add trace-cmd show completion for bashSteven Rostedt (VMware)1-0/+20
Add specific bash completion for trace-cmd show. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Have trace-cmd start, profile and stream use record completionSteven Rostedt (VMware)1-0/+12
The commands for trace-cmd start, profile and stream are the same as trace-cmd record, so have them have the same completions as trace-cmd record. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Fix the fix for completionsSteven Rostedt (VMware)1-1/+0
In the learning process of writing completion scripts, I put in various debugging. One of those was not removed before committing. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-09trace-cmd: Fix completionsSteven Rostedt (VMware)1-19/+79
The completions that were installed were basically just good for trace-cmd record, which kills all other users, and makes it frustrating trying to use tab completion for simple file finding. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-05trace-cmd-v2.7.devSteven Rostedt (VMware)1-2/+2
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-02trace-cmd-v2.6.1trace-cmd-v2.6.1trace-cmd-stable-v2.6Steven Rostedt (VMware)1-1/+1
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-01trace-cmd record: Fix filtering when using set_event_pidSteven Rostedt (VMware)1-1/+7
When set_event_pid exists, trace-cmd uses it for filtering tasks. A commit that updates the pid filtering was not updated to handle excludes of the tracing, and they were added too, causing more to be filtered than what should have been. Fixes: a5923c5c9f81 ("trace-cmd: Filter out specific pids") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Implement a main functionality lookup tableFederico Vaga4-63/+71
Since now there is an uniform command implementation I can reduce the `main()` function to the minimum by using a lookup table. People can now directly focus on a command implementation because there is "nothing" in the `main()` function. Link: http://lkml.kernel.org/r/20170426203028.13900-3-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Uniform main command implementationFederico Vaga6-628/+741
Most of the commands have the implementation in a dedicated file. Those commands without a dedicated file are implemented in the `main()` function. This patch uniform the code by moving the commands implemented in the `main()` function to dedicated files. Link: http://lkml.kernel.org/r/20170426203028.13900-2-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26parse-events: Fix missing break in FALSE case of pevent_filter_clear_trivial()Taeung Song1-0/+1
Currently the FILTER_TRIVIAL_FALSE case has a missing break statement, if the trivial type is FALSE, it will also run into the TRUE case, and always be skipped as the TRUE statement will continue the loop on the inverse condition of the FALSE statement. Link: http://lkml.kernel.org/r/1493218540-12296-1-git-send-email-treeze.taeung@gmail.com Reported-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Taeung Song <treeze.taeung@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-view: Remove unused variable "selection"Steven Rostedt (VMware)1-3/+1
Clean up compiler warning. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: BUG fix malloc() pointer validationFederico Vaga1-1/+1
To reproduce the bug mkdir /sys/kernel/debug/tracing/instances/test ./trace-cmd show -B test -s -f Failed to allocate instance path snapshot Link: http://lkml.kernel.org/r/20170423102258.21609-6-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd:read: BUG initialize input_files item to zeroFederico Vaga1-0/+1
On allocation the data structure was not initialized. Later on some attribute of this structure are used (e.g. tsoffset) assuming that the default value is zero, but it is not always true. Link: http://lkml.kernel.org/r/20170423102258.21609-4-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26plugin:python: check asprintf() errorsFederico Vaga1-3/+4
The code was validating the string but the man page for asprintf(3) says clearly: -------- If memory allocation wasn't possible, or some other error occurs, these functions will return -1, and the contents of strp are undefined. -------- So, we cannot really rely on the returned string pointer. Link: http://lkml.kernel.org/r/20170423102258.21609-3-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26plugin:python: fix compiler warningFederico Vaga1-3/+5
The function `load_plugin` is passed, as argument, to `trace_util_load_plugins()` but the prototype was not exactly the same. Link: http://lkml.kernel.org/r/20170423102258.21609-2-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Fix segmentation fault in trace-snapshotJohn Kacur1-1/+2
To reproduce the problem: plugin 'wakeup' trace-cmd: Device or resource busy Segmentation fault (core dumped) When the user triggers a condition such as EBUSY the program should die gracefully. The problem here is simply caused by an extra conversion specifier in "die" in the write_file function Link: http://lkml.kernel.org/r/1490112713-9456-1-git-send-email-jkacur@redhat.com Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26tools lib traceevent: Initialize lenght on OLD_RING_BUFFER_TYPE_TIME_STAMPSteven Rostedt (VMware)1-0/+1
A undefined value was being used for the OLD_RING_BUFFER_TYPE_TIME_STAMP case entry, as the 'length' variable was not being initialized, fix it. Caught by the reporter when building tools/perf/ using clang, which emmitted this warning: kbuffer-parse.c:312:7: warning: variable 'length' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] case OLD_RINGBUF_TYPE_TIME_EXTEND: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ kbuffer-parse.c:339:29: note: uninitialized use occurs here kbuf->next = kbuf->index + length; ^~~~~~ kbuffer-parse.c:297:21: note: initialize the variable 'length' to silence this warning unsigned int length; ^ = 0 Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20170213121418.47f279e8@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Remove include of string.h from event-utils.hSteven Rostedt (VMware)1-1/+0
string.h is not needed in event-utils.h. Remove it. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26event-parse: Change pevent_data_pc() to pevent_data_preempt_count()Steven Rostedt (VMware)2-3/+3
This function is for external use outside of trace-cmd itself. Instead of using the cryptic "pc" extend the name to be more meaningful, preempt_count. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Fixup more bogus symbol resolutionsJulia Cartwright1-1/+1
Commit ce1cbc51c ("trace-cmd: Leave out absolute addresses to fix bogus symbol resolutions") fixed up bogus symbol resolution for 'A' type symbols used on x86_64 for percpu offsets. However, this check did not cover per-cpu variables used in modules, which are generated as 'local' absolute symbols, and therefore appear as 'a' in /proc/kallsyms. Fix this. Link: http://lkml.kernel.org/r/20170216225721.13087-1-julia@ni.com Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Julia Cartwright <julia@ni.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Add a commented single quote to the MakefileSteven Rostedt (VMware)1-0/+1
My emacs highlighting gets confused by the single escaped quote, and makes the rest of the file highlighted as if the rest of the file is part of a string. By adding a commented out single quote, my emacs editor displays everything nicely again. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd build: If swig is not installed, force NO_PYTHON=1Steven Rostedt (VMware)1-0/+11
While trying to build trace-cmd on a box without swig installed, I get an annoying error during build when the compile tries to build the python plugins. Force NO_PYTHON=1 when swig is not installed, and give a warning about it. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Do not initialize profiler if it isn't being usedSteven Rostedt (VMware)1-1/+2
The profiler requires scheduler tracepoints enabled, and will bug out if they are not. The profiler initialization will error without these tracepoints defined. There's no reason to initialize the profiler on reading a trace.dat file especially since it could cause that reading to fail if the profiler required tracepoints are not there. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26trace-cmd: Make the parse_*() functions tracecmd_parse_*()Steven Rostedt (Red Hat)4-16/+16
To allow for better namespace of the tracecmd library, rename the parse_*() functions to tracecmd_parse_*() to prevent namespace collisions. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: allow for custom show and handle initJosef Bacik7-38/+65
External applications that need to hook into the streaming infrastructure need a way to have the handle init'ed in a specific way and need a way to provide their own read function so they can intercept events. This patch adds the neccessary definitions and hooks. Thanks, Link: http://lkml.kernel.org/r/1448053053-24188-6-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: add global functions for live tracingJosef Bacik2-18/+32
We need a few functions to disable/enable tracing as well as add events to be enabled on the first instance, this patch turns a couple of these local functions into library functions. Thanks, Link: http://lkml.kernel.org/r/1448053053-24188-5-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: add a function to create a top instanceJosef Bacik2-3/+24
We need a way to allow external applications to create an instance for doing their tracing, so add a helper function that takes care of creating an instance, setting it as the main instance and doing the heavy lifting of creating the instance in the tracing directory. Thanks, Link: http://lkml.kernel.org/r/1448053053-24188-4-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: make libtracecmd a little more library friendlyJosef Bacik20-8/+20
Whenever you link against libtracecmd you will get a bunch of debugging output if you don't provide your own pr_stat(). So instead default to no output if we don't provide a pr_stat(). Thanks, Link: http://lkml.kernel.org/r/1448053053-24188-3-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> [ Added missed updates for make gui ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: add install_libs target to trace-cmdJosef Bacik1-3/+14
This allows other commands to link against trace-cmd. Link: http://lkml.kernel.org/r/1448053053-24188-2-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: Move trace-record and trace-restore out of librarySteven Rostedt (Red Hat)1-3/+3
The "main" functions should not be in the library, and trace-record and trace-restore both have them. Put them back into the TRACE_CMD_OBJS and figure out what breaks later. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: Add time64.h to be like the kernelSteven Rostedt (Red Hat)5-13/+25
Add time64.h and use the time conversion macros there to keep parse-event.h similar to the kernel tree. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26tools lib traceevent: Add copyright headerJon Stanley1-0/+19
Adding a missing copyright header to parse-utils.c. Assuminng that the license is LGPL like the rest of the trace-cmd library code. Signed-off-by: Jon Stanley <jonstanley@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1347127251-4695-1-git-send-email-jonstanley@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2017-04-26trace-cmd: Move die() and friends out of event-utils.h and parse-utils.cSteven Rostedt (Red Hat)13-52/+66
As event-utils.h and parse-utils.c are copies of the same files from the Linux kernel source tree, move the die() funtions out of them as they no longer exist in the kernel source. Move the functions into trace-local.h. We need to update usage() of kernel-shark because its prototype conflicts with the usage in trace-local.h. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-17tools lib traceevent: Add correct header for ipv6 definitionsArnaldo Carvalho de Melo1-1/+2
We need to include netinet/in.h to get the in6_addr struct definition, needed to build it on the Android NDK: In file included from event-parse.c:36:0: /home/acme/android/android-ndk-r12/platforms/android-24/arch-arm/usr/include/netinet/ip6.h:82:18: error: field 'ip6_src' has incomplete type struct in6_addr ip6_src; /* source address */ And it is the canonical way of getting IPv6 definitions, as described, for instance, in Linux's 'man ipv6' Doing that uncovers another problem: this source file uses PRIu64 but doesn't include it, depending on it being included by chance via the now replaced header (netinet/ip6.h), fix it. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Chris Phlipot <cphlipot0@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-tilr31n3yaba1whsd47qlwa3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-17tools lib traceevent: Use str_error_r()Arnaldo Carvalho de Melo4-8/+36
To make it portable to non-glibc systems, that follow the XSI variant instead of the GNU specific one that gets in place when _GNU_SOURCE is defined. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-c1gn8x978qfop65m510wy43o@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> [ Updated to have include/linux/string.h too ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-15trace-cmd: Update FSF address in COPYING.LIBSteven Rostedt (Red Hat)1-1/+1
FSF has moved, update the COPYING.LIB file. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-15trace-cmd: Free debug_str on error exit in tracecmd_find_tracing_dir()Steven Rostedt (Red Hat)1-0/+1
On failing to mount the debugfs, free the debug_str before exiting the function. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-15trace-cmd: Fix file pointer leak on error exit of tracecmd_find_tracing_dir()Steven Rostedt (Red Hat)1-1/+3
If the strdup() fails to allocate, we exit tracecmd_find_tracing_dir() without closing the file descriptor just opened. Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-01trace-cmd list: Fix the error message to show the wrong optionSteven Rostedt (Red Hat)1-1/+1
The index uesd optind instead of 'i' returning some random char. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-01trace-cmd msg: Add msg_write() helper for msg_do_write_check()Steven Rostedt (Red Hat)1-21/+15
As the special cases in msg_do_write_check() do basically the same thing, add a helper function to be called by them instead. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-01trace-cmd msg: Remove hook for telling trace-msg.c about debuggingSteven Rostedt (Red Hat)4-19/+2
Now that debug is a global variable, there needs no function hook to tell trace-msg.c that we are in debugging mode. Just have trace-msg.c read the debug variable to know what to do. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-01tracecmd list: Add --debug optionSteven Rostedt (Red Hat)1-0/+7
Allow to debug list for agent reading. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd: Make debug a global variableSteven Rostedt (Red Hat)5-4/+4
If one application enables debugging, have all files see it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd msg: Do not perform read when expecting no dataSteven Rostedt (Red Hat)1-2/+2
If the size of a read is zero, do not perform the read. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd msg: Consolidate logic of allocating reads of RINIT and SENDMETASteven Rostedt (Red Hat)1-24/+24
As the logic of allocating RINIT and SENDMETA on read is the same except for sizes and where to store the dynamic data, create a helper funtion that performs the algorithm for both of them. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd msg: Rewrote a lot of code to be more flexible in transfersSteven Rostedt (Red Hat)1-240/+214
Cleaned up a lot of trace-msg.c to not be fixed in the sizes. Able to allocate only what is needed and not to be making allocation when not needed. Also shortened a lot of local macro names as TRACECMD doesn't need to be specified when not exported for other files to share. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Simplify adding of client_pidsSteven Rostedt (Red Hat)1-14/+4
Now that we leave holes in the client_pids array, we can remove the complex logic around allocating client_pids in blocks. Just use realloc each time, as it only grows the array, and we never shrink it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Free temp files in put_together_file()Steven Rostedt (Red Hat)1-6/+5
The temp files used in put_together_file() are only used within that function. They need to be freed before leaving that function. Funny enough, they are freed on failure. Since the same allocations must be freed on failure as on success, have them use the same return path. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Free pid_list in destroy_all_readers()Steven Rostedt (Red Hat)1-0/+2
valgrind showed that pid_list created by create_all_readers() was never freed. The obvious place to free it is in destroy_all_readers(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Reuse slots in client_pid listSteven Rostedt (Red Hat)1-20/+34
Instead of moving around the pids in the pid list, just leave a hole. And have the next allocation use it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Do not clean up in signal handlerSteven Rostedt (Red Hat)1-4/+11
Doing a memmove in the signal handler is racy with the updates of the main process. Especially if it does a realloc, and the memory moves. Do the clean up from the main process instead checking for EINTR in errno. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd listen: Make sure plog() messages get to consoleSteven Rostedt (Red Hat)1-0/+2
In case trace-cmd seg-faults right after plog(), plog() must be flush the message to its destination before it returns, otherwise, the message could be lost. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-30trace-cmd: Add page_map for entire fileSteven Rostedt1-17/+145
Add page mapping infrastructure between pages and the file. This will allow for the entire file to be mapped, or at least much more than just a page. If the mmapping fails, a smaller mapping (of a power of 2 less, or half) will be tried. This will continue till the mapping is the size of a page, and if that fails then the entire report will fail (as it would now). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-28trace-cmd: Documentation: ignore all man sectionsLuiz Capitulino1-1/+1
Today, we only ignore section 1. But we also have a section 5 man page. Link: http://lkml.kernel.org/r/20161007130412.12a445e0@redhat.com Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-28trace-cmd record: refactor set_mask()Luiz Capitulino2-21/+34
This commit does the following: 1. Move the code that treats "-M -1" out of set_mask() 2. Drop uneeded checks from set_mask() 3. Make instance->cpumask point to dynamic memory This is a preparation for supporting the "--cpu-list" option in the next commit. Link: http://lkml.kernel.org/r/1475858831-32687-3-git-send-email-lcapitulino@redhat.com Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-28cpu.h: use standard types instead of glib'sLuiz Capitulino1-22/+25
Future commits will introduce standard C code that wants to use cpu.h. Let's convert cpu.h to standard types. I'm choosing not to change the gui code that uses cpu.h though. I think that in all platforms where glib is supported, guint64 should always be uint64_t and guint should always be unsigned int. Link: http://lkml.kernel.org/r/1475858831-32687-2-git-send-email-lcapitulino@redhat.com Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-20trace-view: Place focus back into search box after searchSteven Rostedt (Red Hat)1-0/+2
When searching the tree rows, after an item is found, it would be nice to repeat the search with a keyboard instead of having to move the mouse back to the entry and selecting again. Instead, have the focus come back to the search entry box and allow the search to happen again with just hitting "enter". Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-05kernelshark: Add infrastructure to allow kernelshark to have pluginsSteven Rostedt (Red Hat)2-1/+94
Add a -p plugin command line option for kernelshark to accept a plugin that can modify how kernelshark works. This is just adds a loader, currently nothing uses it yet. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-05trace-graph: Show events missed in cpu plotSteven Rostedt (Red Hat)1-4/+13
If events were dropped, when hovering over the CPU plot, show that events were missed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-03trace-graph: Do not show 'interrupts' if no interrupt event was addedSteven Rostedt (Red Hat)3-1/+10
Since showing interrupts for when events are in interrupts can cause the task plots to be crazy if the interrupt events are not traced, do not do the "in interrupt" notation unless interrupts were traced. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-10-03kernelshark: Fix null pointer when next record does not existSteven Rostedt (Red Hat)1-1/+4
When testing if the plot is in irq context or not, it looks at the current record as well as the next record to see the context. Unfortunately, if the next record does not exist (null is returned) it would cause a crash. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-15trace-cmd: record crashes if -f is used before -e event.Daniel Bristot de Oliveira1-1/+1
The trace-cmd record command is crashing if a -f filter is used before a -e event. The usage a -f before a -e is a command line error, and trace-cmd record detects this error by checking if the last_event pointer is NULL. However, the last_event is not initialized as NULL and this command line error is not detected. Then, the last_event is used to save the filter options and this causes a segmentation fault because last_event was not initialized yet. This problem is fixed by initializing last_event as NULL. How-to reproduce: # trace-cmd record -f foo Segmentation fault Expected output: # trace-cmd record -f foo filter must come after event Link: http://lkml.kernel.org/r/894eb6c8a5665fba64811395e0d1204e201f4992.1437414265.git.bristot@redhat.com Tested-by: John Kacur <jkacur@redhat.com> Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-12event-parse: Add filter on task CPU idSteven Rostedt (Red Hat)1-3/+15
Add a 'CPU' special field to allow the filter in trace-cmd report to filter on the task's CPU. By adding a special field 'CPU' (all caps) the user can now filter out tasks based on which CPU they are on. This is useful when filtering out (or in) a bunch of threads. -F 'CPU == 0' Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-12tools lib traceevent: Do not reassign parg after collapse_tree()Steven Rostedt1-2/+2
At the end of process_filter(), collapse_tree() was changed to update the parg parameter, but the reassignment after the call wasn't removed. What happens is that the "current_op" gets modified and freed and parg is assigned to the new allocated argument. But after the call to collapse_tree(), parg is assigned again to the just freed "current_op", and this causes the tool to crash. The current_op variable must also be assigned to NULL in case of error, otherwise it will cause it to be free()ed twice. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: stable@vger.kernel.org # 3.14+ Fixes: 42d6194d133c ("tools lib traceevent: Refactor process_filter()") Link: http://lkml.kernel.org/r/20160511150936.678c18a1@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-12trace-cmd: Use tracecmd_peek_next_data() in fgraph_ent_handlerNamhyung Kim1-2/+2
When a task was migrated to other cpu in the middle of a function, the fgraph_exit record will be in a different cpu than the enter record. But currently fgraph_ent_handler() only peeks at the same cpu so it could read an incorrect record. For example, please see following raw records: bash-10478 [007] 73.454273: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [000] 73.454650: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x111a37483c rettime=0x111a3d0285 overrun=0x0 depth=0 bash-10478 [000] 74.456383: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [000] 74.456655: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x1155f24337 rettime=0x1155f66559 overrun=0x0 depth=0 bash-10478 [000] 75.458517: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [001] 75.458849: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x1191ad9de0 rettime=0x1191b2a6aa overrun=0x0 depth=0 bash-10478 [001] 76.460482: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [000] 76.460679: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x11cd6662b4 rettime=0x11cd695e03 overrun=0x0 depth=0 bash-10478 [000] 77.462334: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [004] 77.462564: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x12091d71c4 rettime=0x120920e977 overrun=0x0 depth=0 bash-10478 [004] 78.464315: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [001] 78.464644: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x1244d674de rettime=0x1244db7329 overrun=0x0 depth=0 bash-10478 [001] 79.466018: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [004] 79.466326: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x12808b3940 rettime=0x12808fe819 overrun=0x0 depth=0 bash-10478 [004] 80.468005: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [002] 80.468291: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x12bc44551f rettime=0x12bc48ac9a overrun=0x0 depth=0 bash-10478 [002] 81.469718: funcgraph_entry: func=0xffffffff8123bf90 depth=0 bash-10478 [007] 81.470088: funcgraph_exit: func=0xffffffff8123bf90 calltime=0x12f7f945b8 rettime=0x12f7fee028 overrun=0x0 depth=0 The first entry was call to cma_alloc function, it was on cpu 7 but the task was migrated to cpu 0 before returning from the function. Currently trace-cmd shows like below: bash-10478 [007] 73.454273: funcgraph_entry: ! 367.216 us | cma_alloc(); bash-10478 [000] 73.454650: funcgraph_exit: ! 375.369 us | } bash-10478 [000] 74.456383: funcgraph_entry: ! 270.882 us | cma_alloc(); bash-10478 [000] 75.458517: funcgraph_entry: ! 195.407 us | cma_alloc(); bash-10478 [001] 75.458849: funcgraph_exit: ! 329.930 us | } bash-10478 [001] 76.460482: funcgraph_entry: ! 327.243 us | cma_alloc(); bash-10478 [000] 77.462334: funcgraph_entry: ! 293.465 us | cma_alloc(); bash-10478 [004] 77.462564: funcgraph_exit: ! 227.251 us | } bash-10478 [004] 78.464315: funcgraph_entry: ! 306.905 us | cma_alloc(); bash-10478 [001] 79.466018: funcgraph_entry: ! 303.196 us | cma_alloc(); bash-10478 [004] 80.468005: funcgraph_entry: | cma_alloc() { bash-10478 [002] 80.468291: funcgraph_exit: ! 284.539 us | } bash-10478 [002] 81.469718: funcgraph_entry: ! 323.215 us | cma_alloc(); This is because the first funcgraph_entry on cpu 7 matched to the last funcgraph_exit on cpu 7. And second funcgraph_exit on cpu 0 was shown alone. We need to match record from all cpu rather than the same cpu. In this case, entry on cpu 7 should be paired with exit on cpu 0. With this patch, the output look like below: bash-10478 [007] 73.454273: funcgraph_entry: ! 375.369 us | cma_alloc(); bash-10478 [000] 74.456383: funcgraph_entry: ! 270.882 us | cma_alloc(); bash-10478 [000] 75.458517: funcgraph_entry: ! 329.930 us | cma_alloc(); bash-10478 [001] 76.460482: funcgraph_entry: ! 195.407 us | cma_alloc(); bash-10478 [000] 77.462334: funcgraph_entry: ! 227.251 us | cma_alloc(); bash-10478 [004] 78.464315: funcgraph_entry: ! 327.243 us | cma_alloc(); bash-10478 [001] 79.466018: funcgraph_entry: ! 306.905 us | cma_alloc(); bash-10478 [004] 80.468005: funcgraph_entry: ! 284.539 us | cma_alloc(); bash-10478 [002] 81.469718: funcgraph_entry: ! 367.216 us | cma_alloc(); Maybe we can separate enter and exit if they happened on different cpu. Anyway the time duration has correct value now. Link: http://lkml.kernel.org/r/20160708055612.32221-2-namhyung@gmail.com Reported-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-11trace-cmd: Consolidate tracecmd_{read,peak}_next_data()Steven Rostedt (Red Hat)1-24/+7
Now that there's a tracecmd_peak_next_data() that is a subset of the functionality of tracecmd_read_next_data(), have tracecmd_read_next_data() call tracecmd_peak_next_data() and remove the duplicate code. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-11trace-cmd: Introduce tracecmd_peek_next_data()Namhyung Kim2-0/+46
The tracecmd_peek_next_data() is similar to tracecmd_read_next_data() but it doesn't consume the record. Link: http://lkml.kernel.org/r/20160708055612.32221-1-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-01trace-cmd: Add more SVM exit reasonsJan Kiszka1-1/+20
Exceptions require individual decoding (only feasible intercepts listed), XSETBV was missing and the AVIC brought in two new exit codes. Link: http://lkml.kernel.org/r/5741D822.3030203@web.de Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-07-01trace-cmd: Fix reporting of unknown SVM exit reasonsJan Kiszka1-1/+1
On AMD, exist code -1 is also a possible value, but we use it for terminating the list of known exit reasons. This leads to EXIT_ERR being reported for unkown ones. Fix this by using an NULL string pointer as terminal. Link: http://lkml.kernel.org/r/5741D817.3070902@web.de Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-06-17trace-cmd record: add --max-graph-depth optionOmar Sandoval3-13/+45
This is exposed in debugfs but there's no quick way to set it with trace-cmd. While we're adding support for this, fix --profile so it sets max_graph_depth back to whatever it was before. Link: http://lkml.kernel.org/r/52d19bb3c0daf4d03db68da438c605b318ca41a8.1466021761.git.osandov@fb.com Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-04-26trace-cmd record: Fix `const` placementEric Engestrom1-1/+1
In `const char const * files[]`, both `const` refer to `char`. Moving the second one after the `*` makes the pointer const as well, which is probably what was intended. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-23tools lib traceevent: Remove redundant CPU outputSteven Rostedt1-3/+1
Commit 8533bda27f64 "tools lib traceevent: Split pevent_print_event() into specific functionality functions" Broke apart the function pevent_print_event() into three functions. The first function prints the comm, pid and CPU, the second prints the timestamp. But that commit added the printing of the CPU in the timestamp function, which now causes pevent_print_event() to duplicate the CPU output. Remove the redundant printing of the record's CPU from the timestamp function. Link: http://lkml.kernel.org/r/20160323101628.459375d2@gandalf.local.home Fixes: 8533bda27f64 "tools lib traceevent: Split pevent_print_event() into specific functionality functions" Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-22trace-cmd: Always use /var/run and /var/libSteven Rostedt (Red Hat)1-7/+1
Looking at documentation on the Internet, it seems that even if a tool is installed in /usr/local, it still should be using /var/run and /var/lib, as those are not places that will get overrided by upgrades, but all versions of trace-cmd should know about it. I still keep it dynamic for installing in $HOME, as that may not be done by a administrative user. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-22trace-cmd listen: Change install location to handle /usr/localSteven Rostedt (Red Hat)2-2/+19
If prefix is "/usr" then use the "/var" directory, but for everything else install in "$(prefix)/var". Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-22trace-cmd listen: Add a pid file when in daemon modeSteven Rostedt (Red Hat)1-0/+53
When trace-cmd listen is started in daemon mode, create the file /var/run/trace-cmd-net.pid that holds the pid of the daemon. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd: Add debug option to tell msg protocol not to timeoutSteven Rostedt (Red Hat)4-1/+26
In order to debug the message protocol, we do not want to time out, as we need to run gdb on the client and server, and timeouts kill the connections we want to debug. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd: Make msgcpy() and optcpy() check for sizeSteven Rostedt (Red Hat)1-2/+10
Have msgcpy() and optcpy() test the offset + buflen to see if it would overwrite the size of the msg or opt. If so, return -ENIVAL. The checking of this return value still needs to be done, but at least we wont be accidentally overwriting the memory. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd: Replace bufcpy() with msgcpy() and optcpy()Steven Rostedt (Red Hat)1-6/+13
The bufcpy() wrapper to memcpy() is not very useful except that it may save on a typecast. Create a msgcpy() and optcpy() to use instead that is type safe and also allows for checking of memory size overflows in the future. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd/msg: Use poll(2) to wait for a messageYoshihiro YUNOMAE1-6/+36
Use poll(2) to wait for a message. If a client/server cannot send a message for any reasons, the current server/client will wait in a blocking read operation. So, we use poll(2) for avoiding remaining in a blocking state. Changes in V4: Change the argument of tracecmd_msg_recv_wait() Fix some typos Link: http://lkml.kernel.org/r/20140711005829.25516.75538.stgit@yuno-kbuild.novalocal Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd listen: Update the V2 protocol to handle old and newSteven Rostedt (Red Hat)3-23/+71
Change the protocol slightly where V1 will fail right away without creating a blank trace.dat file by appending '-1' to the V2 name. The old trace-cmd listen will see that as a negative CPU count and bail. Also change the hand shake a bit such that if we go to a V3, a V2 server could just let the newer trace-cmd client know what version it can support. Here's the update: <server> <client> listen to socket fd connect to socket fd accept the client send "tracecmd" +------------> receive "tracecmd" check "tracecmd" * send "-1V2\0" * try_again: * receive "-1V2" <------------+ * check "-1V2" * if (!"-1V2") { * if (memcmp("-1V",3)) * error(); * send "V2\0" * goto try_again; * } * send "V2" * +---------------> receive "V2" * check "V2" * send "<MAGIC_NUMBER>\00" as the v2 protocol read "<MAGIC_NUMBER>\00" * send "OK" * +---------------> receive "OK" * check "OK" send cpus,pagesize,option(MSG_TINIT) receive MSG_TINIT <-------+ print "cpus=XXX" print "pagesize=XXX" understand option send port_array +--MSG_RINIT-> receive MSG_RINIT understand port_array send meta data(MSG_SENDMETA) receive MSG_SENDMETA <----+ record meta data (snip) send a message to finish sending meta data | (MSG_FINMETA) receive MSG_FINMETA <-----+ read block --- start sending trace data on child processes --- --- When client finishes sending trace data --- send MSG_CLOSE receive MSG_CLOSE <-------+ close(socket fd) close(socket fd) The '*' represents what was updated. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd/listen: Apply the trace-msg protocol for communication between a ↵Yoshihiro YUNOMAE7-68/+883
server and clients Apply trace-msg protocol for communication between a server and clients. Currently, trace-listen(server) and trace-record -N(client) operate as follows: <server> <client> listen to socket fd connect to socket fd accept the client send "tracecmd" +------------> receive "tracecmd" check "tracecmd" send cpus receive cpus <------------+ print "cpus=XXX" send pagesize | receive pagesize <--------+ print "pagesize=XXX" send option | receive option <----------+ understand option send port_array +------------> receive port_array understand port_array send meta data receive meta data <-------+ record meta data (snip) read block --- start sending trace data on child processes --- --- When client finishes sending trace data --- close(socket fd) read size = 0 close(socket fd) All messages are unstructured character strings, so server(client) using the protocol must parse the unstructured messages. Since it is hard to add complex contents in the protocol, structured binary message trace-msg is introduced as the communication protocol. By applying this patch, server and client operate as follows: <server> <client> listen to socket fd connect to socket fd accept the client send "tracecmd" +------------> receive "tracecmd" check "tracecmd" send "V2\0<MAGIC_NUMBER>\00" as the v2 protocol receive "V2" <------------+ check "V2" read "<MAGIC_NUMBER>\00" send "V2" +---------------> receive "V2" check "V2" send cpus,pagesize,option(MSG_TINIT) receive MSG_TINIT <-------+ print "cpus=XXX" print "pagesize=XXX" understand option send port_array +--MSG_RINIT-> receive MSG_RINIT understand port_array send meta data(MSG_SENDMETA) receive MSG_SENDMETA <----+ record meta data (snip) send a message to finish sending meta data | (MSG_FINMETA) receive MSG_FINMETA <-----+ read block --- start sending trace data on child processes --- --- When client finishes sending trace data --- send MSG_CLOSE receive MSG_CLOSE <-------+ close(socket fd) close(socket fd) By introducing the v2 protocol, after the client checks "tracecmd", the client will send "V2\0<MAGIC_NUMBER>\00\0". This complex message is used when the new client tries to connect to the old server. The new client wants to check whether the reply message from the server is "V2" or not. However, the old server does not respond to the client before receiving cpu numbers, page size, and options. Each message is separated with "\0" in the old server, so the client send "V2" as cpu numbers, "<MAGIC_NUMBER>" as page size, and "0" as no options. On the other hands, the old server will understand the messages as cpus=0, pagesize=<MAGIC_NUMBER>, and options=0, and then the server will send the message "\0" as port numbers. Then, the message which the client receives is not "V2" but "\0", so the client will reconnect to the old server as the v1 protocol. <How to test> [1] Backward compatability checks We need to test backward compatability of this patch for old trace-cmds(client/server). So, this patch was tested for [2] command checks in following 3 types: <client> <server> new old old new new new [2] Command checks - server (common) # trace-cmd listen -p 12345 1) record - client # trace-cmd record -e sched -N <server IP>:12345 ^C 2) record + multiple buffers - client # trace-cmd record -B foo -e sched -N <server IP>:12345 ^C 3) extract - client # ./trace-cmd start -e sched # sleep 5 # ./trace-cmd extract -N <server IP>:12345 4) extract + snapshot - client # ./trace-cmd start -e sched # sleep 5 # ./trace-cmd snapshot -s # ./trace-cmd extract -N <server IP>:12345 -s Changes in V4: Fix some typos, cleanups and rebase for current trace-cmd-v2.4 Change the argument of tracecmd_msg_recv() Changes in V3: Change the license of trace-msg.c to LGPL v2.1 Changes in V2: Regacy porotocol support in order to keep backward compatibility Link: http://lkml.kernel.org/r/20140711005826.25516.77711.stgit@yuno-kbuild.novalocal Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd: Keep default bash completion to list filesPeter Xu1-2/+3
This will keep trace-cmd default completion behave like before. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21trace-cmd: Add bash completion for "-{e|p|l|n|g}"Peter Xu1-9/+46
"-e", "-p" and "-{l|n|g}" are frequently used parameters in many sub-commands, adding auto-completion support for them. It may be very slow when triggering "-{l|n|g}" auto completion. However, it's better than nothing. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-21kernelshark: Handle freeing of int arraysSteven Rostedt (Red Hat)1-9/+11
Having the hard irq integer arrays be set to null_int_array requires that they are not freed with the normal free() function, but needs to check that they have been allocated and does not equal to the null_int_array variable. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-14kernelshark: Have irq event arrays point to other than NULLSteven Rostedt (Red Hat)1-0/+10
If there are no irq events, the task plots will crash as it will try to dereference the irq array, which would still be NULL. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-10trace-cmd: Install trace-cmd.bash when installingPeter Xu1-1/+6
Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-10trace-cmd,bash: Add auto-complete for bashPeter Xu1-0/+13
This is the most simplified version. Only pop up sub-cmds and nothing else. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-01trace-cmd report: Add --ts-diff to show the delta between timestampsSteven Rostedt (Red Hat)3-2/+37
If --ts-diff is added to trace-cmd report, it will show the delta between events. It doesn't matter which CPUs they are on. In case of filtering, the delta is still only between the visible events. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-01tools lib traceevent: Split pevent_print_event() into specific functionality ↵Steven Rostedt2-32/+117
functions Currently there's a single function that is used to display a record's data in human readable format. That's pevent_print_event(). Unfortunately, this gives little room for adding other output within the line without updating that function call. I've decided to split that function into 3 parts. pevent_print_event_task() which prints the task comm, pid and the CPU pevent_print_event_time() which outputs the record's timestamp pevent_print_event_data() which outputs the rest of the event data. pevent_print_event() now simply calls these three functions. To save time from doing the search for event from the record's type, I created a new helper function called pevent_find_event_by_record(), which returns the record's event, and this event has to be passed to the above functions. Link: http://lkml.kernel.org/r/20160229090128.43a56704@gandalf.local.home Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-01tools lib traceevent: Add '~' operation within arg_num_eval()Steven Rostedt1-0/+6
When evaluating values for print flags, if the value included a '~' operator, the parsing would fail. This broke kmalloc's parsing of: __print_flags(REC->gfp_flags, "|", {(unsigned long)((((((( gfp_t)(0x400000u|0x2000000u)) | (( gfp_t)0x40u) | (( gfp_t)0x80u) | (( gfp_t)0x20000u)) | (( gfp_t)0x02u)) | (( gfp_t)0x08u)) | (( gfp_t)0x4000u) | (( gfp_t)0x10000u) | (( gfp_t)0x1000u) | (( gfp_t)0x200u)) & ~(( gfp_t)0x2000000u)) ^ | here Link: http://lkml.kernel.org/r/20160226181328.22f47129@gandalf.local.home Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-01tools lib traceevent: Implement '%' operationDaniel Bristot de Oliveira1-0/+4
The operation '%' is not implemented on event-parse.c, causing an error when parsing events with '%' the operation in its printk format. For example, # perf record -e sched:sched_deadline_yield ~/yield-test Warning: [sched:sched_deadline_yield] unknown op '%' .... # perf script Warning: [sched:sched_deadline_yield] unknown op '%' test 1641 [006] 3364.109319: sched:sched_deadline_yield: \ [FAILED TO PARSE] now=3364109314595 \ deadline=3364139295135 runtime=19975597 This patch implements the '%' operation. With this patch, we see the correct output: # perf record -e sched:sched_deadline_yield ~/yield-test No Warning # perf script yield-test 4005 [001] 4623.650978: sched:sched_deadline_yield: \ now=4623.650974050 \ deadline=4623.680957364 remaining_runtime=19979611 Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: Juri Lelli <juri.lelli@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-rt-users <linux-rt-users@vger.kernel.org> Link: http://lkml.kernel.org/r/5c96a395c56cea6d3d13d949051bdece86cc26e0.1456157869.git.bristot@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd profile: Handle NULL case in handle_fgraph_exit_event()Steven Rostedt (Red Hat)1-0/+2
If there's no memory available, handle_end_event() will return a NULL task, which needs to be checked before it is dereferenced. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd profile: Fix error checking of find_and_update_start()Steven Rostedt (Red Hat)1-5/+1
Commit 6fdff2ae98a0 "trace-cmd profiler: Removed malloc_or_die()" was a bit too aggressive in having failed mallocs exit out of called functions where it returned NULL when it should not have, which caused an segfault. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd: Filter out specific pidsJosef Bacik2-9/+36
Sometimes it is a good idea to filter out events from the recording processes and even other pids, for example an external app that links against libtracecmd that watches syscalls probably doesn't want its own syscalls showing up in the events. So add the ability to filter _out_ certain pids for the events that are enabled. The recorder threads will add their pids to this list, but they are only filtered if the library consumer filters out a pid or if the trace-cmd record user tries to filter anything out. Link: http://lkml.kernel.org/r/1449248618-30556-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd: Quiet some output when using libtracecmdJosef Bacik2-6/+1
If you link against libtracecmd you get a few extraneous warnings and printf's that aren't related to your tool. So by default make the path to the events you are tracing use pr_stat() so if it's not defined we don't get the output, and make the weak warning() do nothing by default. The trace-cmd stuff has this defined so it'll continue to work normally, it just won't be noisy for consumers of libtracecmd. Link: http://lkml.kernel.org/r/1449243450-4280-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd: Don't call free on tracing and path more than onceJohn Kacur1-2/+2
In version trace-cmd-stable-v2.2 it is possible to call free on tracing and path more than once. Ensure this only happens once by moving this block to after the call to out_free Link: http://lkml.kernel.org/r/alpine.LFD.2.20.1512032331580.20385@riemann Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd report: Add --ts2secs to convert cycles into secondsSteven Rostedt (Red Hat)5-1/+67
When using clocks such as x86-tsc, where the clock frequency is known, the user can convert the timestamps into readable seconds, with resolution down to nanoseconds. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd record: Add --ts-offset for timestamp of eventsSteven Rostedt (Red Hat)4-6/+52
Add an option to allow users to add a timestamp offset to all events. This is useful when wanting to merge the resulting trace.dat file with another trace.dat file where the timestamps are shifted by a given offset. Specifically for virtual machines, where the host and guest have a known offset, and the recording of the host (or guest) can use this option to remove the need to add it when merging the trace.dat files together. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-23trace-cmd report: Add --ts-offset to add to timestamps of eventsSteven Rostedt (Red Hat)5-3/+48
When merging two or more data files, if the timestamp difference between them are known, add the --ts-offset option to let the user specify the offset from one data file to the next. This helps merging trace data files from hosts and guests where the timestamp offset is a known value. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-18kerenshark: Have task plots show when they are in interrupt contextSteven Rostedt (Red Hat)3-3/+187
Have the task plots display when they are in interrupt context. If two events together have their HARDIRQ flags set, then the box that fills them will be hollow. When the cursor is over that hollow box, it will display in the info box "(in interrupt)" to let users know why its hollow. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-18trace-cmd-report: Add -S option to remove softirqs from traceSteven Rostedt (Red Hat)3-3/+14
The -S option in trace-cmd report will not print events if the SOFTIRQ flag is set. It does not affect hard interrupts. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-18trace-cmd-report: Add -I option to remove interrupts from traceSteven Rostedt (Red Hat)3-5/+30
The -I option in trace-cmd report will not print events if the HARDIRQ flag is set. It does not affect softirqs. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-10event-parse: Add retrieval of preempt count and latency flagsSteven Rostedt (Red Hat)2-2/+30
Add a way to retrieve the preempt count as well as the latency flags from a pevent_record. int pevent_data_pc(pevent, record); returns the preempt count of a record. int pevent_data_flags(pevent, record); returns the latency flags for a record. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-10kernelshark: Show event dataSteven Rostedt4-0/+162
Add a display to show an events data in a popup window for the event list. Add both a normal event output and a raw event. The normal event is useful when an event has more than one line, like stack traces, as the rows still don't work quite right. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-10kernelshark: Filter out preempt from running sched switch stateSteven Rostedt1-1/+1
The task state now includes a flag for when its preempted. This causes the task plot to not denote the task was preempted (rather ironic). Mask out the bits that are still allow us to see this is TASK_RUNNING. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-10trace-cmd: Have -n add to set_graph_notrace if function_graph tracerSteven Rostedt1-8/+33
When doing function_graph tracing, have the -n not do the call trace of the listed functions, instead of just skipping the specific functions but still tracing the children of those functions. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-10kernelshark: Do not calculate the graph the first timeSteven Rostedt4-1/+14
It appears that showing the window widget calls the configure event for the graph, which does the calculation of all the events. Then in gtk_main() that is called again, with a slightly different width (perhaps the window manager changed it?). This causes the same calculations to happen again. When it takes 15 seconds (or more) to draw the graph due to millions of events, doubling the time is quite annoying. Add a flag to not draw the events the first time through. Then draw them from then on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09kernelshark: Pass the calculation of convert_time_to_x()Steven Rostedt1-19/+19
Instead of calculating the resolution of time vs pixels several times, do it in draw_plot() and pass it to the box and line. This also fixes the "scattered" lines when events overlap. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09kernelshark: Don't draw overlapping event linesSteven Rostedt2-1/+21
When drawing the graph, if the resolution is so low that more than one event are on the same pixels, don't bother drawing the lines. This is a 30% speed up. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09kernelshark: Time the drawing of the graphSteven Rostedt1-0/+14
In order to find ways to optimize the drawing of the graph when there are millions of events, time how long it takes to draw. If TIME_DRAW is set then print the result. This may later turn into a debug option as well. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09trace-graph: Have debug resolution 16 digitsSteven Rostedt1-1/+1
Change the debug output of the resolution to 16 digits instead of the default of 8, as most of the time it is smaller than 8 decimal places. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09kernelshark: Add event and box info struct to plot structSteven Rostedt5-23/+25
Instead of passing in an info structure to the plot_event() code, have the structure part of the plot structure itself. Then it can have static data across calls. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09kernelshark: Clean up some of the code warningsSteven Rostedt6-42/+16
There were several code warnings while compiling. Clean most of them up. Some were not cleaned up because the unused code is there as a place holder for future development. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09irq_poll: make blk-iopoll available outside the block layerChristoph Hellwig1-1/+1
The new name is irq_poll as iopoll is already taken. Better suggestions welcome. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Add checks for returned EVENT_ERROR typeDean Nelson1-0/+9
Running the following perf-stat command on an arm64 system produces the following result... [root@aarch64 ~]# perf stat -e kmem:mm_page_alloc -a sleep 1 Warning: [kmem:mm_page_alloc] function sizeof not defined Warning: Error: expected type 4 but read 0 Segmentation fault [root@aarch64 ~]# The second warning was a result of the first warning not stopping processing after it detected the issue. That is, code that found the issue reported the first problem, but because it did not exit out of the functions smoothly, it caused the other warning to appear and not only that, it later caused the SIGSEGV. Signed-off-by: Dean Nelson <dnelson@redhat.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20150820151632.13927.13791.email-sent-by-dnelson@teal Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit ↵Steven Rostedt1-3/+2
machines When a long value is read on 32 bit machines for 64 bit output, the parsing needs to change "%lu" into "%llu", as the value is read natively. Unfortunately, if "%llu" is already there, the code will add another "l" to it and fail to parse it properly. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20151116172516.4b79b109@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Fix string handling in heterogeneous arch environmentsKapileshwar Singh1-3/+20
When a trace recorded on a 32-bit device is processed with a 64-bit binary, the higher 32-bits of the address need to ignored. The lack of this results in the output of the 64-bit pointer value to the trace as the 32-bit address lookup fails in find_printk(). Before: burn-1778 [003] 548.600305: bputs: 0xc0046db2s: 2cec5c058d98c After: burn-1778 [003] 548.600305: bputs: 0xc0046db2s: RT throttling activated The problem occurs in PRINT_FIELD when the field is recognized as a pointer to a string (of the type const char *) Heterogeneous architectures cases below can arise and should be handled: * Traces recorded using 32-bit addresses processed on a 64-bit machine * Traces recorded using 64-bit addresses processed on a 32-bit machine Reported-by: Juri Lelli <juri.lelli@arm.com> Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: David Ahern <dsahern@gmail.com> Cc: Javi Merino <javi.merino@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/1442928123-13824-1-git-send-email-kapileshwar.singh@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Support %ps/%pSScott Wood1-2/+2
Commits such as 65dd297ac25565 ("xfs: %pF is only for function pointers") caused a regression because pretty_print() didn't support %ps/%pS. The current %pf/%pF implementation in pretty_print() is what %ps/%pS is supposed to do, so use the same code for %ps/%pS. Addressing the incorrect %pf/%pF implementation is beyond the scope of this patch. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Dave Chinner <david@fromorbit.com> Link: http://lkml.kernel.org/r/20150831211637.GA12848@home.buserror.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Factor out and export print_event_field[s]()Namhyung Kim2-61/+72
The print_event_field() and print_event_fields() functions print basic information of a given field or event without the print format. They'll be used by dynamic sort keys later. Committer note: Rename it to pevent_print_field[s]() to get proper namespacing, as discussed with Steven Rostedt. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1450876121-22494-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Support function __get_dynamic_array_lenHe Kuang2-2/+55
Support helper function __get_dynamic_array_len() in libtraceevent, this function is used accompany with __print_array() or __print_hex(), but currently it is not an available function in the function list of process_function(). The total allocated length of the dynamic array is embedded in the top half of __data_loc_##item field. This patch adds new arg type PRINT_DYNAMIC_ARRAY_LEN to return the length to eval_num_arg(), Signed-off-by: He Kuang <hekuang@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1440822125-52691-32-git-send-email-wangnan0@huawei.com Signed-off-by: Wang Nan <wangnan0@huawei.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-02-09tools lib traceevent: Allow setting an alternative symbol resolverArnaldo Carvalho de Melo2-1/+75
The perf tools have a symbol resolver that includes solving kernel symbols using either kallsyms or ELF symtabs, and it also is using libtraceevent to format the trace events fields, including via subsystem specific plugins, like the "timer" one. To solve fields like "timer:hrtimer_start"'s "function", libtraceevent needs a way to map from its value to a function name and addr. This patch provides a way for tools that already have symbol resolving facilities to ask libtraceevent to use it when needing to resolve kernel symbols. Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: David Ahern <dsahern@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-fdx1fazols17w5py26ia3bwh@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-12-07trace-cmd: If event-fork option exists use it instead of PTRACESteven Rostedt (Red Hat)1-4/+22
If the event-fork option exists, then the kernel can handle children of filtered event tasks, and trace-cmd does not need to play with ptrace to monitor every time a task forks. This also allows the use of tracing children of tasks being filtered with just -P. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-12-07trace-cmd: Use set_event_pid when availableSteven Rostedt (Red Hat)1-8/+111
The new set_event_pid file allows the use of filtering pids without needing to add to event filters directly. By adding a pid to the set_event_pid file, it will filter all events on the pids listed. It is much more efficient than the event filter files, and they can handle many more pids than the filter files can. In fact, this was tested with hackbench, and it was able to still cope. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-12-07trace-cmd: Fix trace-record.c with non ptrace compileSteven Rostedt (Red Hat)1-1/+1
Fix ptrace_wait() when NO_PTRACE=1 is defined. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-12-01trace-cmd: Truncate files when writing to themSteven Rostedt (Red Hat)1-1/+1
Some files require truncation to happen to make them do anything, like writing "" to them. For reseting the files (and writing to debugfs files in general), open with O_TRUNC, to reset them as they are opened. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-12-01trace-cmd: Never update saved files when keep is set for recordingSteven Rostedt (Red Hat)1-1/+2
If -k is set on the command line, not only do not update the reset_files list, but also do not call the update of the file even if the reset_files has something in it. This allows for reset_save_file() to be used during the parameter parsing before -k may be used. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-11-16parse-events: Fix output of %llu for 64 bit values read on 32 bit machinesSteven Rostedt (Red Hat)1-1/+1
When a long value is read on 32 bit machines for 64 bit output, the parsing needs to change "%lu" into "%llu", as the value is read natively. Unfortunately, if "%llu" is already there, the code will add another "l" to it and fail to parse it properly. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Change trace-util.c to not die on errorsSteven Rostedt (Red Hat)2-74/+113
As trace-util is more of a library type file, have its functions return error codes and not just die on error. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove malloc_or_die from trace-cmd.cSteven Rostedt (Red Hat)1-5/+11
Remove the use cases of malloc_or_die() from trace-cmd.c, but obviously we are keeping the function of malloc_or_die() itself. Use a more descriptive output when failing allocations. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd stat: Remove malloc_or_die()Steven Rostedt (Red Hat)1-3/+5
Fail with a more descriptive message when failing to allocate. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd split: Remove malloc_or_die()Steven Rostedt (Red Hat)1-6/+17
Replace malloc_or_die() with a more descriptive exit when failing an allocation. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove malloc_or_die() from trace-recorder.cSteven Rostedt (Red Hat)1-2/+2
The two places tha used malloc_or_die() already checked the return of the call and failed appropriately if it did not succeed. No need to die. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Check the return of create_instance()Steven Rostedt (Red Hat)3-0/+14
If create_instance() fails to allocate an instance, it returns NULL. Have the callers check the return of create_instance() to make sure it succeeded and report if it failed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove malloc_or_die from trace-record.cSteven Rostedt (Red Hat)1-46/+118
Instead of calling just malloc_or_die() and having a generic output for what happened on failure, die with a more appropriate message. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove malloc_or_die() form trace-read.cSteven Rostedt (Red Hat)1-13/+39
Have failed allocations specify more details to why it died than just doing a malloc_or_die(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd profiler: Removed malloc_or_die()Steven Rostedt (Red Hat)1-19/+139
Removed malloc_or_die from trace-cmd profile and have failed allocations exit gracefuly. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove die() from insufficient memory in trace-outputSteven Rostedt (Red Hat)1-20/+59
When there's not enough memory for an allocation, return an error or warn and handle it gracefully. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd: Remove malloc_or_die() and other die() from trace-input.cSteven Rostedt (Red Hat)1-10/+19
Make failure of memory allocations less extreme. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd hook: Remove malloc_or_dieSteven Rostedt (Red Hat)1-4/+8
Exit nicely if malloc fails. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-22trace-cmd listen: Remove malloc_or_dieSteven Rostedt (Red Hat)1-26/+65
Handle failure of malloc nicer than just dieing. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-17event-parse: Fix second incrementSteven Rostedt (Red Hat)1-1/+1
Chaos Chen stated that he had a bug in his code; when the usecs overrun, and 1000000 needs to be subtracted from the usecs and added to the seconds, the seconds need to be incremented not decremented. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-17trace-cmd: Leave out absolute addresses to fix bogus symbol resolutionsJan Kiszka1-2/+6
On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms. Link: http://lkml.kernel.org/r/55BB8086.9080602@siemens.com Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-17event-parse: Use USECS_PER_SEC instead of hardcoded numberSteven Rostedt (Red Hat)2-2/+4
Instead of using 1000000, define a USECS_PER_SEC macro and use that instead. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-09-17event-parse: Fix time stamp format problemChaos.Chen1-0/+5
Sometimes we may see 1234.1000000 if time resolution in usec Just fixing it from 1234.1000000 to 1235.000000 Signed-off-by: Chaos.Chen <rainboy1215@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-08-28trace-cmd: Version 2.6trace-cmd-v2.6Steven Rostedt (Red Hat)1-1/+1
2015-08-27event-parse: Allow for negative numbers in print formatSteven Rostedt (Red Hat)1-0/+1
It was reported that "%-8s" does not parse well when used in the printk format. The '-' is what is throwing it off. Allow that to be included. Reported-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-20trace-cmd: Set int_array fields to NULL if freeing from errorSteven Rostedt (Red Hat)1-0/+3
Had a bug where on error of parsing __print_array() where the fields are freed after they were allocated, but since they were not set to NULL, the freeing of the arg also tried to free the already freed fields causing a double free. Fix process_hex() while at it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-20trace-cmd/profile: Fix merging of by-comm tasks for scheduleSteven Rostedt (Red Hat)1-20/+13
The sched_switch event had the same issue as the sched_wakeup event in that the pid was used for lookups. Instead of having a separate merge matching function, use the normal lookup function, but as we do not care if the pid of the sched_switch or sched_wakeup events are different, as long as we know that they all belong to the same comm, we can ignore them. Just need to modify the search vals before doing the lookups. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13trace-cmd: Add option to group like comms for profileJosef Bacik6-6/+319
When profiling large applications that have multiple children we really want to see the profile of the app all together. Add a --by-comm option to accomplish this for profile. This merges all the events for like comms into one big chunk so we can easily see what a giant app is doing, such as HHVM. Thanks, Link: http://lkml.kernel.org/r/1432229408-1479-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> [ fixed up trace_hash ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13trace-cmd: Annotate function durations like the kernelOmar Sandoval1-2/+10
Since kernel commit, 8e1e1df29d83 ("tracing: Add additional marks to signal very large time deltas") the kernel annotates durations longer than 1000 usecs with # and longer than 1 sec with $. Update trace-cmd report to be consistent with it. Link: http://lkml.kernel.org/r/05162f43fb6322f4c46722403449ffdab134e3d2.1435170824.git.osandov@fb.com Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Provide le16toh define for older systemsArnaldo Carvalho de Melo1-2/+14
Where such macro is not present, so just copy its definition from glibc's endian.h and define it if not already. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-4j90i2na07ppidt0z6cbuxr7@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tracing: %pF is only for function pointersScott Wood1-1/+1
Use %pS for actual addresses, otherwise you'll get bad output on arches like ppc64 where %pF expects a function descriptor. Link: http://lkml.kernel.org/r/1426130037-17956-22-git-send-email-scottwood@freescale.com Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Fix build failure on 32-bit archNamhyung Kim1-1/+1
In my i386 build, it failed like this: CC event-parse.o event-parse.c: In function 'print_str_arg': event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' [-Wformat] Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Javi Merino <javi.merino@arm.com> Link: http://lkml.kernel.org/r/20150424020218.GF1905@sejong Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Add alias field to struct format_fieldJiri Olsa2-2/+5
Introduce an 'alias' field to 'struct format_field' to be able to use alternative name for the field. It is initialized with same string pointer as 'name' field. The free logic checks the 'alias' pointer being reset by user and frees it. This will be handy when converting data into CTF, where each field within event needs to have a unique name (while this is not required for tracepoint). Converter can easily assign unique name into the format_field struct. Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jeremie Galarneau <jgalar@efficios.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-qwyq8blnfkg6s5vlbrvn1en3@git.kernel.org Link: http://lkml.kernel.org/r/1429372220-6406-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Honor operator priorityNamhyung Kim1-1/+16
Currently it ignores operator priority and just sets processed args as a right operand. But it could result in priority inversion in case that the right operand is also a operator arg and its priority is lower. For example, following print format is from new kmem events. "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0) But this was treated as below: REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0) In this case, the right arg was '?' operator which has lower priority. But it just sets the whole arg so making the output confusing - page was always 0 or 1 since that's the result of logical operation. With this patch, it can handle it properly like following: ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0) Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joonsoo Kim <js1304@gmail.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/1428298576-9785-10-git-send-email-namhyung@kernel.org [ Replaced 'swap' with 'rotate' in a comment as requested by Steve and agreed by Namhyung ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Add support for __print_array()Javi Merino2-0/+101
Since 6ea22486ba46 ("tracing: Add array printing helper") trace can generate traces with variable element size arrays. Add support to parse them. Signed-off-by: Javi Merino <javi.merino@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1427195239-15730-1-git-send-email-javi.merino@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-07-13tools lib traceevent: Factor out allocating and processing argsJavi Merino1-37/+40
The sequence of allocating the print_arg field, calling process_arg() and verifying that the next event delimiter is repeated twice in process_hex() and will also be used for process_int_array(). Factor it out to a function to avoid writing the same code again and again. Signed-off-by: Javi Merino <javi.merino@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1426875176-30244-2-git-send-email-javi.merino@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd stat: Print instance namesSteven Rostedt (Red Hat)1-0/+6
If the stats are showing with an instance with a name, print the name (also add a separator between instances). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Add more debugging to see various internal ring buffer entriesSteven Rostedt (Red Hat)5-1/+137
When trace-cmd report --debug is set, show the internal ring buffer entries like time-extends and padding. This requires adding new kbuffer API to retrieve these items. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Add --debug to trace-cmd reportSteven Rostedt (Red Hat)5-3/+79
Add --debug option to trace-cmd report that enables page boundary recording as well as time stamp info to be printed. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Make trace-hist work with instancesJosef Bacik1-8/+25
If you recorded information completely in an instance then trace-hist wouldn't think your trace.dat file had any events because it didn't know about instances. Fix this. Link: http://lkml.kernel.org/r/1431113344-22579-6-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Sort the events in the profile outputJosef Bacik1-0/+4
Currently we just spit out the events as they appear in the hash, which makes it hard to tell where we are spending our time. Instead order the output by type and total time spent. So you'll get something like this syscall 1: 100000ms syscall 2: 80000ms syscall 3: 4ms func 1: 10ms func 2: 1ms instead of them all jumbled up. Link: http://lkml.kernel.org/r/1431113344-22579-5-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Don't fail build if libaudit is not installedSteven Rostedt (Red Hat)3-4/+43
Add a test compile to make sure that libaudit is installed and define NO_AUDIT if it is not. When that happens, a warning will occur in building trace_profile() saying that it will use raw syscall numbers. Doing a make NO_AUDIT=1, will surpress that warning. Also fixed the NO_PTRACE to use "override" on changing of CFLAGS as without it, it has no affect. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Lookup syscall names in profileJosef Bacik2-4/+17
When we profile syscall times we're just given the syscall number, not the name. This isn't helpful for human beings, so lookup the syscall names when we are printing out the information. This uses the audit library to get this information, I'm not married to it, but it seems that any app that does this mapping has to scrape /usr/include/asm/unistd*.h to pull out the names, so might as well just use somebody elses work. Link: http://lkml.kernel.org/r/1431113344-22579-4-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Use pr_stat for version outputJosef Bacik1-1/+1
This allows tools linking against the trace-cmd libraries to supress this output if it is not necessary for them. Link: http://lkml.kernel.org/r/1411757220-29334-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Allow python tools to supress warning() and pr_stat()Josef Bacik1-0/+30
trace-cmd has a lot of built in warning() and pr_stat() output that is noisy when you are using the python bindings. This patch provides overrides for these two functions and the ability for python scripts to optionally turn them off. With this patch I can silence all of these extraneous print messages from within my python script. Link: http://lkml.kernel.org/r/1411757074-29117-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Add helper to read *_stack ftrace eventsJosef Bacik2-0/+45
The user_stack and kernel_stack events are special in that they are dynamic arrays but aren't labeled as __data_loc like other dynamic arrays. This isn't a big deal since they look the same, they have a "caller" field which is an array of unsigned longs. This patch adds a helper to the python bindings to read these arrays in, lookup the function and append them to a python list. Link: http://lkml.kernel.org/r/1411667037-27105-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Add read_next_event to Trace python classJosef Bacik1-0/+9
I need to be able to just cycle through the events in a trace.dat file without worrying about the CPU, so add read_next_event that mirrors the other read_event* functions to call tracecmd_read_next_data. Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd split: Do not allow spliting of latency tracersSteven Rostedt (Red Hat)3-2/+15
trace-cmd split is an operation to make large data records into more manageable sized files. But for latency tracers like: trace-cmd record wakeup trace-cmd does not record any binary files, it only records the ASCII contents of the trace file that is only a snapshot of where the latency happens (which is usually rather small). trace-cmd split is made for "flight recording" (constant recording over a period of time) that can cause the file to become gigabytes in size. Splitting the ASCII text does not make any sense. That said, trace-cmd split should not segfault either when trying to split a latency trace. Instead do what trace-cmd hist does, which is to simply exit with an error message that says it does not support latency traces. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd stop, reset, restart: Add -a for all instancesHoward Cochran4-28/+118
As for extract, -a means all instances except the top one. Use -t to get the top one too. Link: http://lkml.kernel.org/r/d6cdd535ae170d4ba0f580434a51286861c75c07.1429677461.git.hcochran@kernelspring.com Signed-off-by: Howard Cochran <hcochran@kernelspring.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd extract: Add -a option for all instancesHoward Cochran4-6/+98
This option will extract all instances that currently exist in the system, including the top instance. This differs from the meaning of -a for record and stream (enable all events), which would have no purpose for extract. Such difference in meaning already exists for -s, so this seemed reasonable. Had to fix a bug in create_instance(), in which it ignored its parameter. Link: http://lkml.kernel.org/r/444ea8355d8c0013ec9d35155d4ea83ec1a7bbab.1429677461.git.hcochran@kernelspring.com Signed-off-by: Howard Cochran <hcochran@kernelspring.com> [ Fixed compile error to use different __add_all_instances() ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd extract: Add -B and -t for multiple instancesHoward Cochran2-9/+17
Add -B option to trace-cmd extract so that it can extract listed instances. As with start, stop, and reset, the top level instance is not included when any -B are given. However, -t makes it also include the top instance. As with other commands, if neither option is given, only operate on the top instance. Link: http://lkml.kernel.org/r/7b18a3f624fd1e864a86c0cee2079587953fa5ee.1429677461.git.hcochran@kernelspring.com Signed-off-by: Howard Cochran <hcochran@kernelspring.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-06-10trace-cmd: Fix stop, reset, start and stat for default instancesSteven Rostedt (Red Hat)3-7/+9
The fix to fix stop, restart, and start, broke them too for the default instance. If -t or -B were not used, then -t is to be assumed, but that was not the case, and no instance was selected. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-04-21trace-cmd: Fix multi buffers for stop, reset, and restartSteven Rostedt (Red Hat)1-17/+19
If more than one -B is specified and -t is not, one of the instances is skipped. Rewrite the code to process what list of buffers is needed after the command line has been parsed. Reported-by: Andy Martin from Lexmark, Inc. [ Howard added checking if buffer_instance exists in update_first_instance() ] Signed-off-by: Howard Cochran <hcochran@kernelspring.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-04-14trace-cmd: It's events lost not bytes lostSteven Rostedt (Red Hat)1-2/+2
Presenting trace-cmd at Linux Collaboration Summit, it was pointed out to me that I had "bytes lost" in the new format as I was saying it was events lost. Fix that. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24event-parse: Zero should not be considered "not found" in eval_flag()Steven Rostedt (Red Hat)1-5/+5
Guilherme Cox found that: There is, however, a potential bug if there is an item with code zero that is not the first one in the symbol list, since eval_flag(..) returns 0 when it doesn't find anything. That is, if you have the following enums: enum { FOO_START = 0, FOO_GO = 1, FOO_END = 2 } and then have: __print_symbolic(foo, FOO_GO, "go", FOO_START, "start", FOO_END, "end") If none of the enums are known to pevent, then eval_flag() will return zero, and it will match it to the first item in the list, which would be FOO_GO, which is not zero. Luckily, in most cases, the first element would be zero, and the parsing would match out of sheer luck. Reported-by: Guilherme Cox <cox@computer.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24scsi: add SPC-3 command definitionsHannes Reinecke1-1/+4
SPC-3 defines SERVICE ACTION IN(12), SERVICE_ACTION OUT(12), SERVICE ACTION OUT(16), and SERVICE ACTION BIDIRECTIONAL. And READ MEDIA SERIAL NUMBER has long since been deprecated. So update callers to refer to the new cdb name. Signed-off-by: Hannes Reinecke <hare@suse.de> Tested-by: Robert Elliott <elliott@hp.com> Reviewed-by: Robert Elliott <elliott@hp.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24scsi: rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16Hannes Reinecke1-2/+2
SPC-3 defines SERVICE ACTION IN(12) and SERVICE ACTION IN(16). So rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to be consistent with SPC and to allow for better distinction. Signed-off-by: Hannes Reinecke <hare@suse.de> Tested-by: Robert Elliott <elliott@hp.com> Reviewed-by: Robert Elliott <elliott@hp.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24kbuffer: Whitespace fixesSteven Rostedt (Red Hat)1-2/+2
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24tools lib traceevent: Make plugin options either string or booleanSteven Rostedt1-6/+54
When a plugin option is defined, by default it is a boolean (true or false). If the option is something else, then it needs to set its "value" field to a default string other than NULL (can be just ""). If the value is not set then the option is considered boolean, and the updating of the option value will be handled accordingly. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24event-parse: Update PEVENT_PLUGIN_UNLOADER() documentationSteven Rostedt (Red Hat)1-1/+1
The comment about PEVENT_PLUGIN_UNLOADER() was not updated when adding the pevent as a parameter. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24tools lib traceevent: Introduce trace_seq_do_fprintf functionArnaldo Carvalho de Melo2-4/+11
So that we can specify a FILE object where to direct the formatted output. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-a49bhdrx8851f04hppn8bqxq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24tools lib traceevent: Add flag to not load event pluginsSteven Rostedt (Red Hat)2-1/+8
Add a flag to pevent that will let the callers be able to set it and keep the system, and perhaps even normal plugins from being loaded. This is useful when plugins might hide certain information and seeing the raw events shows what may be going on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20140603032223.678098063@goodmis.org Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24tools lib traceevent: Add options to pluginsSteven Rostedt6-37/+244
The traceevent plugins allows developers to have their events print out information that is more advanced than what can be achieved by the trace event format files. As these plugins are used on the userspace side of the tracing tools, it is only logical that the tools should be able to produce different types of output for the events. The types of events still need to be defined by the plugins thus we need a way to pass information from the tool to the plugin to specify what type of information to be shown. Not only does the information need to be passed by the tool to plugin, but the plugin also requires a way to notify the tool of what options it can provide. This builds the plugin option infrastructure that is taken from trace-cmd that is used to allow plugins to produce different output based on the options specified by the tool. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20140603184154.0a4c031c@gandalf.local.home Signed-off-by: Jiri Olsa <jolsa@kernel.org> [ ported to trace-cmd ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24tools lib traceevent: Add destructor for format_fieldDavid Ahern2-3/+9
Move the calls that frees the resources allocated for a struct format_field to a separate routine. Signed-off-by: David Ahern <dsahern@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1426790181-19118-1-git-send-email-dsahern@gmail.com [ Split this part from a larger patch, added pevent_ prefix as requested by Steven ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24trace-cmd: remove an unused declarationJohannes Berg1-1/+0
The function tracecmd_create_buffer_recorder_pipe() is declared but not implemented. For some reason some python versions want to link it, even though it probably cannot be used in python anyway, so this is causing issues. Remove the unused declaration. Reported-by: Gil Tribush <gil.tribush@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24trace-cmd: Fix possible uninitialized variable in function_handlerSteven Rostedt (Red Hat)1-1/+1
The function handler plugin uses "index" which could possibly be uninitialized if the parent function is not found. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-03-24trace-cmd: Add plugin for tlb_flushSteven Rostedt (Red Hat)2-0/+82
The tlb_flush tracepoints uses enums that are not yet known by trace-cmd. Add a plugin to handle that. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-12trace-cmd profile: Fix spurious stacktraces from wakeup eventSteven Rostedt (Red Hat)1-1/+6
If a wakeup event occurred when a task was not "asleep", which could happen from dropped events, the wake up is ignored. But if the proxy task does not have its last-event removed, and if a stack trace occurs after the wakeup event, it will be hooked to whatever was the proxy tasks's last event. This caused the output to show spurious stack traces for various events (mostly the timer softirq). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-12trace-cmd profile: Fix hook saving from record to reportSteven Rostedt (Red Hat)2-1/+3
There was a bug when after a hook was read from the trace.dat file it would be reset by the handle->hooks instead of assigning it to the handle->hooks. There was a second bug where the hooks in trace.dat file would not be listed if there were no command line hooks presented. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-12trace-cmd profile: Add -G option to make soft and hard irqs globalSteven Rostedt (Red Hat)8-17/+41
Instead of associating interrupts to tasks, when -G is used in trace-cmd profile or trace-cmd report, the interrupts are set to act as global events. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-12trace-cmd profile: Implement global flagSteven Rostedt (Red Hat)4-18/+91
When a custom hook is created, allow the global flag to work. Implement the global tasks that can keep track of events where tasks really have no meaning, and they can be called by any task. This will work for timers. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-11trace-cmd: Version 2.6.rc1Steven Rostedt (Red Hat)1-2/+2
2015-02-11trace-cmd record: Change the status output during runsSteven Rostedt (Red Hat)2-32/+80
The output status is quite confusing. Seeing a blob like this: CPU: 0 entries: 12 overrun: 0 commit overrun: 0 bytes: 3612 oldest event ts: 49097.376154 now ts: 49097.647663 dropped events: 0 read events: 147 Is pretty much useless for most people, and even confuses some (I get confused by it sometimes). Instead, cut it down to something much easier to read. We really only care about overruns and commit overruns, but only if there are any. Have it output like his instead: CPU 2: 165358 bytes lost Where it only shows us the CPUs that lost events. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>