diff options
author | Eric Wong <e@80x24.org> | 2024-04-06 21:49:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-04-06 21:50:47 +0000 |
commit | d15143e2ce156219ab43dee4e71d44f007df6692 (patch) | |
tree | 11fac737d0674f20453d0e5fe39ac6e1d4d36016 /lib/Devel/Mwrap/trace_struct.h | |
parent | 403b495e590f19e7ead8800edc3b14e3cdf7c5a6 (diff) | |
download | mwrap-perl-master.tar.gz |
To test and provide reproducable behavior of different mallocs, provide an architecture-specific tracing mechanism to write trace files. Since these traces, they're compressed by gzip(1) by default to avoid filling up hard drives of long-lived daemons. The compressor can be replaced with zstd or bzip2 via "trace_compress:zstd" in the comma-delimited MWRAP environment. The new mwrap-trace-replay command is designed to run with either jemalloc or glibc malloc to replay trace files. It can read uncompressed output via stdin or compressed files via gzip/zstd/bzip2. This doesn't work reliably in multi-threaded code, but I have fragmentation problems in single-threaded code.
Diffstat (limited to 'lib/Devel/Mwrap/trace_struct.h')
-rw-r--r-- | lib/Devel/Mwrap/trace_struct.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/Devel/Mwrap/trace_struct.h b/lib/Devel/Mwrap/trace_struct.h new file mode 100644 index 0000000..e5fe622 --- /dev/null +++ b/lib/Devel/Mwrap/trace_struct.h @@ -0,0 +1,34 @@ +enum tr_fn { + TR_FREE = 0, + TR_MEMALIGN = 1, + TR_MALLOC = 2, + TR_REALLOC = 3, + TR_CALLOC = 4, +}; +static const uintptr_t TR_MASK = 7; + +struct tr_memalign { + uintptr_t ret; + size_t alignment; + size_t size; +}; + +struct tr_free { + uintptr_t ptr; +}; + +struct tr_malloc { + uintptr_t ret; + size_t size; +}; + +struct tr_realloc { + uintptr_t ret; + uintptr_t ptr; + size_t size; +}; + +struct tr_calloc { + uintptr_t ret; + size_t size; +}; |