aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-08-19kernel-shark: Better formatting of the error messages from "Record"HEADmasterYordan Karadzhov (VMware)1-1/+2
Make the message easier to read and understand by separating the QProcess's error and the Standard error. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-19kernel-shark: Optimize the error messages when "Record" fails to startYordan Karadzhov (VMware)2-7/+9
Removing duplicate code. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-19kernel-shark: Use standart error message in KsMainWindow::_record()Yordan Karadzhov (VMware)1-3/+1
The error message is printed using the method KsMainWindow::_error(). The message itself remains unchanged. If we want to change the message, this can be done in another patch. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-19kernel-shark: Don't use pkexec when running as RootYordan Karadzhov (VMware)1-15/+32
If KernelShark GUI has been started as Root we do not need to use "pkexec" when starting the Record dialog. Note that the actual place where "pkexec" gets used is in the script "kshark-su-record". Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-19kernel-shark: Show warning message when running as RootYordan Karadzhov (VMware)2-0/+30
Running the KernelShark GUI with Root privileges is not recommended due to security reasons. The user will be allowed to continue on its own risk. Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204475 Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-19kernel-shark-qt: Fix the broken Color scheme sliderYordan Karadzhov (VMware)1-0/+1
A previous commit removed the unnecessary calls of loadColors() in KsGLWidget::paintGL(), however this has the side effect of making the Color scheme slider nonfunctional. We have to explicitly reload the color tables of the GL widget every time when the slider is moved. The bug was reported by Jake Edge in his article about KernelShark on LWN.net. Thanks Jake! Reported-by: Jake Edge <jake@edge2.net> Fixing: 3a50d107e9 ("kernel-shark: Avoid the unnecessary calls of KsGLWidget::loadColors()") Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-08-07tools lib traceevent: Fix buffer overflow in arg_evalTony Jones1-1/+1
Fix buffer overflow observed when running perf test. The overflow is when trying to evaluate "1ULL << (64 - 1)" which is resulting in -9223372036854775808 which overflows the 20 character buffer. If is possible this bug has been reported before but I still don't see any fix checked in: See: https://www.spinics.net/lists/linux-perf-users/msg07714.html Link: http://lore.kernel.org/linux-trace-devel/20190807121446.1833-1-tz.stoyanov@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204517 Reported-by: Michael Sartain <mikesart@fastmail.com> Reported-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Tony Jones <tonyj@suse.de> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a") Link: http://lkml.kernel.org/r/20190228015532.8941-1-tonyj@suse.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-08-06trace-cmd: Move kernel_stack event handler to "function" plugin.Tzvetomir Stoyanov (VMware)2-52/+41
The "kernel_stack" event handler does not depend on any trace-cmd context, it can be used aside from the application. The code is moved to libtraceevent "function" plugin. Link: http://lore.kernel.org/linux-trace-devel/20190726124308.18735-2-tz.stoyanov@gmail.com Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-08-05kernel-shark: Replace the corrupted logo and icon filesYordan Karadzhov (VMware)5-5/+5
The .svg files of the new logo and icon for KernelShark are corrupted. Looks like this happened because the original patch that added the files was trimmed because of the SMTP maximum line length limit. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
2019-07-26KernelShark: Version 1.0Steven Rostedt (VMware)1-3/+3
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-26kernel-shark: Add the new logo to the DocumentationSteven Rostedt (VMware)2-1/+2
KernelShark 1.0 has a new logo. Update the documentation to use it. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-26kernel-shark: Revert adding relative path to policy installationSteven Rostedt (VMware)1-1/+1
This reverts the change in a45ab5a44 ("kernel-shark: Remove hard-coded install paths") that removed the full path of installing org.freedesktop.kshark-record.policy to a relative path. This means if we installed in /usr/local/bin the policy still needs to go into /usr/share/polkit-1/actions/ This does not affect DESTDIR, as installing still goes in the relative path from DESTDIR for package maintainers. Link: http://lore.kernel.org/linux-trace-devel/20190725194739.140392211@goodmis.org Suggested-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-26kernel-shark: Revert adding environment variables to kshark-su-recordSteven Rostedt (VMware)1-2/+1
This reverts: 8eb0d753e ("kernel-shark: Execute kshark-record from same dir as kshark-su-record") b084eb5aa ("kernel-shark: Set the DISPLAY environment for pkexec kshark-record") As the policykit (when installed correctly), should handle both the path to the executable, as well as the DISPLAY and XAUTHORITY environment variables. Link: http://lore.kernel.org/linux-trace-devel/20190725194738.979632340@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: Allow setting of the name of Python in pkgconfigPatrick McLean1-3/+4
Some vendors use different names for Python in pkgconfig, this allows the name of the Python version in pkgconfig to differ from the Python interperter name. The default remains the Python version. Link: http://lore.kernel.org/linux-trace-devel/20190725204237.3864194-1-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: Generate proper sonamePatrick McLean1-1/+1
The previous soname patch was an earlier version that included the full path to the build output as the soname (not sure how that happened). This just uses the basename as the soname, so ld will be able to properly find the library. Link: http://lore.kernel.org/linux-trace-devel/20190725014808.3646716-1-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: In the ctracecmdgui use PyLong on Python 3Patrick McLean1-0/+9
Python 3 does not have PyInt anymore, so use the PyLong_* functions when building on Python 3. Link: http://lore.kernel.org/linux-trace-devel/20190725174138.3724131-4-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: Add missing headers to Python templatePatrick McLean2-0/+2
The templates that generate Python bindings are missing some headers that result in compile-time warnings. This adds the missing headers where needed. Link: http://lore.kernel.org/linux-trace-devel/20190725174138.3724131-3-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: Replace PyString_FromString() with PyUnicode_FromString()Steven Rostedt (VMware)1-1/+1
As PyString_FromString() is no longer available with Python 3, use PyUnicode_FromString() which is available in both Python 2 and 3. Link: http://lkml.kernel.org/r/20190725174138.3724131-2-chutzpah@gentoo.org Reported-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25trace-cmd: Fix a typo in warning messagesTzvetomir Stoyanov1-3/+3
There is a typo in few trace-cmd warning messages: "cound not" -> "could not" Link: http://lore.kernel.org/linux-trace-devel/20190725105731.28782-1-tz.stoyanov@gmail.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-25kernel-shark: Xserver, grant access to user rootTzvetomir Stoyanov1-4/+1
In order to make connections to the X server, users must be in the X server allow list. As kernelshark may run with root privileges, the user "root" must be in this list. There is such logic in kshark-su-record, but it works only for Wayland X server. Some Linux distributions use other X servers, so the logic must be executed always. It grants access to user "root" to initiate connections to the X server from the local machine. Link: http://lore.kernel.org/linux-trace-devel/20190725085355.15921-1-tz.stoyanov@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277 Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is foundSteven Rostedt1-1/+6
As we need to update both LDFLAGS and CFLAGS, move the test to see if udisc86 is installed to a variable, and then set NO_UDIS86 if it is not found. This way we do not need to test if it exists twice, nor have LDFLAGS set unconditionally. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277 Link: http://lore.kernel.org/linux-trace-devel/20190724190758.4e18498f@gandalf.local.home Reported-by: howaboutsynergy@pm.me Tested-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Handle corrupted configuration file for the Capture dialogYordan Karadzhov (VMware)1-3/+12
Error message will be printed to the console-like widget. Link: http://lore.kernel.org/linux-trace-devel/20190724154039.23705-5-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Handle errors when loading Capture configurationsYordan Karadzhov (VMware)1-4/+22
A configuration file (Json) for the Capture dialog can contain non-existing tracer plugin or events. This can happen if the configuration was exported on one machine and then imported on another. In such a case the non-existing plugin/events will be ignored and a warning message will be printed to the console-like widget. Link: http://lore.kernel.org/linux-trace-devel/20190724154039.23705-4-y.karadz@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204287 Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Allow KsCaptureControl widget to print text to the consoleYordan Karadzhov (VMware)2-0/+9
This will be used to show Warning messages. Link: http://lore.kernel.org/linux-trace-devel/20190724154039.23705-3-y.karadz@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204287 Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: kshark_import_event_filter() tolerates non-existing eventsYordan Karadzhov (VMware)2-18/+23
Instead of aborting, the function will ignore (skip) the non-existing event and will continue loading the other events in the configuration file. The return type is changed to int in order to provide information about the number of events successfully added to the filter. Link: http://lore.kernel.org/linux-trace-devel/20190724154039.23705-2-y.karadz@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204287 Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Disable Capture if trace-cmd can't functionYordan Karadzhov (VMware)1-0/+3
In the case of an error the "Capture" button of the Record dialog is disabled. Link: http://lore.kernel.org/linux-trace-devel/20190724154110.23772-1-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Set the DISPLAY environment for pkexec kshark-recordSteven Rostedt (VMware)1-1/+1
When running a fresh install, I hit this: ERROR: Capture process failed: Unknown errorqt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display. This was due to pkexec not saving the DISPLAY environment variable. To solve this, pass that variable as one of the environment variables to pkexec. Link: http://lore.kernel.org/linux-trace-devel/20190723225238.859019956@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Execute kshark-record from same dir as kshark-su-recordSteven Rostedt (VMware)1-1/+2
Do not trust the PATH environment variable (and in fact that may not even be available with the pkexec). Instead, use the same path as kshark-su-record to find kshark-record. They should always be together anyway. Link: http://lore.kernel.org/linux-trace-devel/20190723225238.701263380@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-24kernel-shark: Suppress "Root privileges are required" if already rootSteven Rostedt (VMware)1-1/+9
If the tracefs directory is configured into the kernel, and kshark-record fails to find the tracing directory, it should test if it already has root privileges (geteuid() returns zero), before posting a message "Root privileges are required" as that can confuse users. Link: http://lore.kernel.org/linux-trace-devel/20190723165935.300f58e8@gandalf.local.home Reported-by: howaboutsynergy@pm.me Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23kernel-shark: Better error message for the constructor of KsCaptureControlYordan Karadzhov (VMware)1-4/+10
The error message includes the case when the tracing directory cannot be found or mounted. Link: http://lore.kernel.org/linux-trace-devel/20190723125204.22799-3-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23kernel-shark: Make KsEventsCheckBoxWidget::removeSystem more robustYordan Karadzhov (VMware)1-3/+6
The function has to be able to handle safely the case when the Checkbox tree widget is empty or it does not contain the item to be removed. Link: http://lore.kernel.org/linux-trace-devel/20190723125204.22799-2-y.karadz@gmail.com Reported-by: howaboutsynergy <howaboutsynergy@pm.me> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277 Fixes: 4a02481fff (Remove all system=ftrace events from Record dialog) Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23kernel-shark: Get the path to trace-cmd executable from _INSTALL_PREFIXYordan Karadzhov (VMware)3-7/+18
The absolute path to the trace-cmd executable gets derived from "_INSTALL_PREFIX", and the "Record" dialog will be using its installed version. This is done because nothing guaranties that the trace-cmd executable will be presented at the time when the KernelShark package is built. The rule has one exception and this is the case when the build type is "Debug". In "Debug" mode the "Record" dialog will try to use the version of the trace-cmd executable from the build location. Link: http://lore.kernel.org/linux-trace-devel/20190723182542.1295-1-y.karadz@gmail.com Sugested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Set SONAME on shared librariesPatrick McLean1-1/+1
Currently trace-cmd installs some shared libraries, but does not set a SONAME on these. This often violates distro policies, so it should at least set something. This patch sets it to the name of the file, which is somewhat naieve, but works for many libraries. Generally it should be set to have an ABI version as the extension, so when the developer breaks ABI, they can change the soname. Link: http://lore.kernel.org/linux-trace-devel/20190720030344.1991393-5-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Install all headers needed by kernelshark to proper pathsPatrick McLean1-1/+3
The trace-cmd build system installs headers for building kernelshark, but it is missing trace-seq.h and trace-filter-hash.h. It additionally installs event-parse.h to the toplevel "trace-cmd" include directory, but the generated header includes it as "traceevent/event-parse.h" so the kernelshark build fails. This patch installs all the headers needed to build kernelshark to the appropiate directories. Link: http://lore.kernel.org/linux-trace-devel/20190720030344.1991393-4-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: No automagic dependency on udis86Patrick McLean1-0/+4
Currently if udis86 is detected on the system, trace-cmd automatically uses it. This is generally a problem for packagers since if the build machine happens to have udis86, now there is a dependency on it that may or may not be tracked. This adds a NO_UDIS86 variable that can be set by the packager to disable using udis86 completely. Link: http://lore.kernel.org/linux-trace-devel/20190723151112.59ef336c@gandalf.local.home Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Allow overriding of python installation directoryPatrick McLean1-1/+1
The current Makefile hardcodes the python module install directory, so packages can't put them in their distro's perferred location. This allows the directory to be overriden on the command line. Link: http://lore.kernel.org/linux-trace-devel/20190720030344.1991393-2-chutzpah@gentoo.org Signed-off-by: Patrick McLean <patrick.mclean@sony.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Use PyLong_AsLong() for Python 3Steven Rostedt (VMware)1-3/+10
Python 3 has deprecated PyInt_AS_LONG. Add code to use PyLong_AsLong() if Python 3 is detected. As Python 2 is going to be EOL soon, we need to support Python 3. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204231 Link: http://lore.kernel.org/linux-trace-devel/20190719225030.507227790@goodmis.org Reported-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Use PyMemoryView_FromMemory() for Python 3Steven Rostedt (VMware)1-2/+11
Python 3 has deprecated PyBuffer_FromMemory() and instead has PyMemoryView_FromMemory(). Add a helper function that uses the latter if Python 3 is detected. As Python 2 is going to be EOL soon, we need to support Python 3. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204231 Link: http://lore.kernel.org/linux-trace-devel/20190719225030.345100829@goodmis.org Reported-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23trace-cmd: Replace PySting_FromString() with PyUnicode_FromString()Steven Rostedt (VMware)1-4/+4
Python 3 has deprecated PyString_FromString(), but both Python 2 and Python 3 have PyUnicode_FromString() which should be equivalent (at least according to google). As Python 2 is going to be EOL soon, we need to support Python 3. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204231 Link: http://lore.kernel.org/linux-trace-devel/20190719225030.187908166@goodmis.org Reported-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-23kernel-shark: Add quotes around $XDG_SESSION_TYPE in kshark-su-recordSteven Rostedt (VMware)1-1/+1
If XDG_SESSION_TYPE is not set, then $XDG_SESSION_TYPE will become nothing, which means the test: if [ $XDG_SESSION_TYPE = "wayland" ]; turns into if [ = "wayland" ]; And will cause a shell error. Adding quotes around "$XDG_SESSION_TYPE" changes an empty $XDG_SESSION_TYPE into: if [ "" = "wayland" ]; which the shell can understand. Link: http://lore.kernel.org/linux-trace-devel/20190722113707.156a099f@gandalf.local.home Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204261 Fixes: 9b1208c4e ("kernel-shark-qt: Workaround for running as Root on Wayland") Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-19kernel-shark: Start using the new logo and iconYordan Karadzhov3-2/+8
The new Logo is shown on the title page of the doxygen documentation. The two new icons are installed ("jumping shark" and "fin only"). The "jumping shark" icon is used by default. Link: http://lore.kernel.org/linux-trace-devel/20190607095056.14666-3-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Add logo and icon filesYordan Karadzhov6-0/+401
All graphics files of the KernelShark's logos and icons have been contributed to the project by Stela Stamenkova. This artistic work can be used under the terms of the Creative Commons (BY) license. Link: http://lore.kernel.org/linux-trace-devel/20190607095056.14666-2-ykaradzhov@vmware.com Suggested-by: Stela Stamenkova <sstamenkova@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: kernel-shark: Avoid a duplicate error message from captureYordan Karadzhov (VMware)1-1/+1
If the capture process finishes with an error the _captureError() slot will print an error message. We do not need to print identical message in _captureFinished(). However, we have to keep in mind that the process that we started is "pkexec" and the capture dialog is a child process of "pkexec". So if the capture dialog failed to start or crashed the "pkexec" process itself will have a normal exit, however its return value will be different from 0 (it will just pass the return value of the capture dialog executable). In this case _captureError() is not triggered, but we still want to see an error message. Link: http://lore.kernel.org/linux-trace-devel/20190710153906.32048-1-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> [ Fixed '||' to be '&&' as Yordan asked ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Always check if data is loaded before changing the graphsYordan Karadzhov (VMware)3-2/+31
We want all operations over the graphs (like Zoom or Scroll) to be protected for the case when no data is loaded or no graphs are plotted. Link: http://lore.kernel.org/linux-trace-devel/20190717085306.12393-3-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Initialize all fields of struct kshark_trace_histoSteven Rostedt (VMware)1-7/+1
The function ksmodel_init() is to initialize the kshark_trace_histo structure to zero. Currently it does it via each field. It is safer to use memset() that will guarantee that the entire structure is set to zeros or NULLs if new fields are added. This is required because there's places in the code that check if a field is NULL or zero to determine if it should be set or not. Link: http://lkml.kernel.org/r/20190717085306.12393-2-y.karadz@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204195 Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Always clear the marker after resizing the table.Yordan Karadzhov (VMware)1-1/+9
It looks more like a Qt bug, but sometimes the automatic resize of the table widget done in KsTraceViewer::_resizeToContents() has the parasitic effect to select the first row of the table (making the row green). If this is happening clear the selection by hand. Link: http://lore.kernel.org/linux-trace-devel/20190715132042.5154-3-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: The graph widget must follow the active markerYordan Karadzhov (VMware)1-3/+4
The "Graph follows" checkbox controls if the Graph widget follows or not the change of the Active marker made from the View widget (the text data table). In the same time, when the user clicks on the checkbox switching it from Unchecked to Checked, a signal is send to the Graph widget to make sure that it will visualize the current position of the Active marker. When sending this signal, we currently use the iterator of the search results list, which is wrong because of two reasons. First, the search results list can be empty, which will trigger a segmentation fault, as reported by Valentin Schneider. But even more important is that nothing guarantees that when the checkbox is checked, the marker and the iterator both point to the same trace entry. Note that the iteration over the search results is only one of the possible ways to change the marker. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204139 Link: http://lore.kernel.org/linux-trace-devel/20190715132042.5154-2-y.karadz@gmail.com Reported-By: Valentin Schneider <valentin.schneider@arm.com> Tested-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Use '<br>' for dialog and '\n' for console error messagesSteven Rostedt (VMware)1-2/+7
The Qt dialog boxes require '<br>' to print a new line but consoles require a '\n'. Instead of printing '<br>' to the console or '\n' to the dialog, always have the '\n' turn into '<br>' for the dialog and all '<br>' turn into '\n' for the console. Link: http://lkml.kernel.org/r/20190710134725.599995325@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Show the standard error of kshark-recordSteven Rostedt (VMware)1-1/+2
When kshark-record fails, report the standard error which can be very useful for debugging the issue that when wrong. For example, after removing the kshark lib functions, instead of just having "Unknow error" print when kshark-record dialog fails, I now get: /usr/local/bin/kshark-record: error while loading shared libraries: libkshark-gui.so.0.9.8: cannot open shared object file: No such file or directory Link: http://lkml.kernel.org/r/20190710134725.436998774@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18kernel-shark: Remove the "make install" suggestion for capture errorsYordan Karadzhov (VMware)1-3/+0
The message is not appropriate, although it is most likely that the error occurs because the user didn't install KernelShark and it runs the executable from its build location. [ Steve: Although I hit this warning without needing a make install ;-) ] Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-7-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> [ Removed "duplicate" print of it as well ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-18revert: "kernel-shark: Remove a duplicate error message"Steven Rostedt (VMware)1-0/+26
It turns out that if the kshark-record dialog does not show up for some reason, then without this "duplicate" message, the user gets no message at all to why the dialog did not appear. Link: http://lkml.kernel.org/r/20190710134725.144595473@goodmis.org Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Less scary error message from Capture dialogYordan Karadzhov (VMware)1-1/+4
Most likely the reason for this error to occur is that the KernelShark GUI is not open (was closed). Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-9-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Disconnect "capture errors" before closing KernelShark GUIYordan Karadzhov (VMware)2-2/+15
This is done because we do not want to show error messages if the Capture dialog is not closed. Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-8-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Remove a duplicate error messageYordan Karadzhov (VMware)1-26/+0
If the capture process finishes with an error the _captureError() slot will print an error message. We do not need to print identical message in _captureFinished(). Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-6-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Don't try to open data file if recording failedYordan Karadzhov (VMware)2-1/+11
In the case when the recording process failed, the Capture dialog should not send a signal to the KernelShark GUI to open a new tracing data file. Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-5-y.karadz@gmail.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Optimize the command line options used by the capture dialogYordan Karadzhov (VMware)1-15/+6
Do not include all events belonging to a given system if the whole system is selected. Add only the name of the system instead. Do not specify a plugin if the selected plugin is "nop". Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-4-y.karadz@gmail.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Add method for getting all selected eventsYordan Karadzhov (VMware)2-0/+43
A new method is added to the class KsEventsCheckBoxWidget. It returns a list of strings containing all selected events. If the whole system is selected (the top level checkbox is checked), only the name of the system is added to the list. Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-3-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> [ Added space between for and '(' ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-09kernel-shark: Don't free the string field of KS_CONFIG_STRING documentYordan Karadzhov (VMware)1-1/+0
In kshark_config_doc_get() if the outputted document is of type KS_CONFIG_STRING, do not try to free the old string before setting the new one. Note that those strings are owned by the json object. Link: http://lore.kernel.org/linux-trace-devel/20190709155650.2345-2-y.karadz@gmail.com Fixes: b3b5b6504b1 ("kernel-shark-qt: Add I/O for configuration data.") Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08trace-cmd: Add git version string to trace-cmd --version outputSteven Rostedt (VMware)1-2/+2
Commit d74f3845ddebf0 ("trace-cmd: Make the version defines part of tc-version.h") created a VERSION_GIT define to include in the trace.dat file. It would also be helpful to have this displayed with the --version option too. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Update the HTML documentation to the new versionSteven Rostedt (VMware)56-281/+217
The HTML version of kernelshark is for the old GTK kernelshark. Change it to the new version. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Separate the target instalation instructionsYordan Karadzhov (VMware)1-1/+5
Having all target installation destinations given in one instruction may result in an error in the case when some of the third-party dependencies are missing. This will happen because you are trying to install a target that hasn't been built. Link: http://lore.kernel.org/linux-trace-devel/20190705141031.20239-3-y.karadz@gmail.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Line up the table of the loaded Advanced filtersYordan Karadzhov (VMware)1-1/+1
The Advanced filtering dialog shows a table of the already loaded filters. The new line that is added at the end of the string breaks the alignment of the last column of this tables. Link: http://lore.kernel.org/linux-trace-devel/20190705141031.20239-2-y.karadz@gmail.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Fix all warnings when building on 32 bit systemsYordan Karadzhov3-9/+9
Fixing warnings coming from: ../examples/datahisto.c ../src/KsTraceGraph.cpp ../src/libkshark.c Link: http://lore.kernel.org/linux-trace-devel/20190614135045.17223-4-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203869 Reported-by: Alan Mikhak <alanmikhak@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Always use 64 bit variables for timestamps.Yordan Karadzhov2-4/+5
All time stamps of the trace records are coded with 64 bits, however on some systems the size_t type can be 32 bits. Link: http://lore.kernel.org/linux-trace-devel/20190614135045.17223-3-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203869 Reported-by: Alan Mikhak <alanmikhak@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Fix a bug when plotting the last trace recordYordan Karadzhov1-6/+16
On a first glance this patch may looks like reverting commit 9336dd6bcd38 (kernel-shark: Fix a bug in ksmodel_set_next_bin_edge()) The point is that for the last bin we want to increment its upper edge used when checking if the bin is empty, but we do not want to touch the lower edge time used by kshark_find_entry_by_time(). Link: http://lore.kernel.org/linux-trace-devel/20190614135045.17223-2-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203869 Fixes: 9336dd6bcd38 ("kernel-shark: Fix a bug in ksmodel_set_next_bin_edge()") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Add 'make BUILD_TYPE=X gui' to change how the gui is madeSteven Rostedt (VMware)3-3/+17
Add an option to the Makefile called "BUILD_TYPE" that is passed to the CMake commands to change how kernelshark is built. The current options are: make BUILD_TYPE=Debug gui - for "-g" option make BUILD_TYPE=Release gui - for "-O3" option make BUILD_TYPE=RelWithDebInfo gui - for "-g -O2" option (default) make BUILD_TYPE=MinSizeRel gui - for "-Os" option By default, BUILD_TYPE is set to RelWithDebInfo. Also change the CMakeLists.txt to use RelWithDebInfo as the default instead of just Debug. Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Have "make clean" run cmake-clean.shSteven Rostedt (VMware)2-1/+2
A make clean should clean up the cmake files as well. Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernelshark: Update the README for changes to the make processSteven Rostedt (VMware)1-10/+40
The top level git tree's Makefile has code added to build the cmake portion of KernelShark. But the README does not document the process. Bring the README up to speed with how to actually build KernelShark. Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-08kernel-shark: Define a CMAKE_BUILD_TYPE "Package"Yordan Karadzhov2-15/+41
A special build type dedicated for package maintainers is added. By default this build type adds the "-O3" compiler flag. Users can chose their own compiler flags by providing the corresponding CMAKE_XXXX_FLAGS_PACKAGE Command-Line options. If no types is specified, the build type will be "Debug". Link: http://lore.kernel.org/linux-trace-devel/20190708091945.439-1-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05kernel-shark: Avoid TRACECMD_BIN_DIR being set to the build pathYordan Karadzhov3-12/+15
The full path to the build directory (which is random for every user) is embedded in the final binary. This is a no-no for some Linux distros which are requiring that the finished binaries should not have such paths embedded in them. Link: http://lore.kernel.org/linux-trace-devel/20190614132609.16465-3-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203187 Reported-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05kernel-shark: Remove the "-g" compiler flag.Yordan Karadzhov1-2/+2
The debug flags by design embed the build paths, but the distro package binaries should not have such paths embedded in them. Link: http://lore.kernel.org/linux-trace-devel/20190614132609.16465-2-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203187 Suggested-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05trace-cmd: Fixed a potential problem with non-terminated string, returned by ↵Tzvetomir Stoyanov (VMware)1-0/+1
readlink() The buffer, returned by readlink() API, is not guaranteed to be a null terminated string. Explicitly adding '\0' at the end of the buffer is recommended, to ensure the string is null terminated and to avoid possible buffer overruns. Link: http://lore.kernel.org/linux-trace-devel/20190703121644.18680-1-tz.stoyanov@gmail.com Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Tested-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05trace-cmd: Avoid using uninitialized handleGreg Thelen1-1/+1
The put_together_file() 'out' error path uses uninitialized handle. Unconditionally initialize handle. Link: http://lore.kernel.org/linux-trace-devel/20190627152710.177848-1-gthelen@google.com Fixes: 9ed499fccef5 ("trace-cmd: Fix record --date flag when sending tracing data to a listener") Signed-off-by: Greg Thelen <gthelen@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05trace-cmd: Always initialize write_record() lenGreg Thelen1-7/+3
write_record() uses an uninitializedd 'len' when record->size is 0. I'm not sure how likely this case is. To be safe and silence compiler warning, unconditionally initialize len. Link: http://lore.kernel.org/linux-trace-devel/20190627152502.174918-1-gthelen@google.com Fixes: 87d2a344a ("trace-cmd: Add split feature") Signed-off-by: Greg Thelen <gthelen@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-07-05trace-cmd: Remove ununsed knuth_hash*() routinesGreg Thelen2-38/+14
Neither 16-bit knuth_hash16() nor the 32-bit knuth_hash() are used. Delete them both. And rename the remaining function: knuth_hash8() => knuth_hash() Link: http://lore.kernel.org/linux-trace-devel/20190629062752.204113-1-gthelen@google.com Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Greg Thelen <gthelen@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-26trace-cmd: Do not free pages from the lookup table in struct cpu_data in ↵Tzvetomir Stoyanov (VMware)1-9/+11
case trace file is loaded. A major speed regression in trace-cmd v2.8 is reported by Johannes Berg when parsing a huge trace.dat file: "I have a ~1.7G file with just under 620k events (not exactly big by our standards), and parsing speed (with -N to disable plugins) goes from ~4.5 seconds on commit 1ad32c24746 to >>4.5 minutes (I aborted there) on master. I was talking to Steven about another issue, and he pointed me to commit c2fc2bc296f7. Reverting that on master makes it take ~2 seconds, so that'd actually be an improvement." Proposed solution: do not free pages from "struct page **pages" lookup table in struct cpu_data, in case a trace file is loaded. This reverts the behavior for this use case, as it was before commit c2fc2bc296f7. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203411 Link: http://lore.kernel.org/linux-trace-devel/20190619114922.3169-1-tz.stoyanov@gmail.com Fixes: c2fc2bc296f7 ("trace-cmd: Fix crash when trace-cmd is executed with args profile -F sleep 1") Reported-by: Johannes Berg <johannes@sipsolutions.net> Tested-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-17trace-cmd: Start on 2.9 (or 3.0) development cycleSteven Rostedt (VMware)1-2/+2
Update the Makefile to show all new changes are on the next development cycle. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-13trace-cmd: Version 2.8Steven Rostedt (VMware)1-1/+1
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-13trace-cmd: Check the return of get_file_content() before calling ↵Steven Rostedt (VMware)1-2/+4
add_reset_file() If get_file_content() returns NULL, because the file does not exist or for any other reason, it will cause add_reset_file() to trigger a SEGSEGV due to using a NULL pointer. Only call add_reset_file() if get_file_content() actually returns something. Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-13trace-cmd: Have --max-graph-depth only be part of instanceSteven Rostedt (VMware)2-12/+17
New kernels will allow function graph tracer to be used in an instance, which means that the max_graph_depth file will be per instance and not just the top level file. Make the max_graph_depth associated to the instance and not part of the trace record context. Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-13trace-cmd: Fix typo in Makefile bidr to bdirSteven Rostedt (VMware)1-1/+1
The order-only prerequisit to $(bdir)/include has a typo of "$(bidr)" instead of being "$(bdir)" Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-12trace-cmd: Fix the description of check-eventsDongliang Mu1-1/+1
The description of "check-events" is incorrectly stated as "check-format". Link: http://lore.kernel.org/linux-trace-devel/20190607183658.5605-1-mudongliangabcd@gmail.com Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-12trace-cmd: Make the version defines part of tc-version.hSteven Rostedt (VMware)3-5/+11
Move the version string creations as part of the tc-version.h file, and have trace-record.c include and use that. The VERSION_STRING is already defined and obsoletes TRACECMD_VERSION. For consistency, use VERSION_GIT to define the git sha1. Also, add logic to detect if the source file is a git repo, and use "not-a-git-repo" as the sha1 if it is not found. Add a "+" to the end of the git sha1 if the repo has modifications in it. Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-12kernelshark: Fix compiler error in KsSession.cpp on Raspberry Pi 3Alan Mikhak1-1/+1
Fix compiler error at KsSession.cpp:457:30 on Raspberry Pi 3 Fix by changing the type of local variable 'pos' from uint64_t to size_t in KsSession::loadDualMarker(). KsSession.cpp:457:30: error: no matching function for call to ‘KsSession::_getMarker(const char [6], uint64_t*)’ if (_getMarker("markA", &pos)) { ^ In file included from KsSession.cpp:14:0: KsSession.hpp:97:7: note: candidate: bool KsSession::_getMarker(const char*, size_t*) bool _getMarker(const char* name, size_t *pos); ^~~~~~~~~~ KsSession.hpp:97:7: note: no known conversion for argument 2 from ‘uint64_t* {aka long long unsigned int*}’ to ‘size_t* {aka unsigned int*}’ Link: http://lore.kernel.org/linux-trace-devel/20190612035902.16366-1-amikhak@wirelessfabric.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203873 Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Alan Mikhak <amikhak@wirelessfabric.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-11trace-cmd: Add trace-cmd report --version to extract version infoSteven Rostedt (VMware)5-0/+37
Now that the trace.dat file can save the version of the executable that was used to create it, save that information. This will be useful if a user has a problem with a trace.dat file. It can let the developers know what version was used to create it. We need a way to extract this information. Adding a new "--version" to trace-cmd report will display the saved version in the trace.dat file if it exists. Link: http://lore.kernel.org/linux-trace-devel/20190610212706.2505bffe@oasis.local.home Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-10trace-cmd: Append metadata about trace-cmd's version when recordingSlavomir Kaslev3-1/+18
Add metadata when recording to the output trace about trace-cmd's version and git commit. When debugging this can be useful to know which version of trace-cmd recorded this trace.dat file. Link: http://lore.kernel.org/linux-trace-devel/20190604124826.6716-1-kaslevs@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Link: https://bugzilla.kernel.org/show_bug.cgi?id=203547 Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-10trace-cmd: Fix a possible race condition and deadlock in trace-cmdTzvetomir Stoyanov2-2/+7
When pipes are used for communication between trace-cmd main thread and per-cpu recorder threads, there is a possible race condition in stop_threads(), which can cause a deadlock between the main thread and cpu recorder thread: In trace_stream_read(), the select() call can return 0 if threads have no data to send. This will force stop_threads() to stop reading the thread's pipes and enter a waitpid() loop, to wait for all threads to be terminated. However, there is a case when some threads are still flushing its data - tracecmd_flush_recording() tries a blocking write() to the pipe. A dead lock appears - the cpu thread is blocked in write(), as its buffer is full and no one is reading it. The main thread is blocked in waitpid(), to wait the same thread to exit. The deadlock can be (randomly) observed with the command "trace-cmd profile -p function -F sleep 10" The proposed fix removes the select timeout, makes the call blocking, to ensure the threads are flushed its data before going in waitpid() loop. Link: http://lore.kernel.org/linux-trace-devel/20190605111937.17894-2-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-05Merge remote-tracking branch 'yordan/master' into trace-cmdSteven Rostedt (VMware)7-36/+172
Yordan Karadzhov (2): kernel-shark: Add new dataloading method to be used by the NumPu interface kernel-shark: Use full paths for non-standard library headers
2019-06-05kernel-shark: Use full paths for non-standard library headersYordan Karadzhov6-36/+26
All header files included in the public interfaces of the trace-cmd and KernelShark libraries have to use full path when including other non-standard library headers. This will be useful if someone wants to use those public interfaces from there installation location. You may need to clean Cmake's cache after aplaying this patch: cd kernel-shark/build ./cmake_clean.sh cmake .. Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
2019-06-05kernel-shark: Add new dataloading method to be used by the NumPu interfaceYordan Karadzhov2-0/+146
The new function loads the content of the trace data file into a table / matrix, made of columns / arrays of data having various integer types. Later those arrays will be wrapped as NumPy arrays. Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
2019-06-05trace-cmd: Fix crash when trace-cmd is executed with args "profile -F sleep 1"Tzvetomir Stoyanov1-12/+33
When trace-cmd is running in "profile" mode, trace files are not generated. Instead, pipes are used to collect trace data from recorder threads. Some internal functions, originally designed for working with files, are reused in pipes use case: init_cpu() allocate_page() get_next_page() There was an undesired behaviour in those functions, when working with pipes, which causes the segmentation fault. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203411 Link: http://lore.kernel.org/linux-trace-devel/20190605115046.20444-1-tstoyanov@vmware.com Fixes: 62e82cc6cdc9 ("trace-cmd: Use lookup table instead of link list for pages") ./trace-cmd profile -F sleep 1 Segmentation fault (core dumped) back trace: 0 allocate_page (handle=0x4a1a10, cpu=0, offset=12288) at trace-input.c:927 1 0x000000000042d2aa in get_page (handle=0x4a1a10, cpu=0, offset=12288) at trace-input.c:1116 2 0x000000000042d40d in get_next_page (handle=0x4a1a10, cpu=0) at trace-input.c:1142 3 0x000000000042e339 in tracecmd_peek_data (handle=0x4a1a10, cpu=0) at trace-input.c:1776 4 0x000000000042e6d4 in tracecmd_read_data (handle=0x4a1a10, cpu=0) at trace-input.c:1841 5 0x0000000000424d82 in trace_stream_read (pids=0x47b7d0, nr_pids=8, tv=0x7fffffffd3c0) at trace-stream.c:105 6 0x000000000040aa1f in trace_waitpid (type=TRACE_TYPE_STREAM, pid=24759, status=0x7fffffffd408, options=1) at trace-record.c:1114 7 0x000000000040b151 in run_cmd (type=TRACE_TYPE_STREAM, argc=2, argv=0x7fffffffd600) at trace-record.c:1331 8 0x0000000000412ffd in record_trace (argc=5, argv=0x7fffffffd5e8, ctx=0x7fffffffd470) at trace-record.c:5065 9 0x000000000041338d in trace_profile (argc=5, argv=0x7fffffffd5e8) at trace-record.c:5199 10 0x0000000000408bc5 in main (argc=5, argv=0x7fffffffd5e8) at trace-cmd.c:118 The problem seems to be in the lookup table "struct page **pages" in struct cpu_data. In case pipes are used with this tracecmd_input handler, only a single page is allocated in this lookup table. Later, when get_page() is called, there is use case where more pages are addressed (in the backtrace above, the page with index 3 is addressed, cpu_data->pages[3]) trace-cmd: current (git20190424) Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-23kernel-shark: Correct memory management when data loading failsYordan Karadzhov1-10/+7
The erroneous case, when the memory allocation failed during data loading, hasn't been properly handled. Link: http://lore.kernel.org/linux-trace-devel/20190523150946.30769-4-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-23kernel-shark: Handle properly the negative error codes when loading dataYordan Karadzhov7-19/+31
get_records() can return negative error codes. This means that we alway have to use signed integer types for the "data size" variables / fields. Link: http://lore.kernel.org/linux-trace-devel/20190523150946.30769-3-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-23kernel-shark: Add Doxygen documentation for KsGLWidget::update()Yordan Karadzhov1-0/+1
No functional changes in this patch. Link: http://lore.kernel.org/linux-trace-devel/20190523150946.30769-2-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-21kernel-shark: Handle the case when the marker points to a filtered entryYordan Karadzhov4-11/+65
Markers can point to entries that are filtered out. In such a case the filtered marker is plotted using a dashed line. Link: http://lore.kernel.org/linux-trace-devel/20190515190911.20755-7-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-21kernel-shark: Improve the appearance on high screen resolutionYordan Karadzhov3-12/+18
Some of the components of the plots haven't been properly scaled when displayed on high screen resolution. Link: http://lore.kernel.org/linux-trace-devel/20190515190911.20755-6-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-21kernel-shark: Use XDG compliant path when saving cached dataYordan Karadzhov1-2/+4
Use the QStandardPaths class provided by Qt in order to guarantee that the location of the cached data is XDG compliant. Link: http://lore.kernel.org/linux-trace-devel/20190515190911.20755-3-ykaradzhov@vmware.com Suggested-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-21kernel-shark: Remove hard-coded install pathsYordan Karadzhov6-16/+25
The definitions of KS_APP_NAME and KS_ICON are used to derive standard installation paths for the KernelShark libraries, plugins and icons. The patch combines improvements suggested by Troy Engel and Bas van Dijk. Link: http://lore.kernel.org/linux-trace-devel/20190515190911.20755-2-ykaradzhov@vmware.com Suggested-by: Troy Engel <troyengel@gmail.com> Suggested-by: Bas van Dijk <v.dijk.bas@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-08kernelshark: Compile kernel-shark with -fPIC optionAlan Mikhak1-2/+2
Resolve linker relocation error when linking libkshark.so.0.9.8 with cmake on armv7l, aarch64, and some x86_64 platforms. Ubuntu 16.04 (xenial) on x86_64: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC Debian 9.8 (stretch) on x86_64: relocation R_X86_64_TPOFF32 against `seq' can not be used when making a shared object; recompile with -fPIC Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Alan Mikhak <amikhak@wirelessfabric.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-06kernel-shark: Add "Report bug" button to "Help"Yordan Karadzhov2-0/+17
When clicked, the Bugzilla will be opened in the appropriate Web browser for the user's desktop environment. Link: http://lore.kernel.org/linux-trace-devel/20190502124536.32463-2-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-06kernel-shark: Enforce update of the OpenGL widget when loading new sessionYordan Karadzhov3-2/+5
This is needed in the case when the session was saved at different screen resolution. Link: http://lore.kernel.org/linux-trace-devel/20190502124536.32463-1-ykaradzhov@vmware.com Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-05kernel-shark: Add logic for selecting the trace-cmd executable usedYordan Karadzhov3-3/+10
If kshark-record has been started from its installation location it will use the installed version of trace-cmd. Otherwise the trace-cmd executable found by Cmake when building KernelShark (see FindTraceCmd.cmake) will be used. Link: http://lore.kernel.org/linux-trace-devel/20190502124009.32208-7-ykaradzhov@vmware.com Suggested-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-05kernel-shark: Remember the paths used by the Open-File dialogsYordan Karadzhov2-1/+12
The application will remember the used file paths across different executions. Link: http://lore.kernel.org/linux-trace-devel/20190502124009.32208-6-ykaradzhov@vmware.com Suggested-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-05kernel-shark: Remove the definition of KS_DIRYordan Karadzhov1-3/+0
KS_DIR is no longer used, so we do not need to define it in the Cmake-generated header file. Link: http://lore.kernel.org/linux-trace-devel/20190502124009.32208-5-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-05kernel-shark: Add logic for the plugins search pathYordan Karadzhov3-12/+30
If the application has not been started from its installation location and the directory app_file_path + "../../kernel-shark/lib" exists, all build-in plugins will be loaded from this directory. In any other case all build-in plugins will be loaded from _INSTALL_PREFIX/lib/kshark/plugins/ Link: http://lore.kernel.org/linux-trace-devel/20190504130702.27755-1-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-03kernel-shark: Add logic for the initial path of Open-File dialogsYordan Karadzhov6-65/+183
If the application has been started from its installation location, all Open File dialogs will start at ${HOME}. Otherwise the dialogs will start at ${PWD}. If a given dialog has been used already to select a file, next time the dialog will start in the directory of this file. Link: http://lore.kernel.org/linux-trace-devel/20190502124009.32208-3-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-03kernel-shark: Add INSTALL PREFIX to the Cmake-generated header file.Yordan Karadzhov1-0/+3
To be used to check if the aplication runs from its installation location. Link: http://lore.kernel.org/linux-trace-devel/20190502124009.32208-2-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-03trace-cmd: python: Apply 2to3 print transformation to python filesJohn Kacur3-16/+16
In preperation for the python plugin to work with python3, apply the 2to3 print transformation on the python files. In python3 print is a function so needs to be bracketted. This is safe to do because the syntax is compatible with python2 as well Link: http://lore.kernel.org/linux-trace-devel/20190503161541.15773-1-jkacur@redhat.com Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-05-03trace-cmd-listen: Fix resource leak of msg_handleJohn Kacur1-0/+1
Fix the potential resource leak of msg_handle by calling tracecmd_msg_handle_close before returning in an error path Link: http://lore.kernel.org/linux-trace-devel/20190503142449.9936-1-jkacur@redhat.com Fixes: 35bfedc66b99 ("trace-cmd msg: Create a msg_handle to pass around for saved state") Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-24trace-cmd: Load trace-cmd plugins from build folder, if existsTzvetomir Stoyanov1-0/+29
When a development version of trace-cmd is built and run on the machine, by default it loads all plugins from predefined drierctories : (install_preffix)/lib/traceevent/plugins ~/.traceevent/plugins the path specified in TRACEEVENT_PLUGIN_DIR environment variable. Thus, the development plugins will not be loaded. To simplify the development process, a new logic is added: At plugins load time, check the location of trace-cmd application and look for "plugins" directory around it. If found, load plugins from it. Those pluigins will be loaded last, so in case of duplication the "development" plugins win. Link: http://lore.kernel.org/linux-trace-devel/20190423143344.30645-1-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-23kernel-shark: Fixing the fix in ksmodel_zoomYordan Karadzhov1-1/+1
if (zoom_in && (int) range * (1. - r) < histo->n_bins * 5) The line above has two bugs: - 64 bit type (size_t) is casted to 32 bit (int) - Type cast operator has a higher precedence than the multiplication operator, hence "(int) range * (1. - r)" is a floating point number Link: http://lore.kernel.org/linux-trace-devel/20190422123753.3821-1-ykaradzhov@vmware.com Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Fixes: bedcff1165 ("kernel-shark: Fix a bug in ksmodel_zoom") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-19kernel-shark: Load Last Session from command lineYordan Karadzhov1-1/+8
./kernelshark -l will load directly the Last Session Link: http://lore.kernel.org/linux-trace-devel/20190419135036.19340-7-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-19kernel-shark: Use proper searching condition when the dataset is smallYordan Karadzhov1-1/+4
If the data-set is small we do not want to have the overhead added by the update of the progress bar. Because of this we bypass the state switching of the FSM. However, in this case the the search condition has to be updated by hand. Link: http://lore.kernel.org/linux-trace-devel/20190419135036.19340-8-ykaradzhov@vmware.com Reported-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: 1615b02b (kernel-shark-qt: Optimize the search in a case of a small data-set) Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-19kernel-shark: Remove the definition of KS_CONF_DIRYordan Karadzhov2-8/+0
KS_CONF_DIR is no longer used, so we do not need to define it in the Cmake-generated header file. Link: http://lore.kernel.org/linux-trace-devel/20190419135036.19340-3-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-19kernel-shark: Configuration information in ${HOME}/.cache/kernelsharkYordan Karadzhov2-9/+63
By default the "Last session" configuration file will be saved in ${HOME}/.cache/kernelshark. If ${HOME}/.cache/kernelshark doesn't exist, it will be created automatically. The user can select another directory to be used to store the cached data. This can be done by setting the environment variable KS_USER_CACHE_DIR. In this case if the path (the value of KS_USER_CACHE_DIR) doesn't exist the user will be asked before create it. Link: http://lore.kernel.org/linux-trace-devel/20190419135036.19340-2-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-17trace-cmd: Add --no-filter option to not filter out recording processesSlavomir Kaslev3-3/+17
Add trace-cmd --no-filter option that disables filtering out of trace-cmd recording processes from the trace. Link: http://lore.kernel.org/linux-trace-devel/20190417183157.8776-2-kaslevs@vmware.com Tested-by: Phil Auld <pauld@redhat.com> Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-17trace-cmd: Remove parsing_failures APIs from libtraceeventTzvetomir Stoyanov8-44/+34
The application, which uses libtraceevent, should track itself the number of failures while parsing the event files. The libtraceevent APIs return error in case of such failure. The application can check for it and track the parsing failures, if needed. Introduced changes: - traceecent library: remove the parsing failures APIs and logic. - trace-cmd library: Added new parameter "int *parsing_failures" to tracecmd_fill_local_events(). Added new parameter "int parsing_failures" to internal struct tracecmd_input and new API tracecmd_get_parsing_failures() to access it. Modified the logic in tracecmd_read_headers() to track failures while parsing the event files. - trace-cmd application: use the new trace-cmd library APIs to check the number of parsing failures. Link: http://lore.kernel.org/linux-trace-devel/20190417162630.32240-1-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-17trace-cmd: Optimize how pid filters are expressedSlavomir Kaslev1-36/+81
Express pid filters as allowed/disallowed filter ranges (pid>=100&&pid<=103) instead of specifying them per pid (pid==100||pid==101||pid==102||pid==103) This makes the size of the resulting filter smaller (and faster) and avoids overflowing the filter size limit of one page which we can hit on bigger machines (say >160 CPUs). Link: http://lore.kernel.org/linux-trace-devel/20190417130959.10064-2-kaslevs@vmware.com Reported-by: Phil Auld <pauld@redhat.com> Tested-by: Phil Auld <pauld@redhat.com> Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-17trace-cmd: Exit the application if runs in "filter test" modeTzvetomir Stoyanov1-4/+7
Users can use trace-cmd to test specific filters, with the command trace-cmd record -F <filter> -T When trace-cmd runs in this "test filter" mode, after processing the filter string, the resulting filter will be displayed for each event. It should not run the actual trace, but exit after all filters are processed. This exit() was originally performed in the context of libtraceevent, but removed from there as a library function should not force the application to exit. The logic was moved to trace-cmd application. Link: http://lore.kernel.org/linux-trace-devel/20190415125823.4011-2-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-12tools lib traceevent: Fix missing equality check for strcmpRikard Falkeborn1-1/+1
There was a missing comparison with 0 when checking if type is "s64" or "u64". Therefore, the body of the if-statement was entered if "type" was "u64" or not "s64", which made the first strcmp() redundant since if type is "u64", it's not "s64". If type is "s64", the body of the if-statement is not entered but since the remainder of the function consists of if-statements which will not be entered if type is "s64", we will just return "val", which is correct, albeit at the cost of a few more calls to strcmp(), i.e., it will behave just as if the if-statement was entered. If type is neither "s64" or "u64", the body of the if-statement will be entered incorrectly and "val" returned. This means that any type that is checked after "s64" and "u64" is handled the same way as "s64" and "u64", i.e., the limiting of "val" to fit in for example "s8" is never reached. This was introduced in the kernel tree when the sources were copied from trace-cmd in commit f7d82350e597 ("tools/events: Add files to create libtraceevent.a"), and in the trace-cmd repo in 1cdbae6035cei ("Implement typecasting in parser") when the function was introduced, i.e., it has always behaved the wrong way. Detected by cppcheck. Link: http://lkml.kernel.org/r/20190412142250.20595-7-acme@kernel.org Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Clark Williams <williams@redhat.com> Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com> Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a") Link: http://lkml.kernel.org/r/20190409091529.2686-1-rikard.falkeborn@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-12tools lib traceevent: Rename input arguments and local variables of ↵Tzvetomir Stoyanov4-168/+168
libtraceevent from pevent to tep "pevent" to "tep" renaming of: - all "pevent" input arguments of libtraceevent internal functions. - all local "pevent" variables of libtraceevent. This makes the implementation consistent with the chosen naming convention, tep (trace event parser), and will avoid any confusion with the old pevent name Link: http://lore.kernel.org/linux-trace-devel/20190409075024.30512-6-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-5-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.944953447@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-09perf tools, tools lib traceevent: Rename "pevent" member of struct ↵Tzvetomir Stoyanov2-8/+8
tep_event_filter to "tep" The member "pevent" of the struct tep_event_filter is renamed to "tep". This makes the struct consistent with the chosen naming convention: tep (trace event parser), instead of the old pevent. Link: http://lore.kernel.org/linux-trace-devel/20190409075024.30512-5-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-4-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.785896189@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-09perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event ↵Tzvetomir Stoyanov11-56/+57
to "tep" The member "pevent" of the struct tep_event is renamed to "tep". This makes the struct consistent with the chosen naming convention: tep (trace event parser), instead of the old pevent. Link: http://lore.kernel.org/linux-trace-devel/20190409075024.30512-4-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-3-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.627724996@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-09tools lib traceevent: Rename input arguments of libtraceevent APIs from ↵Tzvetomir Stoyanov16-441/+442
pevent to tep Input arguments of libtraceevent APIs are renamed from "struct tep_handle *pevent" to "struct tep_handle *tep". This makes the API consistent with the chosen naming convention: tep (trace event parser), instead of the old pevent. Link: http://lore.kernel.org/linux-trace-devel/20190409075024.30512-3-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-2-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.465573837@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-09tools tools, tools lib traceevent: Make traceevent APIs more consistentTzvetomir Stoyanov11-52/+52
Rename some traceevent APIs for consistency: tep_pid_is_registered() to tep_is_pid_registered() tep_file_bigendian() to tep_is_file_bigendian() to make the names and return values consistent with other tep_is_... APIs tep_data_lat_fmt() to tep_data_latency_format() to make the name more descriptive tep_host_bigendian() to tep_is_bigendian() tep_set_host_bigendian() to tep_set_local_bigendian() tep_is_host_bigendian() to tep_is_local_bigendian() "host" can be confused with VMs, and "local" is about the local machine. All tep_is_..._bigendian(struct tep_handle *tep) APIs return the saved data in the tep handle, while tep_is_bigendian() returns the running machine's endianness. All tep_is_... functions are modified to return bool value, instead of int. Link: http://lore.kernel.org/linux-trace-devel/20190409075024.30512-2-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20190327141946.4353-2-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.288624897@goodmis.org [ Removed some extra parenthesis around return statements ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08tools lib traceevent: Remove call to exit() from tep_filter_add_filter_str()Tzvetomir Stoyanov1-3/+0
This patch removes call to exit() from tep_filter_add_filter_str(). A library function should not force the application to exit. In the current implementation tep_filter_add_filter_str() calls exit() when a special "test_filters" mode is set, used only for debugging purposes. When this mode is set and a filter is added - its string is printed to the console and exit() is called. This patch changes the logic - when in "test_filters" mode, the filter string is still printed, but the exit() is not called. It is up to the application to track when "test_filters" mode is set and to call exit, if needed. Link: http://lore.kernel.org/linux-trace-devel/20190408152340.12450-6-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20190326154328.28718-9-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164344.121717482@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08tools lib traceevent: Remove tep filter trivial APIsTzvetomir Stoyanov2-185/+0
This patch removes trivial filter tep APIs: enum tep_filter_trivial_type tep_filter_event_has_trivial() tep_update_trivial() tep_filter_clear_trivial() Trivial filters is an optimization, used only in the first version of KernelShark. The API is deprecated, the next KernelShark release does not use it. Link: http://lore.kernel.org/linux-trace-devel/20190408152340.12450-5-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20190326154328.28718-4-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164343.968458918@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08tools lib traceevent: Removed unneeded !! and return parenthesisSteven Rostedt (VMware)1-2/+2
As return is not a function we do not need parenthesis around the return value. Also, a function returning bool does not need to add !!. Link: http://lore.kernel.org/linux-trace-devel/20190408152340.12450-4-tstoyanov@vmware.com Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com> Link: http://lkml.kernel.org/r/20190401164343.817886725@goodmis.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08tools lib traceevent: Implement new traceevent APIs for accessing struct ↵Tzvetomir Stoyanov4-32/+31
tep_handler fields As struct tep_handler definition is not exposed as part of libtraceevent API, its fields cannot be accessed directly by the library users. This patch implements new APIs, which can be used to access the struct tep_handler fields: tep_get_event() - retrieves an event pointer at a specific index tep_get_first_event() - is modified to use tep_get_event() tep_clear_flag() - clears a tep handle flag tep_test_flag() - test if a given flag is set tep_get_header_timestamp_size() - returns the size of the timestamp stored in the header. tep_get_cpus() - returns the number of CPUs tep_is_old_format() - returns true if data was created by an older kernel with the old data format tep_set_print_raw() - have the output print in the raw format tep_set_test_filters() - debugging utility for testing tep filters Link: http://lore.kernel.org/linux-trace-devel/20190408152340.12450-3-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190325145017.30246-4-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164343.679629539@goodmis.org [ Renamed some newly added "pevent" to "tep" ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08tools lib traceevent: Change description of few APIsTzvetomir Stoyanov2-10/+12
APIs descriptions should describe the purpose of the function, its parameters and return value. While working on man pages implementation, I noticed mismatches in the descriptions of few APIs. This patch changes the description of these APIs, making them consistent with the man pages: - tep_print_num_field() - tep_print_func_field() - tep_get_header_page_size() - tep_get_long_size() - tep_set_long_size() - tep_get_page_size() - tep_set_page_size() Link: http://lore.kernel.org/linux-trace-devel/20190408152340.12450-2-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/linux-trace-devel/20190325145017.30246-2-tstoyanov@vmware.com Link: http://lkml.kernel.org/r/20190401164343.396759247@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-08kernel-shark: kshark_string_config_alloc() must take no argumentsYordan Karadzhov2-2/+2
The function is not meant to have arguments, so it must explicitly state this. A functions taking unspecified list of parameters will be a problem for the Pythion interface. Link: http://lore.kernel.org/linux-trace-devel/20190327160323.31654-2-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-02kernel-shark: Fix a bug in KsPluginManagerYordan Karadzhov1-4/+4
const char *lib = plugin.toStdString().c_str(); This line is a bad idea because the returned array may (will) be invalidated when the destructor of std::string is called. Link: http://lore.kernel.org/linux-trace-devel/20190326133914.18884-1-ykaradzhov@vmware.com Fixes: 18cf94f48 ("kernel-shark-qt: Add KernalShark Utils") Suggested-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-02kernel-shark: Reorder the priority when searching for trace-cmd libsYordan Karadzhov1-3/+13
The CMAKE build system of KernelShark performs automated search for the trace-cmd libraries, headers and executable before building the GUI. The new order of the list of directories to search in is the following: 1. ${TRACE_CMD}/ ($TRACE_CMD is an environment variable) 2. CMAKE_SOURCE_DIR/../ 3. Platform / system specific locations Link: http://lore.kernel.org/linux-trace-devel/20190313152220.22026-2-ykaradzhov@vmware.com Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-02kernel-shark: Install the application in "System" categoryTzvetomir Stoyanov1-0/+1
Kernelshark is a system tool, thus should by classified as System application. The template desktop file is modified to set Kernelshark in "System" category. Link: http://lore.kernel.org/linux-trace-devel/20190329140514.1373-1-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-04-02kernel-shark: Remove hardcoded /usr/local install prefixTzvetomir Stoyanov8-9/+20
Installation prefix of kernelshark should not be hardcoded, it should be configurable at build time. As kernelshark and trace-cmd are built together, they should share the same installation prefix. The patch removes hardcoded /usr/local prefix from kernelshark make files and replaces it with the one, specified in the top Makefile. Note: after applying the patch, kernel-shark/build/cmake_clean.sh should be run, to ensure that cmake cache is cleared. Link: http://lore.kernel.org/linux-trace-devel/20190329150319.7176-1-tstoyanov@vmware.com Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Tested-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Change tracecmd_msg's buf member type to char *Slavomir Kaslev1-5/+5
Now that all protocol V3 messages (besides SEND_DATA) use the buffer for text, it makes sense to have it declared as such and drop a few casts. This also takes care of undefined behavior caused by void pointer arithmetic in tracecmd_msg_data_send()/tracecmd_msg_read_data(). Link: http://lore.kernel.org/linux-trace-devel/20190322162635.30689-1-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Fix whitespace in tracecmd_init_data()Steven Rostedt (VMware)1-1/+1
The cpu variable was not indented correctly. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Add -lrt to building trace-record.cSteven Rostedt (VMware)1-1/+1
clock_gettime() requires -lrt for glibc < 2.17. Add it so older systems can still build. Fixes: 42e33cf0e53b ("trace-cmd: improve the accuracy of date to ts mapping") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: In collections, handle the case when the data is smallYordan Karadzhov1-8/+12
In particular, handle the case when the size of the data is smaller than the required margin. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-13-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: In model, handle the case when all bins are emptyYordan Karadzhov1-4/+5
ksmodel_set_bin_counts() should not crash in the case when all bins of the model, except the Upper Overflow bin, are empty. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-12-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Avoid 0/0 spliter ratio in KsSessionYordan Karadzhov1-1/+5
Sometimes when we save the session QSplitter::sizes() returns 0/0 ratio (no idea why). Later when we load the session the 0/0 ratio results in misbehavior of the splitter position. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-11-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Avoid the unnecessary calls of KsGLWidget::loadColors()Yordan Karadzhov1-2/+0
The tables of colors used by the OpenGL widget have to be updated only when we load a new trace data file. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-10-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Fix memory leak in KsPlotget::getTaskColorTable()Yordan Karadzhov1-0/+2
The std::vector constructor used here makes a copy of the data, so the memory used by the original array has to be freed. This is a major leak because getTaskColorTable() gets called every time when we redraw the plots. BTW calling getTaskColorTable() every time when we redraw makes no sense. This will be fixed in the following patch. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-9-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Add destructor for KsGLWidgetYordan Karadzhov2-0/+8
Not sure how I missed to define this destructor before. The good thing is that the GUI has only one GL widget, and this widget stays alive for the whole duration of the program. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-8-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Disables automatic quotation for errors in KsMainWindowYordan Karadzhov1-1/+1
When quoting in the output stream is disabled, the text of the message is printed without quotations and without escaping of non-printable characters. example output with quoting enabled: ERROR: "Unable to open trace data file for session mysession.json\n" and with quoting disabled: ERROR: Unable to open session description file mysession.json. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-6-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Error message if the opening of the session file failsYordan Karadzhov1-1/+10
Here we add proper handling of the case when the loading of the session description file fails. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-5-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Make KsSession::importFromFile return status flagYordan Karadzhov2-5/+11
The function has a better handling of the case when the session description file cannot be loaded. It returns true on success, otherwise false. We need this return flag in order to provide adequate error message in the case when this operation fails. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-4-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Fix a typo in an error message from libkshark-configioYordan Karadzhov1-1/+1
The error message, printed whene kshark_open_json_file() fails, puts the period on a new line. Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-3-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Fix a spelling typo in KsMainWindow classYordan Karadzhov2-8/+8
_restorSession* -> _restoreSession* ^ Link: http://lore.kernel.org/linux-trace-devel/20190314151012.905-2-ykaradzhov@vmware.com Suggested-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Make msg_buf_len() inlineSteven Rostedt (VMware)1-1/+1
As msg_buf_len() is a single function helper, make it an inlined function. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Add msg_buf_len() functionSlavomir Kaslev1-3/+8
Factor out common code computing message buffer length in a function. No changes in behavior intended. Link: http://lore.kernel.org/linux-trace-devel/20190315153326.5602-4-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Use text encoding for transmitting ports in protocol V3Slavomir Kaslev1-16/+61
Ports are now encoded as text in the buffer at the end of protocol V3 messages. Link: http://lore.kernel.org/linux-trace-devel/20190315153326.5602-3-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Use text encoding for options in protocol V3Slavomir Kaslev1-50/+32
Options are now encoded as text in the buffer at the end of protocol V3 messages. Unrecognized options are logged and ignored by the listener to support adding new options in the future. Link: http://lore.kernel.org/linux-trace-devel/20190315153326.5602-2-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Add icons for "Add plugins" and "Manage plugins"Yordan Karadzhov1-0/+2
Just a small cosmetic improvement. Link: http://lore.kernel.org/linux-trace-devel/20190313150717.21345-5-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Rename the menu action for managing registered pluginsYordan Karadzhov2-6/+6
The menu action in Tools that is used to manage all registered plugins is renamed in order to avoid confusion with the "Add plugins" menu action, implemented in the previous patch. Link: http://lore.kernel.org/linux-trace-devel/20190313150717.21345-4-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Add dialog for user-defined plugins to the Tools menuYordan Karadzhov2-0/+26
The dialog allows the user to find and load the plugin's library (.so file). Link: http://lore.kernel.org/linux-trace-devel/20190313150717.21345-3-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22kernel-shark: Define addPlugins method for KsPluginManagerYordan Karadzhov2-0/+26
The method can be used to register and load user-defined plugins. All other previously loaded plugins will be reinitialized and the data will be reloaded. Link: http://lore.kernel.org/linux-trace-devel/20190313150717.21345-2-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-22trace-cmd: Have tracecmd_msg_data_send() return zero on zero sizeSteven Rostedt (VMware)1-0/+4
If tracecmd_msg_data_send() is passed a size of zero, the loop is not entered, nothing is sent, but the ret variable is not initialized and garbage can be sent out. The option code can call this with a size of zero, which can cause an error report. Just don't do anything in this case, and return a success. Link: http://lore.kernel.org/linux-trace-devel/20190321194127.4ac47d99@gandalf.local.home Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace-cmd: Rename tep_is_file_bigendian() to tep_file_bigendian()Tzvetomir Stoyanov8-13/+13
In order to make libtraceevent into a proper library, its API should be straightforward. After a discussion with Steven Rostedt, we decided to rename a few APIs, to have more intuitive names. This patch renames tep_is_file_bigendian() to tep_file_bigendian(). Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-6-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.767549746@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace-cmd: Changed return logic of tep_register_event_handler() APITzvetomir Stoyanov2-2/+13
In order to make libtraceevent into a proper library, its API should be straightforward. The tep_register_event_handler() functions returns -1 in case it successfully registers the new event handler. Such return code is used by the other library APIs in case of an error. To unify the return logic of tep_register_event_handler() with the other APIs, this patch introduces enum tep_reg_handler, which is used by this function as return value, to handle all possible successful return cases. Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-5-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.628034497@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace-cmd: Changed return logic of trace_seq_printf() and ↵Tzvetomir Stoyanov1-5/+12
trace_seq_vprintf() APIs In order to make libtraceevent into a proper library, its API should be straightforward. The trace_seq_printf() and trace_seq_vprintf() APIs have inconsistent returned values with the other trace_seq_* APIs. This path changes the return logic of trace_seq_printf() and trace_seq_vprintf() to return the number of printed characters, as the other trace_seq_* related APIs. Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-4-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.485792891@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace-cmd: Initialize host_bigendian at tep_handle allocationTzvetomir Stoyanov1-1/+3
This patch initializes the host_bigendian member of the tep_handle structure with the byte order of the current host, when this handler is created - in tep_alloc() API. We need this in order to remove the tep_set_host_bigendian() API. Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-2-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.216292134@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace-cmd: Remove tep_data_event_from_type() APITzvetomir Stoyanov7-25/+11
In order to make libtraceevent into a proper library, its API should be straightforward. After discussion with Steven Rostedt, we decided to remove the tep_data_event_from_type() API and to replace it with tep_find_event(), as it does the same. Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-7-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.913841066@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-14trace_cmd: Rename struct cmdline to struct tep_cmdlineTzvetomir Stoyanov4-25/+26
In order to make libtraceevent a proper library, variables, data structures and functions should have a unique prefix to prevent name space conflicts. That prefix will be "tep_". This patch renames 'struct cmdline' to 'struct tep_cmdline'. Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-3-tstoyanov@vmware.com Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181201040852.358871851@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-13kernel-shark: Fix Doxygen warning from sched_eventsYordan Karadzhov1-1/+1
There is no reason for find_wakeup_pid being non-static. In the same time, because it is non-static, Doxygen complains about missing documentation for this function. Link: http://lore.kernel.org/linux-trace-devel/20190307154316.19194-4-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-13kernel-shark: Fix a bug in ksmodel_zoomYordan Karadzhov1-2/+2
When zooming-in the model is supposed to avoid over-zooming by recalculation the Scale factor. The new value of the Scale factor is supposed to be such that the size of the bin cannot be smaller than 5 ns. This patch fixes a naive bug in the way the new scale value is calculated. The bug was introduced in f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS") but had no effect until 94efea960 ("kernel-shark-qt: Handle the case when the range of the model is too small") because the ridiculous value of the Scale factor resulted in a very small model range and because of this the modification of the model was always rejected. Link: http://lore.kernel.org/linux-trace-devel/20190307154316.19194-3-ykaradzhov@vmware.com Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-13kernel-shark: Specify the OpenGL interface used by KernelSharkYordan Karadzhov1-0/+1
We instruct CMAKE to prefer using the legacy libGL library, if available. Although this is the default choice, the latest versions of CMAKE are printing a warning message in the case when no explicit preference is provided. Link: http://lore.kernel.org/linux-trace-devel/20190307154316.19194-2-ykaradzhov@vmware.com Suggested-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Refactore reset_max_latency() to utilize write_instance_file()Tzvetomir Stoyanov1-14/+13
This patch changes reset_max_latency() to utilize write_instance_file() for writing set_event_pid instance file, instead of directly opening it. It also changes the function to work per instance. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-7-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Fix "trace-cmd reset" command to restore the default value of ↵Tzvetomir Stoyanov1-0/+7
set_event_pid The "trace-cmd reset" command should restore ftrace to its default state. This patch sets "tracing/set_event_pid" to an empty string, when the "trace-cmd reset" command is executed. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-6-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Refactore add_event_pid()to utilize write_instance_file()Tzvetomir Stoyanov1-10/+5
This patch changes add_event_pid() to utilize write_instance_file() for writing set_event_pid instance file, instead of directly opening it. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-5-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Move write_instance_file() up in fileSteven Rostedt (VMware)1-39/+39
To allow for reset_max_latency() and add_filter_pid() to utilize write_instance_file(), move it up before those functions. It is in a better location now as well. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Fix "trace-cmd reset" command to restore default clockTzvetomir Stoyanov1-0/+10
The "trace-cmd reset" command should restore ftrace to its default state. This patch sets "tracing/trace_clock" to its default value "local", when the "trace-cmd reset" command is executed. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-4-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Fix "trace-cmd reset -a -d" segfaultTzvetomir Stoyanov1-3/+3
This patch fixes a segfault when "trace-cmd reset -a -d" is executed and there is at least one ftrace instance created. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-3-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-12trace-cmd: Fix "trace-cmd reset" command to restore "tracing_on"Tzvetomir Stoyanov1-0/+2
The "trace-cmd reset" command should restore ftrace to its default state. By default, "tracing/current_tracer" is "nop" and "tracing/tracing_on" is "1". This patch sets "tracing/tracing_on" to 1, when the command "trace-cmd reset" is executed. Link: http://lore.kernel.org/linux-trace-devel/20190311083339.21581-2-tstoyanov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-05kernel-shark: sched_events plugin init with sched_switch events onlyYordan Karadzhov1-3/+0
The sched_events plugin should not be totally disabled when the wakeup events are missing. The initialization of the plugin must fail only if the trace.dat file contains no sched_switch events. Link: http://lore.kernel.org/linux-trace-devel/20190305143924.11056-4-ykaradzhov@vmware.com Reported-by: Phil Auld <pauld@redhat.com> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-05kernel-shark: Fix a memory leak in the sched_events pluginYordan Karadzhov1-5/+6
When the sched_events plugin fails to initialize not all the memory allocated for the context of the plugin is freed properly. The problem gets fixed by using the free_context helper function defined in the previous patch. Link: http://lore.kernel.org/linux-trace-devel/20190305143924.11056-3-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: 4f392730e ("kernel-shark-qt: Make Sched event plugin use its own data collections") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-03-05kernel-shark: Define free_context function for the sched_events pluginYordan Karadzhov1-4/+12
This static helper function makes the code of the plugin cleaner and easier to read. Link: http://lore.kernel.org/linux-trace-devel/20190305143924.11056-2-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-22trace-cmd: Minor cleanup in print_stat()Slavomir Kaslev1-4/+5
Do an early out in print_stat() when `quiet` is set instead of rechecking it on each loop iteration. No changes in behavior intended. Link: http://lore.kernel.org/linux-trace-devel/20190222180539.27439-3-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-22trace-cmd: Minor cleanup in tracecmd_start_recording()Slavomir Kaslev1-5/+6
Initialize `struct timespec req` only once instead of on every loop iteration since `sleep` is being constant throughout tracecmd_start_recording() execution. No changes in behavior intended. Link: http://lore.kernel.org/linux-trace-devel/20190222180539.27439-2-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-22kernel-shark: Fix a bug in ksmodel_set_next_bin_edge()Yordan Karadzhov1-9/+0
The modification of the last bin of the model makes no sense (this is my mistake). The comment above the code that is doing this modification is partially correct, however it speaks about increasing the size of the last bin, while the code below the comment changes the lower edge of this bin. The actual increase of the size of the last bin is done in ksmodel_set_upper_edge() where the lower edge of the Upper Overflow bin gets shifted (max + 1). This effectively increases the size of the last bin. Link: http://lore.kernel.org/linux-trace-devel/20190221124205.21115-4-ykaradzhov@vmware.com Reported-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-22kernel-shark: Fix a bug in shift_XXX methods of the visualization modelYordan Karadzhov1-2/+10
In ksmodel_shift_forward() and ksmodel_shift_backward() we are supposed to recalculate only the content of the new (non-overlapping) Bins. However the loop does not take into account that the static function used to do the job actually calculates next Bin (bin + 1). The result is this misunderstanding is that we recalculate also the first overlapping Bin (n). This wipes up the effect of the bug fixed by the previous patch. Link: http://lore.kernel.org/linux-trace-devel/20190221124205.21115-3-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-22kernel-shark: Fix a bug in ksmodel_shift_backward()Yordan Karadzhov1-3/+4
Bin 0 of the new model has to be set after copying the overlaping bins from the old model. Otherwise the new content of Bin 0 will be copied into Bin "n". This bug has no effect because ksmodel_shift_backward() has a second bug in the loop over the non-overlapping bins. The second bug will be fixed in the following patch. Link: http://lore.kernel.org/linux-trace-devel/20190221124205.21115-2-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-14trace-cmd: Removed some unused #includesSlavomir Kaslev2-17/+1
This patch removes several unused #include directives. No changes in behaviour intended. Link: http://lore.kernel.org/linux-trace-devel/20190214140723.27804-3-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-14trace-cmd: Add defines for splice() flags on systems with old glibcSlavomir Kaslev1-4/+11
Use SPLICE_F_ defines to refer to splice() flags instead of their numeric values. This should be only necessary on systems with glibc version < 2.5. No changes in behavior intended. Link: http://lore.kernel.org/linux-trace-devel/20190214140723.27804-2-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-14trace-cmd: Fix tracecmd_recorder leaking file descriptorsSlavomir Kaslev1-0/+6
tracecmd_recorder is leaking brass pipe() file descriptors it creates for splice()-ing. Fix this. Link: http://lore.kernel.org/linux-trace-devel/20190214140723.27804-1-kaslevs@vmware.com Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-14kernel-shark: Implement proper reser for the OpenGL widgetYordan Karadzhov3-4/+13
When loading a new trace.dat file the OpenGL widget has to be properly reset. One important operation of this reset is to set the "_data" pointer to NULL. This will block all attempts for drawing something before the widget is set again. The bug was introduced in 7d057ae56 ("kernel-shark-qt: Add Trace Graph widget") but had no effect until 94efea960 ("kernel-shark-qt: Handle the case when the range of ...") because the number of bins of the model was zero, so nothing was plotted anyway. Link: http://lore.kernel.org/linux-trace-devel/20190214140451.827-1-ykaradzhov@vmware.com Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Fixes: 7d057ae56 ("kernel-shark-qt: Add Trace Graph widget") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-14kernel-shark: sched-plugin: Initialize plugin_sched_context_handler to zerosSteven Rostedt (VMware)1-1/+1
Now that the sched plugin only requires a single wakeup event to process the wakeup latency boxes, there's no guarantee that all the wakeup events saved in plugin_sched_context_handler will be initialized. Allocate plugin_sched_context_handler to zeros with calloc() instead of malloc() to make sure the pointers it has are NULL and not left uninitialized. Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Fixes: e50d3bbfc9a4 ("kernel-shark: Add sched_waking event processing to sched_waking") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13trace-cmd: Fix the printout of the KernelShark executable pathYordan Karadzhov1-2/+2
Adding ‘@’ to the line that is echoing in order to suppress echoing the line itself. Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-8-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Fix the compile warnings about _GNU_SOURCE being redefinedYordan Karadzhov2-0/+9
Fixes warnings from: kernel-shark/src/libkshark-configio.c and kernel-shark/src/libkshark-plugin.c Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-7-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Make the time labels of the marker more readableYordan Karadzhov1-16/+26
The precision of the displayed time of the two markers is set to 1 microsecond (as in the table). In the same time the precision of the time difference (Delta) is now 1 nanosecond, because we expect that the user do not care that much about the absolute time of the event, but may want to measure the interval between two events with the highest possible precision. The displayed time is formatted (spaces added) in a way that aims to make it easy to read the milliseconds and the microseconds. Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-6-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Don't use Data collection when checking if the bin is emptyYordan Karadzhov1-2/+4
When plotting a task graph and no data from the Task is found in the bin, we check the CPU, previously used by the task, searching for data from another task running on the same CPU. However this search will always fail if we use the Data collection of the plotted task. Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-5-ykaradzhov@vmware.com Fixes: ba206aaa45 ("kernel-shark-qt: Add C++ API for drawing of Graphs") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Check bin 0 for sched_switch event when plotting task graphsYordan Karadzhov1-9/+19
Handle the case when task is active in the Lower Overflow bin and the sched_switch event that close the task graph happens to be in bin 0. Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-4-ykaradzhov@vmware.com Fixes: ba206aaa45 ("kernel-shark-qt: Add C++ API for drawing of Graphs") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Do not copy the Upper Overflow bin when shifting forwardYordan Karadzhov1-6/+4
ksmodel_shift_forward() copies the mapping indexes of all overlapping bins of the model starting from bin "0" of the new histo up to bin "histo->n_bins - n". Then the mapping index of the old Upper Overflow bin is considered to be the mapping index of first non-overlapping bin, which is wrong. It is wrong because in ksmodel_set_upper_edge() the value of "histo->max" is considered inside the range of the model hence the Upper Overflow bin starts at "histo->max + 1" but the first non-overlapping bin will start at exactly "histo->max". Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-3-ykaradzhov@vmware.com Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Add more sanity checks for model misbehavior detectionYordan Karadzhov2-10/+25
I found that those checks are very useful for early detection of misbehavior (bugs) of the visualization model. In particular those checks helped me a lot when developing the multi-stream branch of KernelShark (future version 2.0). Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-2-ykaradzhov@vmware.com Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Rename the method for deselecting the Active marker.Yordan Karadzhov2-5/+5
This method deselects the Active marker regardless of its state (A or B). The method is renamed in order to avoid confusion with the methods for deselecting markers A and B. Link: http://lore.kernel.org/linux-trace-devel/20190212170402.10104-6-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327 Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark-qt: Do marker-deselect by right mouse click of the buttonYordan Karadzhov2-0/+34
Methods for deselecting Marker A and B are added to KsMainWindow. Those methods are connected to the "deselect" signals of the two marker buttons. Link: http://lore.kernel.org/linux-trace-devel/20190212170402.10104-5-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327 Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Define KS_NO_ROW_SELECTED as a negative row index (-1)Yordan Karadzhov3-7/+10
Currently the model of the table treats any negative value of the Passive Marker index as "No Row is Selected". In multiple places in the code the value of "-1" is used in order to deselecting the marker. Defining a dedicated constant (KS_NO_ROW_SELECTED), to be used for deselecting the Passive Marker will make the code more readable and robust. Link: http://lore.kernel.org/linux-trace-devel/20190212170402.10104-4-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327 Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Define a method in View for selecting the Passive markerYordan Karadzhov2-0/+18
The same method can be used to deselect the Passive marker. Link: http://lore.kernel.org/linux-trace-devel/20190212170402.10104-3-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327 Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Customize the marker switching buttonYordan Karadzhov2-2/+65
The handler for "mouse press events" in the customized button is reimplemented in order to provide the emission of a "deselect" signal in the case of right mouse click. Two additional signals are defined in KsDualMarkerSM. Those signals are used to re-emit the "deselect" signals of the two marker buttons. Later (in another patch) the signals will be connected to methods where the actual deselection of the markers will take place. Link: http://lore.kernel.org/linux-trace-devel/20190212170402.10104-2-ykaradzhov@vmware.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327 Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-02-13kernel-shark: Add sched_waking event processing to sched_wakingSteven Rostedt (VMware)2-0/+12
It is now more common to enable the sched_waking event than to use the sched_wakeup or sched_wakeup_new, as it encompasses both. But the sched plugin does not handle that. Fix that by including the sched_waking event as an event to use for processing schedule wakeup events. Link: http://lore.kernel.org/linux-trace-devel/20190211012154.262506802@goodmis.org Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>