From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tarantool-patches-bounces@dev.tarantool.org>
Received: from [87.239.111.99] (localhost [127.0.0.1])
	by dev.tarantool.org (Postfix) with ESMTP id E680F6EC55;
	Fri, 23 Jul 2021 15:39:57 +0300 (MSK)
DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E680F6EC55
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev;
	t=1627043998; bh=GMaiFTQce6ZV39a1GjVQIXCM7tWnBp4NCXFwcbf5mlM=;
	h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=SBOkJe4pTU3VjwV9a5Kwrza1zd5f3nNmO/wmqqnQ/Fsnjjbp4WuPnFvhrt/hlq+bP
	 203N7YJiMSDFKxVG63fxtt4gub8vh6wlGeHRc0zx18RtVuQY2Q4nOMSfLGtizrPTZG
	 mypA09noPNA+cT7P6Gw+h49j0XkaRdTNuMIg3jGM=
Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com
 [209.85.208.178])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by dev.tarantool.org (Postfix) with ESMTPS id EFBD86EC55
 for <tarantool-patches@dev.tarantool.org>;
 Fri, 23 Jul 2021 15:39:56 +0300 (MSK)
DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EFBD86EC55
Received: by mail-lj1-f178.google.com with SMTP id u20so1212642ljo.0
 for <tarantool-patches@dev.tarantool.org>;
 Fri, 23 Jul 2021 05:39:56 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=H6MJFaEHzmyURgAypaSplTUM6GXbYeuDVnoPXZ1Tpdc=;
 b=oeAHKb++2WxFOOiwkuZpuEquQp83mhatNIR6SGrP42Nf45QSNnDanolHpJKu3DH9+5
 skInTle/ohSVwBxRtzifqbNl4mF6d0tJrJJVi8w/el7WJgcLK6Ku3CZ9sOzbnLvjuIE5
 U8OQrx3d43oIZ+Xu2+P5sluhd3eKjZPUS9mMPFaPg8htUGlKQSceWUBwzaDbaikDYcHa
 VkopeOj7b2tK62iI3CfSw0HFYyeCvO+OEDpbf82sL4r37rdyRgkpJpg2tGiRjYY40qs1
 LaoMioZ2aKOvgZBnptDXXXIRcUO+CpS3kOaI8JQoCmpoCwSn9X6tU95jadEOODTuETJI
 6fEQ==
X-Gm-Message-State: AOAM530zPy316e9E/X7GeRNjvv5WKGnGJ6EFuBP+i28KxvuXAx3px45q
 PoI/klfT8VHwCZRAgGVyks9zgVyTYeQSodQu
X-Google-Smtp-Source: ABdhPJyUGG4qVar5NF1FqRYh7SniYRehIvSxymVrGZq+8crfkk+jaLhBeCJtv2sAvOj8LdCzZGn4qg==
X-Received: by 2002:a2e:a288:: with SMTP id k8mr3117450lja.315.1627043996103; 
 Fri, 23 Jul 2021 05:39:56 -0700 (PDT)
Received: from localhost.localdomain ([2a00:1370:8131:3d05:9ca1:57e9:6bb:c500])
 by smtp.gmail.com with ESMTPSA id z23sm2224545lfg.153.2021.07.23.05.39.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 Jul 2021 05:39:55 -0700 (PDT)
X-Google-Original-From: Maxim Kokryashkin <m.kokryashkin@tarantool.org>
To: tarantool-patches@dev.tarantool.org, imun@tarantool.org,
 skaplun@tarantool.org
Date: Fri, 23 Jul 2021 15:39:49 +0300
Message-Id: <cover.1627043674.git.m.kokryashkin@tarantool.org>
X-Mailer: git-send-email 2.32.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [Tarantool-patches] [PATCH 0/3] memprof: add demangling
 capabilities for C functions
X-BeenThere: tarantool-patches@dev.tarantool.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
From: Maxim Kokryashkin via Tarantool-patches
 <tarantool-patches@dev.tarantool.org>
Reply-To: Maxim Kokryashkin <max.kokryashkin@gmail.com>
Errors-To: tarantool-patches-bounces@dev.tarantool.org
Sender: "Tarantool-patches" <tarantool-patches-bounces@dev.tarantool.org>

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