sdk/tools/heaptrack.git
7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Sat, 4 Mar 2017 06:13:43 +0000 (07:13 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoExclude unresolved functions from recursion detection.
Milian Wolff [Sun, 26 Feb 2017 21:05:20 +0000 (22:05 +0100)]
Exclude unresolved functions from recursion detection.

Previously, when we encountered a stack with two consecutive frames
with missing debug information, we thought it would indicate recursion
and then collapsed all frames beneath. Now, we exclude frames with
missing debug information and don't collapse the stacks anymore.

7 years agoRemove now-dead code
Milian Wolff [Sun, 26 Feb 2017 20:50:35 +0000 (21:50 +0100)]
Remove now-dead code

7 years agoImprove the bottom-up conversion to top-down and caller/callee data
Milian Wolff [Sun, 26 Feb 2017 20:25:15 +0000 (21:25 +0100)]
Improve the bottom-up conversion to top-down and caller/callee data

When we encounter broken backtraces, we may not go all the way up
to main. In such cases, a non-leaf frame may actually have a cost
higher than the sum of its children. In these cases, we also have
to hande the difference in cost just like for a normal leaf node.

The manual test I added does not cover this properly, as the
unwinding is too reliable and thus we do not run into the corner case.
In real-world profiles though, this does occur and adds some errors.
This is now fixed and the caller/callee and top-down view become
more reliable.

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Sun, 26 Feb 2017 06:51:10 +0000 (07:51 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Sun, 26 Feb 2017 05:46:07 +0000 (06:46 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoEnable alternating row colors for caller/callee view
Milian Wolff [Thu, 23 Feb 2017 09:27:09 +0000 (10:27 +0100)]
Enable alternating row colors for caller/callee view

7 years agoMove top-view properties to .ui file, enable alternating row colors
Milian Wolff [Thu, 23 Feb 2017 09:25:59 +0000 (10:25 +0100)]
Move top-view properties to .ui file, enable alternating row colors

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Thu, 23 Feb 2017 07:13:09 +0000 (08:13 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Thu, 23 Feb 2017 06:13:29 +0000 (07:13 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoFix action enabled state
Milian Wolff [Wed, 22 Feb 2017 12:38:38 +0000 (13:38 +0100)]
Fix action enabled state

- only enable Open when we are not showing the open page already
- only disable Open and Close when we are not currently parsing a file

7 years agoFix compile with older KF5, as e.g. available on Ubuntu 16.04
Milian Wolff [Wed, 22 Feb 2017 12:36:25 +0000 (13:36 +0100)]
Fix compile with older KF5, as e.g. available on Ubuntu 16.04

7 years agoEnable wordwrap in summary labels
Milian Wolff [Tue, 21 Feb 2017 08:23:13 +0000 (09:23 +0100)]
Enable wordwrap in summary labels

When we encounter long debuggee command lines, we used to put them
into one line. This increased the minimal width of the mainwindow,
which could even expand beyond the screen dimensions, making parts
of the window invisible.

By enabling wordwrap, we can break the command line after every
argument. Additionally, to cope with extremely long arguments,
we add zero-width spaces after every 50 word characters, to enable
word wrap at these places.

BUG: 376741

7 years agoDocument how to contribute to heaptrack
Milian Wolff [Tue, 21 Feb 2017 07:54:13 +0000 (08:54 +0100)]
Document how to contribute to heaptrack

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Mon, 20 Feb 2017 06:39:42 +0000 (07:39 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Mon, 20 Feb 2017 05:45:04 +0000 (06:45 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Sun, 19 Feb 2017 06:37:47 +0000 (07:37 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Sat, 18 Feb 2017 06:55:48 +0000 (07:55 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Sat, 18 Feb 2017 06:01:16 +0000 (07:01 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Fri, 17 Feb 2017 06:27:36 +0000 (07:27 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Fri, 17 Feb 2017 05:43:37 +0000 (06:43 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Thu, 16 Feb 2017 06:38:37 +0000 (07:38 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Thu, 16 Feb 2017 05:45:11 +0000 (06:45 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoSVN_SILENT made messages (.desktop file) - always resolve ours
l10n daemon script [Wed, 15 Feb 2017 07:00:01 +0000 (08:00 +0100)]
SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

7 years agoGIT_SILENT made messages (after extraction)
l10n daemon script [Wed, 15 Feb 2017 06:02:53 +0000 (07:02 +0100)]
GIT_SILENT made messages (after extraction)

7 years agoDon't build the flamegraph twice on initial load
Milian Wolff [Mon, 13 Feb 2017 23:41:43 +0000 (00:41 +0100)]
Don't build the flamegraph twice on initial load

We get a resize event followed by a show event, both of which
used to trigger a rebuild of the flame graph. Now, we only react
once to that.

7 years agoEnsure the brushes are properly initialized in a thread-safe way
Milian Wolff [Mon, 13 Feb 2017 23:31:08 +0000 (00:31 +0100)]
Ensure the brushes are properly initialized in a thread-safe way

Fixes a crash under some circumstances, when multiple graphs
are build in parallel - something that needs to be investigated
separately.

7 years agoSet context menu policy on flamegraph main widget
Milian Wolff [Mon, 13 Feb 2017 23:29:33 +0000 (00:29 +0100)]
Set context menu policy on flamegraph main widget

Unbreaks the context menu, since the actions are set on the
main widget, but the policy was set on the view.

7 years agoUse KStandardAction for flamegraph forward/back actions.
Milian Wolff [Mon, 13 Feb 2017 23:25:11 +0000 (00:25 +0100)]
Use KStandardAction for flamegraph forward/back actions.

7 years agoUse i18n in favor of QObject::tr
Milian Wolff [Mon, 13 Feb 2017 23:25:45 +0000 (00:25 +0100)]
Use i18n in favor of QObject::tr

7 years agoapply clang-format
Milian Wolff [Mon, 13 Feb 2017 23:16:43 +0000 (00:16 +0100)]
apply clang-format

7 years agoAdd open/open new/close/quit actions to file menu
Milian Wolff [Mon, 13 Feb 2017 23:16:02 +0000 (00:16 +0100)]
Add open/open new/close/quit actions to file menu

7 years agoAdd .desktop and appdata files
Milian Wolff [Mon, 13 Feb 2017 22:14:12 +0000 (23:14 +0100)]
Add .desktop and appdata files

7 years agoPass explicit parent to QAction ctor, fixes build on Ubuntu Xenial.
Milian Wolff [Sun, 12 Feb 2017 12:31:06 +0000 (13:31 +0100)]
Pass explicit parent to QAction ctor, fixes build on Ubuntu Xenial.

Seems like the default of `= nullptr` has been added recently to Qt.

BUG: 376247

7 years agoOptimize aggregation of caller/callee data
Milian Wolff [Mon, 30 Jan 2017 20:55:19 +0000 (21:55 +0100)]
Optimize aggregation of caller/callee data

Previously, we did that on the unmerged data which means we had
to traverse way more stacks. Now, we instead use the merged data
as input and thereby can get rid of ~50% of the hash allocations
alone used for the recursion guard. This is the #1 hotspot when
it comes to allocation numbers so far, so that boils down to easily
millions of allocations.

7 years agoShow whether data comes from a runtime attached profile in GUI
Milian Wolff [Sun, 29 Jan 2017 19:41:37 +0000 (20:41 +0100)]
Show whether data comes from a runtime attached profile in GUI

7 years agoremove empty line
Milian Wolff [Sun, 29 Jan 2017 19:35:30 +0000 (20:35 +0100)]
remove empty line

7 years agoAdd format_sources for use with KDevelop's reformat-sources action.
Milian Wolff [Sun, 29 Jan 2017 19:32:29 +0000 (20:32 +0100)]
Add format_sources for use with KDevelop's reformat-sources action.

Note: this depends on clang-format and moreutils' sponge

7 years agoCleanup: add Elf namespace with typedefs for ElfW types
Milian Wolff [Sun, 29 Jan 2017 19:31:06 +0000 (20:31 +0100)]
Cleanup: add Elf namespace with typedefs for ElfW types

This looks much nicer in the C++ code below, and plays better with
clang-format as well.

7 years agoFix warning about undefined behavior when expanding macro
Milian Wolff [Sun, 29 Jan 2017 19:25:42 +0000 (20:25 +0100)]
Fix warning about undefined behavior when expanding macro

See e.g. https://reviews.llvm.org/D15866 for more information

7 years agoremove dead code
Milian Wolff [Sun, 29 Jan 2017 19:24:29 +0000 (20:24 +0100)]
remove dead code

7 years agoSet word-wrap-column to 120, like in clang-format config
Milian Wolff [Sat, 28 Jan 2017 22:46:10 +0000 (23:46 +0100)]
Set word-wrap-column to 120, like in clang-format config

7 years agoAdd clang-format configuration and reformat src/ and test/ sources
Milian Wolff [Sat, 28 Jan 2017 22:41:50 +0000 (23:41 +0100)]
Add clang-format configuration and reformat src/ and test/ sources

7 years agoRemove libunwind-specific defines from global config
Milian Wolff [Sat, 28 Jan 2017 21:51:33 +0000 (22:51 +0100)]
Remove libunwind-specific defines from global config

We have libunwind_config.h for that purpose.

7 years agoFix detection of unw_set_cache_size and adapt to upstream changes
Milian Wolff [Sat, 28 Jan 2017 21:49:09 +0000 (22:49 +0100)]
Fix detection of unw_set_cache_size and adapt to upstream changes

unw_set_cache_size is actually a define so we can detect it directly
in C++ without the need for CMake to detect it for us. Using the
define also makes sure we can detect it once for all platforms, the
symbol is mangled by libunwind to support multiple architectures.

7 years agoMove code to setup caller/callee view into separate function
Milian Wolff [Sat, 28 Jan 2017 20:56:11 +0000 (21:56 +0100)]
Move code to setup caller/callee view into separate function

7 years agoShare code to setup the TreeModel views
Milian Wolff [Sat, 28 Jan 2017 20:52:51 +0000 (21:52 +0100)]
Share code to setup the TreeModel views

7 years agoDecouple heaptrack version from file format version.
Milian Wolff [Sat, 28 Jan 2017 20:41:59 +0000 (21:41 +0100)]
Decouple heaptrack version from file format version.

This allows us to set the version again to 1.0.0 in preparation of
the first release. The file format is set to version 1 as well.
We are still able to read the old data files from profile runs
with current versions of heaptrack.

7 years agoNever show raw addresses in output.
Milian Wolff [Sun, 22 Jan 2017 11:59:08 +0000 (12:59 +0100)]
Never show raw addresses in output.

This information is pretty useless, imho. Always returning a shared
<unresolved function> string as function name instead of the
stringified adress speeds up the code significantly and reduces
memory as more stack branches can get merged.

7 years agoRemove empty lines
Milian Wolff [Sun, 22 Jan 2017 11:55:45 +0000 (12:55 +0100)]
Remove empty lines

7 years agoSpeed up GUI analysis significantly by adding a location index cache
Milian Wolff [Sun, 22 Jan 2017 11:37:34 +0000 (12:37 +0100)]
Speed up GUI analysis significantly by adding a location index cache

Perf showed that quite a lot of time is consumed finding the interned
location for a given InstructionPointer. By adding a cache in front
of this lookup that uses the IpIndex as key, the parse step speeds
up significantly, as indicated by the following perf stat calls,
which got measured by adding an `exit(0)` after buildSizeHistogram:

Before:

 Performance counter stats for 'heaptrack_gui ./heaptrack.kwrite.27247.gz' (5 runs):

       1384.265399      task-clock (msec)         #    1.019 CPUs utilized            ( +-  0.91% )
               898      context-switches          #    0.649 K/sec                    ( +-  1.44% )
                77      cpu-migrations            #    0.055 K/sec                    ( +- 23.67% )
            27,747      page-faults               #    0.020 M/sec                    ( +-  0.41% )
     4,287,486,004      cycles                    #    3.097 GHz                      ( +-  0.90% )
     5,965,906,048      instructions              #    1.39  insn per cycle           ( +-  0.07% )
     1,298,988,220      branches                  #  938.395 M/sec                    ( +-  0.03% )
        17,667,331      branch-misses             #    1.36% of all branches          ( +-  0.04% )

       1.358443950 seconds time elapsed                                          ( +-  1.02% )

After:

 Performance counter stats for 'heaptrack_gui ./heaptrack.kwrite.27247.gz' (5 runs):

        969.782341      task-clock (msec)         #    1.023 CPUs utilized            ( +-  1.27% )
               844      context-switches          #    0.870 K/sec                    ( +-  6.82% )
                98      cpu-migrations            #    0.101 K/sec                    ( +-  5.30% )
            27,590      page-faults               #    0.028 M/sec                    ( +-  0.46% )
     3,000,707,304      cycles                    #    3.094 GHz                      ( +-  1.22% )
     4,374,580,309      instructions              #    1.46  insn per cycle           ( +-  0.03% )
       911,989,553      branches                  #  940.406 M/sec                    ( +-  0.03% )
        14,788,489      branch-misses             #    1.62% of all branches          ( +-  0.17% )

       0.947570109 seconds time elapsed                                          ( +-  1.34% )

7 years agoFix CMake warning about minimum version when trying to find KF5
Milian Wolff [Sun, 22 Jan 2017 00:01:08 +0000 (01:01 +0100)]
Fix CMake warning about minimum version when trying to find KF5

Disable even trying to build the GUI when we deal with a CMake older
than 2.8.12.

CMake Warning (dev) at /home/milian/projects/compiled/kf5/share/ECM/modules/ECMFindModuleHelpers.cmake:133 (message):
  Your project should require at least CMake 2.8.12 to use FindKF5.cmake
Call Stack (most recent call first):
  /home/milian/projects/compiled/kf5/share/ECM/find-modules/FindKF5.cmake:52 (ecm_find_package_version_check)
  CMakeLists.txt:35 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

7 years agoUpdate copyright header in two more places
Milian Wolff [Sat, 21 Jan 2017 23:57:17 +0000 (00:57 +0100)]
Update copyright header in two more places

7 years agoElide text of flamegraph items
Milian Wolff [Sat, 21 Jan 2017 23:42:23 +0000 (00:42 +0100)]
Elide text of flamegraph items

This prevents the flickering when hovering an item with a long text.
That lead the label to wordwrap, increasing the height of the label,
decreasing the height of the view, moving the scene, thus the mouse
points to a different view and we would repeat again.

Now we simply elide the text on the right of the label. This works,
but it's cutting of the text too soon, since it cannot cope with
the HTML and thinks all of these chars will get painted...

7 years agoUse new LocationData::Ptr typedef everywhere
Milian Wolff [Sat, 21 Jan 2017 22:48:46 +0000 (23:48 +0100)]
Use new LocationData::Ptr typedef everywhere

7 years agoAdd context menu to open file location to model views
Milian Wolff [Sat, 21 Jan 2017 22:46:24 +0000 (23:46 +0100)]
Add context menu to open file location to model views

This just goes through QDesktopServices and does not yet allow
the user to configure what editor he wants to use to open the file.

7 years agoProperly connect filters to corresponding view proxy model
Milian Wolff [Sat, 21 Jan 2017 18:35:44 +0000 (19:35 +0100)]
Properly connect filters to corresponding view proxy model

7 years agomove Messages.sh to follow code changes
Burkhard Lück [Sat, 21 Jan 2017 16:29:29 +0000 (17:29 +0100)]
move Messages.sh to follow code changes

7 years agoMake it possible to run heaptrack from the build folder
Milian Wolff [Sat, 21 Jan 2017 12:58:21 +0000 (13:58 +0100)]
Make it possible to run heaptrack from the build folder

By setting the correct CMake properties, the libraries, shell runner
and executables land in the correct folder layout in the build
directory. This way, we can run heaptrack directly from the build
dir, i.e.:

cd heaptrack/build
make
./bin/heaptrack <your app>
./bin/heaptrack_gui <data file>

7 years agoMove libunwind CMake logic into FindLibunwind.cmake
Milian Wolff [Sat, 21 Jan 2017 12:40:21 +0000 (13:40 +0100)]
Move libunwind CMake logic into FindLibunwind.cmake

This fixes a build regression when using a clean build folder.

The find script is copied from zbackup, cf.:

https://raw.githubusercontent.com/zbackup/zbackup/master/cmake/FindLibUnwind.cmake

It was slightly adapted to find the symbols required for heaptrack
and not depend on symbols we don't actually need here.

While at it, extract the configuration defines out into its own
libunwind_config.h.

7 years agoCollapse recursive frames by default in flame graph
Milian Wolff [Sat, 21 Jan 2017 11:49:57 +0000 (12:49 +0100)]
Collapse recursive frames by default in flame graph

When enabled, this option cleans up the flamegraph in face of
recursive function calls. Note that this only skips recursion when
a function is calling itself directly - if there is another function
inbetween, the frames won't get collapsed.

7 years agoReorder caller/callee columns
Milian Wolff [Sat, 21 Jan 2017 11:37:24 +0000 (12:37 +0100)]
Reorder caller/callee columns

- put location first
- then show peak memory consumption and leaked cost
- followed by number of allocations and temporary allocations
- finally show throughput of total bytes allocated
- sort by peak memory consumption

7 years agoDon't increment caller/callee cost multiple times for recursive stacks
Milian Wolff [Sat, 21 Jan 2017 11:30:55 +0000 (12:30 +0100)]
Don't increment caller/callee cost multiple times for recursive stacks

When we encounter a call stack with a recursive function call, we must
not increment the caller/callee cost more than once per stack. This
fixes the cost calculation for such stacks, which used to produce
costs that where sometimes beyond the actual peak cost.

7 years agoRemove extra ';'
Milian Wolff [Sat, 21 Jan 2017 11:29:22 +0000 (12:29 +0100)]
Remove extra ';'

Fixes compiler warnings in pedantic mode.

7 years agoInclude cinttypes where required.
Fabrizio Oddone [Fri, 20 Jan 2017 21:52:43 +0000 (13:52 -0800)]
Include cinttypes where required.

This change is required to fix compilation errors under DevToolset4 on
CentOS with gcc 5.2.1, cf.:

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-4/

7 years agoUpdate copyright year
Milian Wolff [Wed, 11 Jan 2017 15:06:38 +0000 (16:06 +0100)]
Update copyright year

7 years agoRestructure source code directory layout
Milian Wolff [Wed, 11 Jan 2017 13:50:24 +0000 (14:50 +0100)]
Restructure source code directory layout

Everything that's not 3rdparty or tests is now moved into the src
subfolder. That one in turn contains the following folders:

- util: shared helper functionality
- track: core functionality of heaptrack, i.e. the stuff that
  gets injected into the client code
- interpret: does the first-level aggregation and DWARF translations
  on the raw instruction pointers returned by tracking code
- analyze: high-level analyzers, i.e.:
  print: the ASCII dumper
  gui: the Qt/KDE GUI

7 years agoMerge remote-tracking branch 'paulmenzel/improve-readme.md'
Milian Wolff [Sun, 8 Jan 2017 23:00:51 +0000 (00:00 +0100)]
Merge remote-tracking branch 'paulmenzel/improve-readme.md'

7 years agoFix flamegraph tooltip for top-level item
Milian Wolff [Sun, 8 Jan 2017 22:58:22 +0000 (23:58 +0100)]
Fix flamegraph tooltip for top-level item

Use the item's "function" directly, as that one is actually a
tooltip-like label already for the top-level item.

7 years agoAdd screenshots to README.md file
Milian Wolff [Sun, 8 Jan 2017 22:46:10 +0000 (23:46 +0100)]
Add screenshots to README.md file

7 years agoUse the internal `__libc_dlopen_mode` symbol instead of `dlmopen`
Milian Wolff [Sun, 8 Jan 2017 22:33:04 +0000 (23:33 +0100)]
Use the internal `__libc_dlopen_mode` symbol instead of `dlmopen`

Both, `dlmopen` and `dlopen` are only available when the debugeee
application links against libdl. When that is not the case, one
could not inject heaptrack at runtime.

By instead using the libc.so internal `__libc_dlopen_mode` function,
we get rid of this limitation and we can also inject into applications
that only link against libc.so but not libdl.

This trick was found in the linux-inject project:
https://github.com/gaffe23/linux-inject

7 years agoDocument that you need gdb for runtime-attaching.
Milian Wolff [Sun, 8 Jan 2017 22:33:01 +0000 (23:33 +0100)]
Document that you need gdb for runtime-attaching.

7 years agoMake dependency on KChart optional
Milian Wolff [Sun, 8 Jan 2017 22:10:28 +0000 (23:10 +0100)]
Make dependency on KChart optional

The heaptrack_gui is pretty useable without KChart. So for those
who don't have access to KChart, simply skip charting and only
display the table views of raw data. Still better than using
heaptrack_print.

7 years agoAdd basic documentation on how to build heaptrack
Milian Wolff [Sun, 8 Jan 2017 21:26:38 +0000 (22:26 +0100)]
Add basic documentation on how to build heaptrack

Most notably, tell the world about the various dependencies that
heaptrack has, both the core data collector as well as the analyzer
GUI.

7 years agoLink against libunwind directly, we don't need to link against the backtrace library...
Milian Wolff [Tue, 15 Nov 2016 22:29:54 +0000 (23:29 +0100)]
Link against libunwind directly, we don't need to link against the backtrace library here.

7 years agoFix use-after-free in usage of libbacktrace.
Milian Wolff [Tue, 15 Nov 2016 22:26:53 +0000 (23:26 +0100)]
Fix use-after-free in usage of libbacktrace.

We passed the c_str of a temporary std::string to libbacktrace,
which stored that in internal data structures. Later on, that dangling
pointer was accessed leading to subtle bugs which for odd reasons
did not became apparent until recently. Running the interpreter
through valgrind easily showed the problem though.

This fixes the 'failed to read executable information' error messages
emitted by heaptrack, and also ensures the profile data attributes
costs to the correct modules.

CCMAIL: apol@kde.org

7 years agoREADME: Remove trailing whitespace
Paul Menzel [Thu, 1 Sep 2016 13:30:37 +0000 (15:30 +0200)]
README: Remove trailing whitespace

7 years agoREADME: Add newline to end of file
Paul Menzel [Thu, 1 Sep 2016 13:31:33 +0000 (15:31 +0200)]
README: Add newline to end of file

Text files should end with a newline. So add one.

7 years agoExtend error message.
Milian Wolff [Tue, 16 Aug 2016 08:08:48 +0000 (10:08 +0200)]
Extend error message.

If dwarf.h is not found, then either elfutils-dev or libdwarf-dev need to be installed

8 years agoAdd pool-allocator API for heaptrack.
Milian Wolff [Mon, 20 Jun 2016 09:42:59 +0000 (11:42 +0200)]
Add pool-allocator API for heaptrack.

This is a header-only API that you can use to add support for
pool-allocators or other custom allocators to heaptrack. Simply
include the header and call the `heaptrack_report_*` macros in
your custom allocator. When you trace your code under heaptrack,
the allocations will then be tracked. If you don't run under
heaptrack, nothing will happen.

    #include <heaptrack.h>

    void* MyPool::allocate(size_t s)
    {
        void* ptr = /* allocate s */;
        heaptrack_report_malloc(ptr, s);
        return ptr;
    }

    void MyPool::free(void* ptr)
    {
        heaptrack_report_free(ptr);
        /* actually free */
    }

8 years agoMake libheaptrack.h C-compliant.
Milian Wolff [Thu, 16 Jun 2016 10:21:37 +0000 (12:21 +0200)]
Make libheaptrack.h C-compliant.

8 years agoSkip top rows without cost.
Milian Wolff [Mon, 20 Jun 2016 11:52:16 +0000 (13:52 +0200)]
Skip top rows without cost.

This can happen when diffing files.

8 years agoRemove rows without cost from caller/callee data.
Milian Wolff [Fri, 17 Jun 2016 16:47:35 +0000 (18:47 +0200)]
Remove rows without cost from caller/callee data.

This reduces clutter for diffs.

8 years agoMerge branch 'wip/diffing'
Milian Wolff [Fri, 17 Jun 2016 16:28:00 +0000 (18:28 +0200)]
Merge branch 'wip/diffing'

8 years agoAlso disable flame graphs in diff mode.
Milian Wolff [Fri, 17 Jun 2016 16:27:22 +0000 (18:27 +0200)]
Also disable flame graphs in diff mode.

In the future, we may want to implement differential flame graphs,
but for now this is too much work.

8 years agoDisable charts in diff mode.
Milian Wolff [Fri, 17 Jun 2016 15:38:32 +0000 (17:38 +0200)]
Disable charts in diff mode.

This could be implemented eventually, but is a lot of work.

8 years agoLoad diff base data in parallel to primary data file.
Milian Wolff [Fri, 17 Jun 2016 15:23:14 +0000 (17:23 +0200)]
Load diff base data in parallel to primary data file.

Slightly improves performance when diffing.

8 years agoReword --diff CLI help text, add -d, for heaptrack_gui.
Milian Wolff [Fri, 17 Jun 2016 14:41:23 +0000 (16:41 +0200)]
Reword --diff CLI help text, add -d, for heaptrack_gui.

8 years agoMake it possible to easily diff between files from the heaptrack_gui.
Milian Wolff [Fri, 17 Jun 2016 14:38:45 +0000 (16:38 +0200)]
Make it possible to easily diff between files from the heaptrack_gui.

8 years agoAdd some more code comments for the diffing method.
Milian Wolff [Fri, 17 Jun 2016 11:56:36 +0000 (13:56 +0200)]
Add some more code comments for the diffing method.

8 years agoConvert more data types to signed integers.
Milian Wolff [Tue, 14 Jun 2016 21:45:36 +0000 (23:45 +0200)]
Convert more data types to signed integers.

We now also calculate the difference between time, peakRSS and
system info when diffing heaptrack data files.

8 years agoAdd diff support between files to heaptrack_{print,gui}.
Milian Wolff [Tue, 31 May 2016 22:06:12 +0000 (00:06 +0200)]
Add diff support between files to heaptrack_{print,gui}.

Both executables get a new `--diff <file>` argument. The file
that is passed gets parsed in addition to the primary data file.
The allocation data therein will then be subtracted from the data
found in the primary data file.

The algorithm is somewhat complicated, because we have to ignore
instruction pointer addresses, as these will vary between runs
due to address space randomization. Paired with (partial) lack of
debug symbols, we end up with non-trivial situation to map allocations
from one run to that of another.

Essentially, we need to find the correct allocation that shares the
same backtrace while ignoring instruction pointer addresses.

8 years agoDon't crash when switching the call-stack direction.
Milian Wolff [Tue, 14 Jun 2016 15:20:29 +0000 (17:20 +0200)]
Don't crash when switching the call-stack direction.

8 years agoAdd basic README.md
Milian Wolff [Mon, 13 Jun 2016 09:13:11 +0000 (11:13 +0200)]
Add basic README.md

8 years agoRefactor code to use signed data types.
Milian Wolff [Mon, 30 May 2016 19:27:23 +0000 (21:27 +0200)]
Refactor code to use signed data types.

This is required to handle diffing between files or between
individual timestamps. Since we use 64bit data types, we
can still handle a lot of allocations this way (a bit more than
9 exabytes).

8 years agoAdd minus operator to AllocationData
Milian Wolff [Tue, 31 May 2016 22:06:02 +0000 (00:06 +0200)]
Add minus operator to AllocationData

8 years agoMake it possible to skip building of heaptrack_gui.
Milian Wolff [Wed, 8 Jun 2016 16:27:34 +0000 (18:27 +0200)]
Make it possible to skip building of heaptrack_gui.

For embedded, we never want to build the gui, and having the
find scripts spit out their errors there is just noisy.

Now, the recommended way to build heaptrack for embedded Linux is:

cmake -DCMAKE_TOOLCHAIN_FILE=... -DHEAPTRACK_BUILD_GUI=OFF

8 years agoRefactor code to remove reliance on undefined behavior.
Milian Wolff [Wed, 8 Jun 2016 15:16:27 +0000 (17:16 +0200)]
Refactor code to remove reliance on undefined behavior.

Previously, the code got away with a c-style reinterpret_cast
in a constexpr function, which is not allowed according to the
standard. I think I was just lucky that the compiler didn't saw
through that yet.

Also, the code assumed (and enforced) that all function pointers
are sizeof(void*), which worked, but was a bit clunky.

Now, we simply get rid of the list of addresses, and iterate
manually over all hooks. With C++17's apply, this could be implemented
even nicer with a tuple and std::apply. That doesn't exist yet, so
we manually call the functions.

8 years agoSlightly cleanup code of preload hooks.
Milian Wolff [Wed, 8 Jun 2016 13:08:16 +0000 (15:08 +0200)]
Slightly cleanup code of preload hooks.

We instantiate directly with the decltype of a function
pointer now, so thereis no need to construct the pointer
via a secondary type anymore.

8 years agoIncrease portability to systems that don't have cfree available.
Milian Wolff [Wed, 8 Jun 2016 12:48:59 +0000 (14:48 +0200)]
Increase portability to systems that don't have cfree available.

cfree should not be used, according to its man page, but if it's
being used then we need to overload it. On systems where it is not
available, simply skip this step to keep heaptrack compiling.