From 71ef216cab3e1d97a06e6c7b0dccd6e4121cbf73 Mon Sep 17 00:00:00 2001 From: wubijie Date: Sat, 1 Jul 2023 14:04:12 +0800 Subject: [PATCH] Initialize the drsnoop file action constant --- src/drsnoop/drsnoop.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/drsnoop/drsnoop.c diff --git a/src/drsnoop/drsnoop.c b/src/drsnoop/drsnoop.c new file mode 100644 index 00000000..5796a78c --- /dev/null +++ b/src/drsnoop/drsnoop.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +#include "commons.h" +#include "drsnoop.h" +#include "drsnoop.skel.h" +#include "trace_helpers.h" + +static volatile sig_atomic_t exiting; +static volatile bool verbose = false; + +struct argument { + pid_t pid; + pid_t tid; + time_t duration; + bool extended; +}; + +const char *argp_program_version = "drsnoop 0.1"; +const char *argp_program_bug_address = "Jackie Liu "; +const char argp_program_doc[] = +"Trace direct reclaim latency.\n" +"\n" +"USAGE: drsnoop [--help] [-p PID] [-t TID] [-d DURATION] [-e]\n" +"\n" +"EXAMPLES:\n" +" drsnoop # trace all direct reclaim events\n" +" drsnoop -p 123 # trace pid 123\n" +" drsnoop -t 123 # trace tid 123 (use for threads only)\n" +" drsnoop -d 10 # trace for 10 seconds only\n" +" drsnoop -e # trace all direct reclaim events with extended faileds\n"; + +static const struct argp_option opts[] = { + { "duration", 'd', "DURATION", 0, "Total duration of trace in seconds" }, + { "extended", 'e', NULL, 0, "Extended fields output" }, + { "pid", 'p', "PID", 0, "Process PID to trace" }, + { "tid", 't', "TID", 0, "Thread TID to trace" }, + { "verbose", 'v', NULL, 0, "Verbose debug output" }, + { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" }, + {} +}; -- Gitee