summaryrefslogtreecommitdiff
path: root/tools/perf/util/svghelper.c
AgeCommit message (Collapse)Author
2018-12-17perf svghelper: Fix unchecked usage of strncpy()Arnaldo Carvalho de Melo
The strncpy() function may leave the destination string buffer unterminated, better use strlcpy() that we have a __weak fallback implementation for systems without it. In this specific case this would only happen if fgets() was buggy, as its man page states that it should read one less byte than the size of the destination buffer, so that it can put the nul byte at the end of it, so it would never copy 255 non-nul chars, as fgets reads into the orig buffer at most 254 non-nul chars and terminates it. But lets just switch to strlcpy to keep the original intent and silence the gcc 8.2 warning. This fixes this warning on an Alpine Linux Edge system with gcc 8.2: In function 'cpu_model', inlined from 'svg_cpu_box' at util/svghelper.c:378:2: util/svghelper.c:337:5: error: 'strncpy' output may be truncated copying 255 bytes from a string of length 255 [-Werror=stringop-truncation] strncpy(cpu_m, &buf[13], 255); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Fixes: f48d55ce7871 ("perf: Add a SVG helper library file") Link: https://lkml.kernel.org/n/tip-xzkoo0gyr56gej39ltivuh9g@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-08-23perf timechart: Use NSEC_PER_U?SECArnaldo Carvalho de Melo
Following kernel practices, using linux/time64.h Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stanislav Fomichev <stfomichev@yandex-team.ru> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-5l1md8lsdhfnrlsqyejzo9w2@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-06-25perf tools: Add reference counting for cpu_map objectJiri Olsa
Adding refference counting for cpu_map object, so it could be easily shared among other objects. Using cpu_map__put instead cpu_map__delete and making cpu_map__delete static. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1435012588-9007-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-07-10perf timechart: Implement IO modeStanislav Fomichev
Currently, timechart records only scheduler and CPU events (task switches, running times, CPU power states, etc); this commit adds IO mode which makes it possible to record IO (disk, network) activity. In this mode perf timechart will generate SVG with IO charts (writes, reads, tx, rx, polls). Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/n/1404835423-23098-3-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Jiri Olsa <jolsa@kernel.org>
2014-07-10perf timechart: Fix rendering in FirefoxStanislav Fomichev
Firefox doesn't correctly handle cases where we specify number in quotes and have some padding around the number, like the following: <rect ... height=" 3.1" ...> In this case, it doesn't draw the figure. This patch removes 'field width' component from fprintf strings to fix it. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/n/1404835423-23098-2-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Jiri Olsa <jolsa@kernel.org>
2014-05-01tools: Consolidate types.hBorislav Petkov
Combine all definitions into a common tools/include/linux/types.h and kill the wild growth elsewhere. Move DECLARE_BITMAP to its proper bitmap.h header. Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Link: http://lkml.kernel.org/n/tip-azczs7qcv6h9xek9od10hiv2@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
2013-12-27perf tools: Use zfree to help detect use after free bugsArnaldo Carvalho de Melo
Several areas already used this technique, so do some audit to consistently use it elsewhere. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-9sbere0kkplwe45ak6rk4a1f@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-17perf timechart: Add --highlight optionStanislav Fomichev
This option highlights tasks (using different color) that run more than given duration or tasks with given name. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ramkumar Ramachandra <artagnon@gmail.com> Link: http://lkml.kernel.org/r/20131217155349.GA13021@stfomichev-desktop Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-16perf timechart: Add support for topologyStanislav Fomichev
Add -t switch to sort CPUs topologically. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ramkumar Ramachandra <artagnon@gmail.com> Link: http://lkml.kernel.org/r/1385995056-20158-5-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-16perf timechart: Print pid along the nameStanislav Fomichev
Add PID to the figures of CPU usage timechart. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ramkumar Ramachandra <artagnon@gmail.com> Link: http://lkml.kernel.org/r/1385995056-20158-3-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-16perf timechart: Add backtrace support to CPU infoStanislav Fomichev
Add backtrace info to the CPU usage timechart. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ramkumar Ramachandra <artagnon@gmail.com> Link: http://lkml.kernel.org/r/1385995056-20158-2-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-11-27perf timechart: Add backtrace supportStanislav Fomichev
Add -g flag to `perf timechart record` which saves callchain info in the perf.data. When generating SVG, add backtrace information to the figure details, so now it's possible to see which code path woke up the task and why some task went to sleep. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1383323151-19810-8-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-11-27perf timechart: Group figures and add title with detailsStanislav Fomichev
Add titles to figures so we can run SVG interactively in Firefox and check event details in the tooltips. This also aids exploring SVG with Inkscape because when user clicks on one part of logical figure, all parts are selected. It's also possible to read titles with Inkscape in the object details. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1383323151-19810-6-git-send-email-stfomichev@yandex-team.ru Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-02-28perf timechart: Fix black idle boxes in the titleThomas Renninger
This fix is needed for eye of gnome and firefox svg viewers. Only Inkscape can handle the broken case. Compare with the other svg_legenda_box declarations, looks like a typo slipped in at this place. Signed-off-by: Thomas Renninger <trenn@suse.de> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: lenb@kernel.org LKML-Reference: <1298842606-55712-5-git-send-email-trenn@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-01-22perf tools: Fix time function double declaration with glibcThomas Renninger
It's enough to include the local "debug.h" file to trigger it. man time reveals this is already declared in glibc: time - get time in seconds -> rename the variable. Cc: Ingo Molnar <mingo@elte.hu> Cc: arjan@infradead.org LPU-Reference: <1295620209-13859-2-git-send-email-trenn@suse.de> Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-01-22perf tools: Fix 64 bit integer format stringsArnaldo Carvalho de Melo
Using %L[uxd] has issues in some architectures, like on ppc64. Fix it by making our 64 bit integers typedefs of stdint.h types and using PRI[ux]64 like, for instance, git does. Reported by Denis Kirjanov that provided a patch for one case, I went and changed all cases. Reported-by: Denis Kirjanov <dkirjanov@kernel.org> Tested-by: Denis Kirjanov <dkirjanov@kernel.org> LKML-Reference: <20110120093246.GA8031@hera.kernel.org> Cc: Denis Kirjanov <dkirjanov@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Pingtian Han <phan@redhat.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-10-20perf timechart: Improve the visual appearance of scheduler delaysArjan van de Ven
[from KS feedback] Currently, scheduler delays are shown in a mostly transparent, light yellow color. This color is rather hard to see on several screens, especially projectors. This patch changes the color of the scheduler delays to be a much more "hard" yellow that survived the kernel summit projector. Reported-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20091020064731.20ae126a@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-10-01perf timechart: Add a power-only modeArjan van de Ven
For doing work on the Linux power management components, I need to make long (30+ seconds) traces. Currently, this then results in a HUGE svg file, with mostly process data that isn't interesting. This patch adds a --power-only mode to perf timechart that only outputs the CPU power section of the SVG; this significantly reduces the size of the SVG file, making even 30+ second traces viewable with inkscape. As a minor tweak for the same effect, the minimum text size is decreased; current inkscape cannot zoom in deep enough to show text this small, but it reduces inkscape compute time. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: peterz@infradead.org LKML-Reference: <20090924154013.0675ab71@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-20perf util: SVG performance improvementsArjan van de Ven
Tweak the output SVG to increase performance in SVG viewers by limiting the different types of font sizes and by smarter transformations on the text. At least with Inkscape this gives a notable performance improvement during zoom and scrolling. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090920181438.3a49cb93@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-20perf util: Make the timechart SVG width dynamicArjan van de Ven
This patch adds a command line option for timechart that allows the user to specify the width of the SVG file. This patch also makes sure that each second of recording has at least 200 units (pixels at 96 DPI) of width. This impacts recordings longer than 5 seconds; recordings shorter than 5 second will scale up to have a width of 1000 units for the whole recording (as before). Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090920181416.69570c5d@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-20perf timechart: Show the duration of scheduler delays in the SVGArjan van de Ven
Given that scheduler latencies are the hot thing nowadays, show the duration of said latencies in the SVG in text form. In addition, if the latency is more than 10 msec, pick a brighter yellow color as a way to point these long delays out. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090920181353.796f4509@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-20perf timechart: Show the name of the waker/wakee in timechartArjan van de Ven
Timechart currently shows thin green lines for sending or receiving wakeups. This patch also prints (in a very small font) the name of the process that is being woken/wakes up this process. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090920181328.68baa978@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-19perf utils: Be consistent about minimum text size in the svghelperArjan van de Ven
Be more consistent in the svghelper about the minimum text size by having a global #define for this. There needs to be a minimum text size in order to keep the size of the SVG file within the reach of what current SVG viewers can cope with. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: fweisbec@gmail.com Cc: peterz@infradead.org Cc: Paul Mackerras <paulus@samba.org> Cc: Arjan van de Ven <arjan@infradead.org> LKML-Reference: <20090919133507.7374ef8b@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-19perf: Add a SVG helper library fileArjan van de Ven
The timechart tool writes out SVG format output; this patch adds a set of helper functions to abstract dealing with SVG from the core timechart code. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090912130613.677f0516@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>