From 02b7e8af530c5eb9c76c9420df050c3677330440 Mon Sep 17 00:00:00 2001 From: chenwei Date: Tue, 11 Jul 2023 14:50:33 +0800 Subject: [PATCH] =?UTF-8?q?trace=E4=BF=A1=E6=81=AF=E4=B8=AD=E9=83=A8?= =?UTF-8?q?=E5=88=86trace=E4=BF=A1=E6=81=AF=E6=97=A0=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenwei --- bin/src/bytrace_cmd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/src/bytrace_cmd.cpp b/bin/src/bytrace_cmd.cpp index dcb2679..73d49e3 100644 --- a/bin/src/bytrace_cmd.cpp +++ b/bin/src/bytrace_cmd.cpp @@ -56,6 +56,7 @@ const unsigned int CHUNK_SIZE = 65536; const int BLOCK_SIZE = 4096; const int SHELL_UID = 2000; const int WAIT_MILLISECONDS = 10; +const int SAVED_CMDLINES_SIZE = 1024; const string TRACE_TAG_PROPERTY = "debug.hitrace.tags.enableflags"; @@ -68,6 +69,7 @@ const string CURRENT_TRACER_PATH = "current_tracer"; const string TRACE_CLOCK_PATH = "trace_clock"; const string OVER_WRITE_PATH = "options/overwrite"; const string RECORD_TGID_PATH = "options/record-tgid"; +const string SAVED_CMDLINES_PATH = "saved_cmdlines_size"; // support customization of some parameters @@ -285,6 +287,11 @@ static bool SetTgidEnable(bool enabled) return SetFtraceEnabled(RECORD_TGID_PATH, enabled); } +static bool SetCmdLinesSize(int cmdLinesSize) +{ + return WriteStrToFile(SAVED_CMDLINES_PATH, std::to_string(cmdLinesSize)); +} + static bool DisableAllFtraceEvents() { bool isTrue = true; @@ -348,7 +355,7 @@ static bool SetKernelSpaceSettings() { // set kernelSpace settings if (!(SetBufferSize(g_bufferSizeKB) && SetClock(g_clock) && - SetOverWriteEnable(g_overwrite) && SetTgidEnable(true))) { + SetOverWriteEnable(g_overwrite) && SetTgidEnable(true) && SetCmdLinesSize(SAVED_CMDLINES_SIZE))) { fprintf(stderr, "Set trace kernel settings failed.\n"); return false; } -- Gitee