[Tarantool-patches] [PATCH 0/3] memprof: add demangling capabilities for C functions

Maxim Kokryashkin max.kokryashkin at gmail.com
Fri Jul 23 15:39:49 MSK 2021


Once applied, this patch series will make memprof able to demangle 
C fucntions. It means that memprof report will show their names
instead of meaningless address.

That's like memprof report for lua script with C modules looks like now:
```
ALLOCATIONS
@test.lua:0: 4 events   +640 bytes      -0 bytes
INTERNAL: 3 events      +1164 bytes     -0 bytes
CFUNC 0x7f939831a119: 1 events  +29 bytes       -0
bytes

REALLOCATIONS
INTERNAL: 1 events      +128 bytes      -256 bytes

DEALLOCATIONS
INTERNAL: 254 events    +0 bytes        -61020 bytes
        Overrides:
                @test.lua:0

HEAP SUMMARY:
INTERNAL holds 1164 bytes: 3 allocs, 0 frees
@test.lua:0 holds 384 bytes: 4 allocs, 1 frees
CFUNC 0x7f939831a119 holds 29 bytes: 1 allocs, 0 frees
```

Memprof report after applying the patch for the same script:

```
ALLOCATIONS
@test.lua:0: 4 events   +640 bytes      -0 bytes
INTERNAL: 3 events      +1164 bytes     -0 bytes
/home/maxim/Programming/memprof-demangling/hello.so:say_hello 0x7f939831a119: 1 events  +29 bytes       -0
bytes

REALLOCATIONS
INTERNAL: 1 events      +128 bytes      -256 bytes

DEALLOCATIONS
INTERNAL: 254 events    +0 bytes        -61020 bytes
        Overrides:
                @test.lua:0


HEAP SUMMARY:
INTERNAL holds 1164 bytes: 3 allocs, 0 frees
@test.lua:0 holds 384 bytes: 4 allocs, 1 frees
/home/maxim/Programming/memprof-demangling/hello.so:say_hello 0x7f939831a119 holds 29 bytes: 1 allocs, 0 frees
```

Part of tarantool/tarantool#5813

Maxim Kokryashkin (3):
  memprof: extend memprof symbol table
  memprof: update memprof parser
  test: adapt memprof tests to new symbol table format

 CMakeLists.txt                                |   2 +
 src/CMakeLists.txt                            |   1 +
 src/lj_hash.c                                 | 136 ++++++++++++++++++
 src/lj_hash.h                                 |  28 ++++
 src/lj_memprof.c                              |  27 +++-
 src/lj_memprof.h                              |   1 +
 .../misclib-memprof-lapi.test.lua             |   5 +-
 tools/CMakeLists.txt                          |   2 +
 tools/utils/hash.lua                          |  99 +++++++++++++
 tools/utils/symtab.lua                        | 112 ++++++++++++++-
 10 files changed, 405 insertions(+), 8 deletions(-)
 create mode 100644 src/lj_hash.c
 create mode 100644 src/lj_hash.h
 create mode 100644 tools/utils/hash.lua

---
Github branch in tarantool/tarantool:
https://github.com/tarantool/tarantool/tree/fckxorg/gh-5813-memprof-demangling

Github branch in tarantool/luajit:
https://github.com/tarantool/luajit/tree/fckxorg/gh-5813-demangling-of-c-symbols

2.32.0



More information about the Tarantool-patches mailing list