Milian Wolff [Mon, 15 Jun 2015 23:41:18 +0000 (01:41 +0200)]
Include 0 as first chart datapoint.
Milian Wolff [Mon, 15 Jun 2015 23:40:22 +0000 (01:40 +0200)]
advertise heaptrack_gui
Milian Wolff [Mon, 15 Jun 2015 23:37:37 +0000 (01:37 +0200)]
Also show total bytes allocated over time.
Milian Wolff [Mon, 15 Jun 2015 23:32:11 +0000 (01:32 +0200)]
Also show total number of allocations over time.
Milian Wolff [Mon, 15 Jun 2015 23:12:20 +0000 (01:12 +0200)]
Show total leaked data in graph.
Milian Wolff [Mon, 15 Jun 2015 22:14:09 +0000 (00:14 +0200)]
Prepare for addition of more visualizations.
Refactors loading of files into its own class and cleans up the
implementation of the (bottom-up) model.
Milian Wolff [Mon, 15 Jun 2015 21:29:31 +0000 (23:29 +0200)]
Add about data, enable loading of multiple files.
Milian Wolff [Mon, 15 Jun 2015 21:03:37 +0000 (23:03 +0200)]
Group disabling of stdio locking code.
Milian Wolff [Mon, 15 Jun 2015 20:58:06 +0000 (22:58 +0200)]
Use binary search in TraceTree.
Milian Wolff [Mon, 15 Jun 2015 20:48:34 +0000 (22:48 +0200)]
Rename function - it's not a dlopen callback, but a dl_iterate_phdr one.
Milian Wolff [Mon, 15 Jun 2015 20:42:41 +0000 (22:42 +0200)]
Two more coments
Milian Wolff [Mon, 15 Jun 2015 20:28:21 +0000 (22:28 +0200)]
Merge branch 'gui'
Milian Wolff [Mon, 15 Jun 2015 20:26:07 +0000 (22:26 +0200)]
Run more stuff in parallel.
Milian Wolff [Mon, 15 Jun 2015 19:46:36 +0000 (21:46 +0200)]
Add tooltip to header
Milian Wolff [Mon, 15 Jun 2015 19:46:28 +0000 (21:46 +0200)]
Merge location columns.
Milian Wolff [Mon, 15 Jun 2015 19:37:07 +0000 (21:37 +0200)]
Make filter case insensitive
Milian Wolff [Mon, 15 Jun 2015 19:27:03 +0000 (21:27 +0200)]
Show debuggee command line in heaptrack_gui
Milian Wolff [Mon, 15 Jun 2015 19:11:55 +0000 (21:11 +0200)]
Make heaptrack more compatible with other debug tools.
Ignore any '--' parameter.
Milian Wolff [Mon, 15 Jun 2015 19:11:06 +0000 (21:11 +0200)]
Skip one more level in backtraces in debug builds.
Otherwise, the malloc function would still be shown in the backtrace
and thereby breaking the aggregation we use elsewhere.
Milian Wolff [Fri, 12 Jun 2015 13:37:38 +0000 (15:37 +0200)]
Translate summary.
Milian Wolff [Fri, 12 Jun 2015 13:27:42 +0000 (15:27 +0200)]
Show full merged backtraces in heaptrack_gui.
Milian Wolff [Sun, 7 Jun 2015 18:50:21 +0000 (20:50 +0200)]
use KFormat for byte formatting in Qt model implementation.
Milian Wolff [Sun, 7 Jun 2015 18:27:09 +0000 (20:27 +0200)]
Copy the massif-visualizer GUI pattern with open/load/result pages.
Also load the data in a background thread with ThreadWeaver.
Milian Wolff [Sun, 7 Jun 2015 18:23:59 +0000 (20:23 +0200)]
Fix style and fix early-return check for Model::data()
Milian Wolff [Sun, 7 Jun 2015 16:59:07 +0000 (18:59 +0200)]
Make it possible to filter by function, module and file info.
Milian Wolff [Sun, 7 Jun 2015 16:47:02 +0000 (18:47 +0200)]
Allow filtering by file/module as well.
Milian Wolff [Sun, 7 Jun 2015 16:05:12 +0000 (18:05 +0200)]
Cleanup CMake code a bit
Milian Wolff [Sun, 7 Jun 2015 15:57:26 +0000 (17:57 +0200)]
Link against KF5, use KRecursiveFilterProxyModel, fix some issues.
Milian Wolff [Sun, 7 Jun 2015 11:53:21 +0000 (13:53 +0200)]
Deduplicate shown functions by skipping first, merged, level.
Milian Wolff [Sun, 7 Jun 2015 11:50:16 +0000 (13:50 +0200)]
Return empty QString when no file was available.
Fixes assertion in ModelTest.
Milian Wolff [Sun, 7 Jun 2015 11:47:32 +0000 (13:47 +0200)]
Show backtrace in tooltip.
Milian Wolff [Sun, 7 Jun 2015 11:32:59 +0000 (13:32 +0200)]
Add modeltest sources
Milian Wolff [Sun, 7 Jun 2015 11:32:14 +0000 (13:32 +0200)]
Show sub-traces of merged allocation data in the model.
Milian Wolff [Sun, 7 Jun 2015 10:43:30 +0000 (12:43 +0200)]
Move some helper functions into the shared file, will use that later for tooltips
Milian Wolff [Sun, 7 Jun 2015 10:30:49 +0000 (12:30 +0200)]
Add filter by function
Milian Wolff [Sun, 7 Jun 2015 10:30:42 +0000 (12:30 +0200)]
Show function, file and module information
Milian Wolff [Sun, 7 Jun 2015 10:05:27 +0000 (12:05 +0200)]
Sort view
Milian Wolff [Sun, 7 Jun 2015 09:59:02 +0000 (11:59 +0200)]
Show merged allocation data in model.
Milian Wolff [Sun, 7 Jun 2015 09:48:20 +0000 (11:48 +0200)]
Move data into model.
Milian Wolff [Sun, 7 Jun 2015 09:34:30 +0000 (11:34 +0200)]
Merge branch 'master' into gui
Milian Wolff [Sat, 30 May 2015 12:20:02 +0000 (14:20 +0200)]
Set version to 0.1.0 and include it in the tools.
Milian Wolff [Sat, 23 May 2015 21:30:09 +0000 (23:30 +0200)]
Do not crash after injection in ld-linux.
Apparently it is a very bad idea to overwrite e.g. free in ld-linux,
and it triggered crashes when trying to inject heaptrack into a KF5
application such as kwrite.
Milian Wolff [Thu, 21 May 2015 09:05:34 +0000 (11:05 +0200)]
Cleanup code slightly for readability
Milian Wolff [Mon, 18 May 2015 15:59:22 +0000 (17:59 +0200)]
Merge branch 'master' into gui
Matthias Schwarzott [Mon, 18 May 2015 10:05:47 +0000 (12:05 +0200)]
Fix compilation error on some platforms.
See also: https://bugs.gentoo.org/show_bug.cgi?id=548850
Milian Wolff [Mon, 18 May 2015 14:13:59 +0000 (16:13 +0200)]
Start a simple Qt GUI and share some code with the ASCII printer.
Matthias Schwarzott [Mon, 18 May 2015 10:05:47 +0000 (12:05 +0200)]
Fix compilation error on some platforms.
See also: https://bugs.gentoo.org/show_bug.cgi?id=548850
Milian Wolff [Thu, 30 Apr 2015 11:26:27 +0000 (13:26 +0200)]
Stay backwards compatible to old Boost 1.41 for RHEL 6 compatibility.
Milian Wolff [Thu, 30 Apr 2015 11:21:58 +0000 (13:21 +0200)]
Set CMAKE_INSTALL_RPATH_USE_LINK_PATH to true.
This makes it simpler to run heaptrack against e.g. a
libunwind available in the CMAKE_INSTALL_PREFIX. Otherwise,
one would have to set the LD_LIBRARY_PATH manually.
Milian Wolff [Thu, 30 Apr 2015 10:59:56 +0000 (12:59 +0200)]
Don't fail to compile when aligned alloc is not available.
Milian Wolff [Mon, 27 Apr 2015 12:57:23 +0000 (14:57 +0200)]
Make symlinked heaptrack shell script work properly.
Milian Wolff [Wed, 15 Apr 2015 14:06:09 +0000 (16:06 +0200)]
Link against pthread in the heaptrack libraries.
This is required to run properly against debuggees that do not
use threads at all.
Reported-by: Yehezkel Horowitz <horowity@checkpoint.com>
Reported-by: Anatolii Koval <AKoval@luxoft.com>
Anatolii Koval [Wed, 15 Apr 2015 14:02:40 +0000 (16:02 +0200)]
Use dlmopen when trying to inject heaptrack_inject.
Some systems use an optimized dlopen symbol (especially embeded linux
modifications), but these don't touch dlmopen, which is more general.
This prevents an "dlopen - symbol not found" error when trying to
inject heaptrack on such systems to a running process.
Milian Wolff [Wed, 15 Apr 2015 13:43:25 +0000 (15:43 +0200)]
Improve output and document -p and --pid arguments.
Milian Wolff [Wed, 15 Apr 2015 13:08:45 +0000 (15:08 +0200)]
Fix build on machines where size_t != lu.
Reported-by: Yehezkel Horowitz <horowity@checkpoint.com>
Volker Krause [Sat, 17 Jan 2015 15:51:06 +0000 (16:51 +0100)]
Don't override LD_PRELOAD, just prepend to it.
This enables usage on targets that use LD_PRELOAD themselves already.
Milian Wolff [Wed, 14 Jan 2015 15:13:32 +0000 (16:13 +0100)]
Add backtrace filter via --filter-bt-function.
Only allocations with a function matching the filter will be printed.
Milian Wolff [Tue, 13 Jan 2015 15:48:56 +0000 (16:48 +0100)]
Make warnings errors as we rely on the libbacktrace features.
Peter Bortas [Tue, 30 Dec 2014 17:22:52 +0000 (18:22 +0100)]
Allow for whitespace in program name and arguments.
Milian Wolff [Mon, 22 Dec 2014 13:52:39 +0000 (14:52 +0100)]
Use correct allocation data for massif peak data.
This way, the sum of the detailed backtraces equals the total snapshot
count. While the x axis is wrong then, this is not so important I
think. Rather, we want to find the memory hotspots which is much
easier this way.
Milian Wolff [Mon, 22 Dec 2014 13:35:09 +0000 (14:35 +0100)]
Disable malloc_info baseline when attaching to running process.
In such cases, we are more interested in the relative increase. We
do not want to apply the relative threshold based on the absolute
baseline for example, but rather to the data we obtained.
Milian Wolff [Mon, 22 Dec 2014 13:03:30 +0000 (14:03 +0100)]
Make start time const.
Milian Wolff [Mon, 22 Dec 2014 13:03:21 +0000 (14:03 +0100)]
Don't fail when trying to join the timer thread.
Milian Wolff [Mon, 22 Dec 2014 12:23:15 +0000 (13:23 +0100)]
Silence GDB stdout messages by using --batch-silent.
Milian Wolff [Mon, 22 Dec 2014 12:22:27 +0000 (13:22 +0100)]
Also print exit message when killing heaptrack via CTRL+C.
Milian Wolff [Mon, 22 Dec 2014 12:19:16 +0000 (13:19 +0100)]
Do not load gdbinit file or symbols when attaching to process.
Instead, only load the two libs we actually need, libdl for dlopen
and libheaptrack_inject for the init function.
Milian Wolff [Thu, 18 Dec 2014 19:04:41 +0000 (20:04 +0100)]
Cleanup code for operator new skipping in backtraces.
Milian Wolff [Thu, 18 Dec 2014 18:36:54 +0000 (19:36 +0100)]
Also stop backtraces after __static_initialization_and_destruction_0.
Additionally, we can now cope with backtraces that either show
main or __libc_start_main, and stop at the first occurrance
of either symbol.
Milian Wolff [Wed, 17 Dec 2014 13:09:19 +0000 (14:09 +0100)]
Fix major regression: Get backtrace in malloc properly.
Zomg, I must have been asleep when I comitted this - sorry.
Milian Wolff [Wed, 17 Dec 2014 12:49:44 +0000 (13:49 +0100)]
Remove explicit std:: qualification, we use that namespace.
Milian Wolff [Wed, 17 Dec 2014 12:46:24 +0000 (13:46 +0100)]
Instead of yielding the thread, sleep for one micro second.
This significantly improves the performance of the threaded
test example. The reason are the far reduced numbers of context
switches (goes down by about 90%):
Perf stat results averaged over ten runs are:
before:
1537.459666 task-clock (msec) # 2.741 CPUs utilized ( +- 1.98% )
164,214 context-switches # 0.107 M/sec ( +- 4.77% )
1,238 cpu-migrations # 0.805 K/sec ( +- 1.42% )
3,996 page-faults # 0.003 M/sec ( +- 0.26% )
3,531,767,774 cycles # 2.297 GHz ( +- 1.96% ) [56.85%]
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
4,404,564,712 instructions # 1.25 insns per cycle ( +- 1.81% ) [82.34%]
895,286,284 branches # 582.315 M/sec ( +- 1.83% ) [82.05%]
14,800,878 branch-misses # 1.65% of all branches ( +- 2.07% ) [83.04%]
0.
560967210 seconds time elapsed ( +- 1.78% )
after:
940.204408 task-clock (msec) # 1.970 CPUs utilized ( +- 0.97% )
16,628 context-switches # 0.018 M/sec ( +- 2.09% )
1,709 cpu-migrations # 0.002 M/sec ( +- 2.02% )
3,733 page-faults # 0.004 M/sec ( +- 0.62% )
2,299,207,706 cycles # 2.445 GHz ( +- 0.95% ) [54.67%]
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
3,203,389,330 instructions # 1.39 insns per cycle ( +- 1.48% ) [84.25%]
717,416,828 branches # 763.043 M/sec ( +- 1.01% ) [77.86%]
11,127,629 branch-misses # 1.55% of all branches ( +- 0.98% ) [76.95%]
0.
477194059 seconds time elapsed ( +- 0.34% )
Note that we utilize less CPUs (which is good, as it safes power), but
still decrease the total run time, as do number of cycles spent
and instructions executed.
Milian Wolff [Wed, 17 Dec 2014 12:40:27 +0000 (13:40 +0100)]
Use acquire semantics after all... ;-)
According to this page, the relaxed semantics are a useless
optimization and might in fact degrade performance on some systems:
http://www.boost.org/doc/libs/master/doc/html/atomic/usage_examples.html#boost_atomic.usage_examples.example_spinlock
Milian Wolff [Wed, 17 Dec 2014 12:38:21 +0000 (13:38 +0100)]
Cleanup spinlock implementation.
- use atomic::exchange
- use relaxed memory order in loop
Milian Wolff [Mon, 15 Dec 2014 18:02:44 +0000 (19:02 +0100)]
Cope with broken backtraces.
Still output a 0 trace index and print ?? later.
Milian Wolff [Fri, 12 Dec 2014 23:57:02 +0000 (00:57 +0100)]
Refactor code once more for yet better thread safety at shutdown.
Instead of using flockfile, we use a simple spin lock now. This
is even a bit faster than using flockfile, and does not have any
issues at shutdown, when the file was deleted already.
Also, the spin lock can easily be combined with the check for
when the timer thread should be stopped.
Furthermore, the code is restructured to ensure the thread-unsafe
API is only ever getting called while the lock is held.
To simplify future development, some debug log can now be enabled
which will trace the heaptrack execution.
Milian Wolff [Thu, 11 Dec 2014 14:04:20 +0000 (15:04 +0100)]
Set cmake requirement to 2.8.9 and use LINK_PRIVATE.
Hopefully this restores building it with an older CMake version.
Milian Wolff [Thu, 11 Dec 2014 13:37:40 +0000 (14:37 +0100)]
Only one trap can be added.
This prevents leakage of the /tmp/heaptrack_fifo$$ files.
Milian Wolff [Thu, 11 Dec 2014 13:32:59 +0000 (14:32 +0100)]
Adapt to libunwind changes with unw_set_cache_size.
Milian Wolff [Wed, 10 Dec 2014 22:08:17 +0000 (23:08 +0100)]
Silence build warnings, as was done before in vogl/apitrace.
Milian Wolff [Wed, 10 Dec 2014 18:30:29 +0000 (19:30 +0100)]
Add noexcept
Milian Wolff [Wed, 10 Dec 2014 18:27:11 +0000 (19:27 +0100)]
Compile in pedantic mode.
Milian Wolff [Wed, 10 Dec 2014 18:23:51 +0000 (19:23 +0100)]
Remove dead code
Milian Wolff [Wed, 10 Dec 2014 18:10:18 +0000 (19:10 +0100)]
Write accurate end time on shutdown.
Also print out bytes allocated per second and allocations per
second in heaptrack_print overview.
Milian Wolff [Wed, 10 Dec 2014 17:04:42 +0000 (18:04 +0100)]
Minimize changes against libbacktrace.
Instead, we export more elf internals and call that directly from
heaptrack_interpret. This should make it simpler to keep the
libbacktrace checkout in sync with upstream changes.
Milian Wolff [Wed, 10 Dec 2014 15:56:57 +0000 (16:56 +0100)]
Remove dead code and enable more warnings when building.
Milian Wolff [Wed, 10 Dec 2014 15:25:27 +0000 (16:25 +0100)]
Update libbacktrace to latest version from GCC 4.9 git branch.
This should fix a serious memory issue in libbacktrace, see:
https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00547.html
Thanks for the report and analysis to André Wöbbeking.
CCMAIL: Woebbeking@kde.org
Milian Wolff [Wed, 10 Dec 2014 14:06:08 +0000 (15:06 +0100)]
Mark Boost and Threads as required dependencies.
Milian Wolff [Tue, 9 Dec 2014 20:54:07 +0000 (21:54 +0100)]
Overwrite symbols after dlopen in injected heaptrack.
Milian Wolff [Tue, 9 Dec 2014 20:42:30 +0000 (21:42 +0100)]
Mark module cache dirty on initialization.
This is required for multiple reattachements.
Milian Wolff [Tue, 9 Dec 2014 19:27:47 +0000 (20:27 +0100)]
Use a custom thread + sleep_for instead of a C timer.
This makes re-attaching work without deadlocks in timer_delete
for me. And we can clean the code up even more now:
Much less code, yet still more accurate. The overhead is negleglible
in my tests. And this makes it trivial for the future to let users
configure the interval themselves.
Milian Wolff [Tue, 9 Dec 2014 17:59:59 +0000 (18:59 +0100)]
Refactor the code to allow multiple runtime-injections.
This is sometimes useful. This way, you can hop on/off
as you like and just investigate the areas you are
interested in.
Milian Wolff [Tue, 9 Dec 2014 14:33:55 +0000 (15:33 +0100)]
Refactor hook initialization in heaptrack_preload.
The previous code works with clang, but not with GCC. This new
code works with GCC, and, hopefully, also with clang. It does not
depend on static initialization order anymore, as the string
identifiers of the hook functions are initialized via constexpr now.
This fixes the heaptrack_preload usage for me on this machine.
Milian Wolff [Tue, 9 Dec 2014 10:19:56 +0000 (11:19 +0100)]
Remove code that does not compile with slightly older compilers.
Milian Wolff [Tue, 9 Dec 2014 10:18:08 +0000 (11:18 +0100)]
Add compile-check around unw_set_cache_log_size.
Milian Wolff [Tue, 9 Dec 2014 01:11:24 +0000 (02:11 +0100)]
Silence warning when debuggee quit already.
Milian Wolff [Tue, 9 Dec 2014 01:08:55 +0000 (02:08 +0100)]
Restore original function addresses when shutting down injected heaptrack.
This should bring back the original behavior and performance.
And we might also be able to re-attach then if desired.
Milian Wolff [Tue, 9 Dec 2014 00:51:06 +0000 (01:51 +0100)]
Return output stream
Milian Wolff [Tue, 9 Dec 2014 00:49:49 +0000 (01:49 +0100)]
Merge branch 'inject'
Milian Wolff [Tue, 9 Dec 2014 00:45:24 +0000 (01:45 +0100)]
Stop heaptrack when heaptrack_interpret goes away.
Milian Wolff [Tue, 9 Dec 2014 00:13:57 +0000 (01:13 +0100)]
Add -p/--pid option to attach heaptrack to a running process.
We use gdb to attach to the process, then call dlopen there and
finally an initialization hook in the new libheaptrack_inject.so.
To prevent an underflow in the total memory consumption, we
call malloc_info and parse that in heaptrack_interpret to get a
baseline for the current total memory consumption at the point
where we attached to the process.
The code is refactored into a shared libheaptrack.cpp with common
code, and two libraries, libheaptrack_inject.so and the old
libheaptrack_preload.so. The heaptrack bash script is adapted to
support both versions.