From 81c67eb1df1d6b227952df3f2164261a64ffb9f4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Nov 2021 14:41:32 +0100 Subject: Adding upstream version 2.8.0. Signed-off-by: Daniel Baumann --- src/opt.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/opt.c') diff --git a/src/opt.c b/src/opt.c index 4ea798d..01949e6 100644 --- a/src/opt.c +++ b/src/opt.c @@ -366,3 +366,38 @@ void perf_opt_parse(int argc, char** argv) exit(1); } } + +perf_suppress_t perf_opt_parse_suppress(const char* val) +{ + perf_suppress_t s = { false, false, false }; + + while (val && *val) { + const char* next = strchr(val, ','); + int len; + if (next) { + len = next - val; + next += 1; + } else { + len = strlen(val); + next = 0; + } + + if (!strncmp(val, "timeouts", len)) { + s.timeouts = true; + } else if (!strncmp(val, "congestion", len)) { + s.congestion = true; + } else if (!strncmp(val, "sendfailed", len)) { + s.sendfailed = true; + } else if (!strncmp(val, "sockready", len)) { + s.sockready = true; + } else { + fprintf(stderr, "unknown message type to suppress: %.*s\n", len, val); + perf_opt_usage(); + exit(1); + } + + val = next; + } + + return s; +} -- cgit v1.2.3