From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 515896EC55; Wed, 8 Sep 2021 20:50:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 515896EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1631123456; bh=8dKUToFwzSoNgdyZx6SvofyA+VgJ1JKD+IvYplSx7G0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pL42dR9BN5Pj9+lL4pOSDh/+nJB1pH03oR0nsCxxvbC6jd0fEAPficAV3V5EwGxhj 8E1iMK1zWQlmaAlXUG45KhvOl4q8x4jIbqURf9MnHJVW9hg4nkeEPCvUpeMKqYhhdB H596X2PcsiU75RTyEcQnh9mllgWhxlUlXzbWR024= Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 0EF526EC55 for ; Wed, 8 Sep 2021 20:50:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0EF526EC55 Received: by mail-lf1-f48.google.com with SMTP id x27so6494329lfu.5 for ; Wed, 08 Sep 2021 10:50:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e57Vb4r2/TYQpJFB3/aKygG9uqX3p/ZH39+4eCaeKDk=; b=XMGu9GGNualKPv7vesgjWXx2rjvzNAGML1u27EQzprtIa5CEK+yoB+ZRc/1WwKlpbr BsrFFkCFfaO5+x3usQTjNAUd1346cfOxkIaAH3ZGYeRhxFufkUOK7mdUiWXBRGibvWPV /1eM3Uw4UyeWMwVodZIcVFN0op60nz/E33heQmg3MaInDSudRz7ssfP9eGIlNTSarzgf 1J1CHGkDnfDNjgdKXccLeXIfmTTswxNW8H1uEeVn+aX4TGIEdRRh3PdJit7AqVEv20Ou GAdX0D4JszVRWqlcrS2SHZiMsf5w4qn5mo+jz7SmCMr/f3XibgiJLMASNsJaPNW9WrZe nFTA== X-Gm-Message-State: AOAM531w4RlTzc78QIvxjveXW754sXqrEIXIAbmKTz9N3n6ja3PJij/y 47j55fkinKD5TupK7pWyO8/9AKwc0mYYNEG9 X-Google-Smtp-Source: ABdhPJzsNdCCBw5NivZXrKd3nh3ahlsmgJRsMsPma4Rl0ASNdL3U1AS/JdGZLvDaDcy457XF7zAVVw== X-Received: by 2002:a19:7408:: with SMTP id v8mr3596430lfe.679.1631123454053; Wed, 08 Sep 2021 10:50:54 -0700 (PDT) Received: from localhost.localdomain ([93.175.11.199]) by smtp.gmail.com with ESMTPSA id x13sm249434lfq.262.2021.09.08.10.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 10:50:53 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Wed, 8 Sep 2021 20:50:43 +0300 Message-Id: X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 0/7] misc: introduce sysprof X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Currently, available options for profiling LuaJIT are not fine enough to get an understanding of performance. For example, perf only able to show host stack, so all the Lua calls are seen as single pcall. Oppositely, jit.p module provided with LuaJIT is not able to give any information about the host stack. To get a detailed perspective of platform performance, a more advanced profiler is needed. Sysprof is able to capture both guest and host stacks simultaneously, along with virtual machine states. Maxim Kokryashkin (4): memprof: move symtab to a separate module memprof: add profile common section sysprof: introduce Lua API tools: introduce parsers for sysprof Mikhail Shishatskiy (3): core: save current frame top to lj_obj core: separate the profiling timer from lj_profile core: introduce lua and platform profiler .gitignore | 1 + CMakeLists.txt | 6 + src/CMakeLists.txt | 3 + src/Makefile.dep.original | 17 +- src/lib_misc.c | 239 ++++++++- src/lj_arch.h | 11 + src/lj_errmsg.h | 2 +- src/lj_mapi.c | 26 + src/lj_memprof.c | 37 +- src/lj_memprof.h | 36 -- src/lj_obj.h | 12 + src/lj_profile.c | 178 +------ src/lj_profile_timer.c | 126 +++++ src/lj_profile_timer.h | 83 +++ src/lj_state.c | 7 + src/lj_symtab.c | 36 ++ src/lj_symtab.h | 46 ++ src/lj_sysprof.c | 483 ++++++++++++++++++ src/lj_sysprof.h | 94 ++++ src/lmisclib.h | 93 ++++ src/vm_x64.dasc | 52 +- src/vm_x86.dasc | 52 +- test/tarantool-tests/CMakeLists.txt | 1 + .../misclib-sysprof-capi.test.lua | 53 ++ .../misclib-sysprof-capi/CMakeLists.txt | 1 + .../misclib-sysprof-capi/testsysprof.c | 269 ++++++++++ .../misclib-sysprof-lapi.test.lua | 107 ++++ tools/CMakeLists.txt | 83 +++ tools/luajit-parse-sysprof.in | 6 + tools/sysprof.lua | 119 +++++ tools/sysprof/collapse.lua | 110 ++++ tools/sysprof/parse.lua | 188 +++++++ 32 files changed, 2309 insertions(+), 268 deletions(-) create mode 100644 src/lj_profile_timer.c create mode 100644 src/lj_profile_timer.h create mode 100644 src/lj_symtab.c create mode 100644 src/lj_symtab.h create mode 100644 src/lj_sysprof.c create mode 100644 src/lj_sysprof.h create mode 100644 test/tarantool-tests/misclib-sysprof-capi.test.lua create mode 100644 test/tarantool-tests/misclib-sysprof-capi/CMakeLists.txt create mode 100644 test/tarantool-tests/misclib-sysprof-capi/testsysprof.c create mode 100644 test/tarantool-tests/misclib-sysprof-lapi.test.lua create mode 100644 tools/luajit-parse-sysprof.in create mode 100644 tools/sysprof.lua create mode 100755 tools/sysprof/collapse.lua create mode 100755 tools/sysprof/parse.lua --- GitHub branch: https://github.com/tarantool/luajit/tree/shishqa/gh-781-platform-and-lua-profiler RFC: https://hackmd.io/g-o4f21RRkChYTyVgN1AnQ Original issue: https://github.com/tarantool/tarantool/issues/781 2.33.0