diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -16,20 +16,24 @@ numeric caller addresses for allocations made without GVL so you can get an idea of how much memory usage certain extensions and native libraries use. +As of 3.0, it also gives configurable C backtraces of all +dynamically-linked malloc callsites for any program where backtrace(3) +works, including programs not linked to Ruby. + It requires the concurrent lock-free hash table from the Userspace RCU project: https://liburcu.org/ It does not require recompiling or rebuilding Ruby, but only supports Ruby 2.7.0 or later on a few platforms: -* GNU/Linux (only tested --without-jemalloc, mwrap 3.x provides its own) +* GNU/Linux (only tested --without-jemalloc, mwrap 3.x provides its own malloc) It may work on FreeBSD, NetBSD, OpenBSD and DragonFly BSD if given appropriate build options. == Install - # Debian-based systems: apt-get liburcu-dev + # Debian-based systems: apt-get install liburcu-dev # Install mwrap via RubyGems.org gem install mwrap @@ -37,13 +41,21 @@ appropriate build options. == Usage mwrap works as an LD_PRELOAD and supplies a mwrap RubyGem executable to -improve ease-of-use. You can set dump_path: in the MWRAP environment -variable to append the results to a log file: +improve ease-of-use. You can set `dump_csv:' in the MWRAP environment +variable to append the results to a CSV file: + + MWRAP=dump_csv:/path/to/log mwrap RUBY_COMMAND + +(`dump_csv:' is new in mwrap 3.x, `dump_file:' from earlier versions is +still supported). - MWRAP=dump_path:/path/to/log mwrap RUBY_COMMAND +For long running processes, you can see the AF_UNIX HTTP interface: - # And to display the locations with the most allocations: - sort -k1,1rn </path/to/log | $PAGER + MWRAP=socket_dir:/some/dir mwrap COMMAND + +And connect via `curl --unix-socket /some/dir/$PID.sock' or +`mwrap-rproxy(1p)<https://80x24.org/mwrap-perl.git/tree/script/mwrap-rproxy#n44> +for more info. You may also `require "mwrap"' in your Ruby code and use Mwrap.dump, Mwrap.reset, Mwrap.each, etc. @@ -53,7 +65,10 @@ effect in tracking malloc use. However, it is safe to keep "require 'mwrap'" in performance-critical deployments, as overhead is only incurred when used as an LD_PRELOAD. -The output of the mwrap dump is a text file with 3 columns: +The output of `dump_csv:' is has self-describing columns and is +subject to change. SQLite 3.32+ can load it with: `.import --csv'. + +The output of the `dump_file:' output is a text file with 3 columns: total_bytes call_count location |