From a277532518ae76ff7bc0f02af57f48b4b41625d0 Mon Sep 17 00:00:00 2001 From: chendexi Date: Sat, 1 Jul 2023 11:29:23 +0800 Subject: [PATCH] Define the environment structure, command line parameter options, version information and documentation for llc --- observation/src/llcstat/llcstat.c | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 observation/src/llcstat/llcstat.c diff --git a/observation/src/llcstat/llcstat.c b/observation/src/llcstat/llcstat.c new file mode 100644 index 00000000..f213c15b --- /dev/null +++ b/observation/src/llcstat/llcstat.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +#include "commons.h" +#include +#include +#include +#include "llcstat.h" +#include "llcstat.skel.h" +#include "btf_helpers.h" +#include "trace_helpers.h" + +struct env { + int sample_period; + time_t duration; + bool verbose; + bool per_thread; +} env = { + .sample_period = 100, + .duration = 10, +}; + +static volatile sig_atomic_t exiting; + +const char *argp_program_version = "llcstat 0.1"; +const char *argp_program_bug_address = "Jackie Liu "; +const char argp_program_doc[] = +"Summarize cache references and misses by PID.\n" +"\n" +"USAGE: llcstat [--help] [-c SAMPLE_PERIOD] [duration]\n"; + +static const struct argp_option opts[] = { + { "sample_period", 'c', "SAMPLE_PERIOD", 0, "Sample one in this many " + "number of cache reference / miss events" }, + { "verbose", 'v', NULL, 0, "Verbose debug output" }, + { "tid", 't', NULL, 0, + "Summarize cacge references and misses by PID/TTID" }, + { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" }, + {}, +}; -- Gitee