* [Tarantool-discussions] [PATCH] build: embed LuaJIT memory profiler tools
@ 2020-12-28 7:00 Sergey Kaplun
2020-12-28 7:06 ` Sergey Kaplun
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Kaplun @ 2020-12-28 7:00 UTC (permalink / raw)
To: Igor Munkin, Sergey Ostanevich; +Cc: tarantool-discussions
This patch embeds a parser for binary data dumped via the memory
profiler to Tarantool binary.
It is a set of the following Lua modules:
* utils/bufread.lua: read binary data from a file.
* utils/symtab.lua: symbol table decode functions
* memprof/parse.lua: decode the memory profiler event stream
* memprof/humanize.lua: display decoded data in human readable format
* memprof.lua: Lua script and module to display data
It launch with the following command:
$ tarantool -e 'require("memprof")(arg[1])' - filename.bin
Closed #5490
---
Issue: https://github.com/tarantool/tarantool/issues/5490
Branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-5442-luajit-memory-profiler
CI: https://gitlab.com/tarantool/tarantool/-/commits/skaplun/gh-5442-luajit-memory-profiler
src/CMakeLists.txt | 6 ++++++
src/lua/init.c | 15 ++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b95688c1a..9a712bc29 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -61,6 +61,12 @@ lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/vmdef.lua
lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/v.lua")
lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/p.lua")
lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/zone.lua")
+# LuaJIT tools.* library
+lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/tools/memprof.lua")
+lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/tools/memprof/humanize.lua")
+lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/tools/memprof/parse.lua")
+lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/tools/utils/bufread.lua")
+lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/tools/utils/symtab.lua")
add_custom_target(generate_lua_sources
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/box
diff --git a/src/lua/init.c b/src/lua/init.c
index a0b2fc775..82075c595 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -121,7 +121,14 @@ extern char strict_lua[],
string_lua[],
swim_lua[],
p_lua[], /* LuaJIT 2.1 profiler */
- zone_lua[] /* LuaJIT 2.1 profiler */;
+ zone_lua[], /* LuaJIT 2.1 profiler */
+ /* tools.* libraries. */
+ bufread_lua[],
+ symtab_lua[],
+ parse_lua[],
+ humanize_lua[],
+ memprof_lua[]
+;
static const char *lua_modules[] = {
/* Make it first to affect load of all other modules */
@@ -167,6 +174,12 @@ static const char *lua_modules[] = {
/* Profiler */
"jit.p", p_lua,
"jit.zone", zone_lua,
+ /* tools.* libraries. Order is important. */
+ "utils.bufread", bufread_lua,
+ "utils.symtab", symtab_lua,
+ "memprof.parse", parse_lua,
+ "memprof.humanize", humanize_lua,
+ "memprof", memprof_lua,
NULL
};
--
2.28.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Tarantool-discussions] [PATCH] build: embed LuaJIT memory profiler tools
2020-12-28 7:00 [Tarantool-discussions] [PATCH] build: embed LuaJIT memory profiler tools Sergey Kaplun
@ 2020-12-28 7:06 ` Sergey Kaplun
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Kaplun @ 2020-12-28 7:06 UTC (permalink / raw)
To: Igor Munkin, Sergey Ostanevich; +Cc: tarantool-discussions
Sorry. Please, drop this message. It was sent by mistake.
--
Best regards,
Sergey Kaplun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-28 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 7:00 [Tarantool-discussions] [PATCH] build: embed LuaJIT memory profiler tools Sergey Kaplun
2020-12-28 7:06 ` Sergey Kaplun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox