rootbench icon indicating copy to clipboard operation
rootbench copied to clipboard

Add memory instrumentation support

Open vgvassilev opened this issue 4 years ago • 7 comments

Initial implementation of a rootbench memory tracing library.

It implements a C library which records information about the memory allocations. The library is loaded using the LD_PRELOAD mechanism (and DYLD_INSERT_LIBRARIES for osx).

GoogleBenchmark displays the memory allocation results are only in the json format. For instance:

DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=./lib/Instrumentation/libRBInstrumentation.dylib ./root/interpreter/InterpreterLookupHelperBenchmarks --benchma
    rk_format=json:
    
    ...
    {
          "name": "BM_LookupHelper_Leak",
          "run_name": "BM_LookupHelper_Leak",
          "run_type": "iteration",
          "repetitions": 0,
          "repetition_index": 0,
          "threads": 1,
          "iterations": 1,
          "real_time": 1.3199219449888916e+09,
          "cpu_time": 8.0450300000000000e+08,
          "time_unit": "ns",
          "allocs_per_iter": 6.0000000000000000e+00,
          "max_bytes_used": 3368
    }

vgvassilev avatar Oct 12 '20 10:10 vgvassilev

ping

vgvassilev avatar Nov 21 '20 19:11 vgvassilev

@vgvassilev sorry! I am here finally, can I ask you to rebase please?

oshadura avatar Dec 03 '20 15:12 oshadura

@vgvassilev if you will rebase on master again, GH Actions with root-nightlies from conda will be retriggered :+1:

oshadura avatar Dec 03 '20 18:12 oshadura

Done

vgvassilev avatar Dec 03 '20 18:12 vgvassilev

 [ 18%] Building CXX object lib/Support/CMakeFiles/RBSupport.dir/MemoryManager.cxx.o
In file included from /home/runner/work/rootbench/rootbench/lib/Support/MemoryManager.cxx:12:0:
/home/runner/work/rootbench/rootbench/include/rootbench/RBConfig.h:40:3: error: #error Unsupported Platform;
 # error Unsupported Platform;
   ^~~~~
lib/Support/CMakeFiles/RBSupport.dir/build.make:94: recipe for target 'lib/Support/CMakeFiles/RBSupport.dir/MemoryManager.cxx.o' failed
CMakeFiles/Makefile2:1474: recipe for target 'lib/Support/CMakeFiles/RBSupport.dir/all' failed
Makefile:113: recipe for target 'all' failed
``` (I could check a bit later in case you are busy..)

oshadura avatar Dec 04 '20 11:12 oshadura

@vgvassilev I check CI logs and I see segfault :(

3: 
3:  *** Break *** segmentation violation
3:  Generating stack trace...
 3/21 Test  #3: rootbench-InterpreterLookupHelperBenchmarks ...***Failed    1.01 sec

If you will have time can you rebase please here?

oshadura avatar Jan 05 '21 12:01 oshadura

I can reproduce the failure. I do not know what's going on and I will have to fix it before landing it...

vgvassilev avatar Jan 05 '21 13:01 vgvassilev