summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2020-09-03 15:29:37 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-09-04 22:11:16 +0300
commitee7fe31e6e264d748bec5378c4d5417e14019666 (patch)
treec0ae27125c8daa0e07eaf690100af1c9ce5d7cf6 /tools/perf/builtin-stat.c
parent9818923634206b751192e8f1554ecb93874d7d9f (diff)
downloadlinux-ee7fe31e6e264d748bec5378c4d5417e14019666.tar.xz
perf tools: Consolidate close_control_option()'s into one function
Consolidate control option fifo closing into one function. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Suggested-by: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/lkml/20200903122937.25691-1-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6562a9bdfa38..7f8d756d9408 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1051,16 +1051,6 @@ static int parse_control_option(const struct option *opt,
return evlist__parse_control(str, &config->ctl_fd, &config->ctl_fd_ack, &config->ctl_fd_close);
}
-static void close_control_option(struct perf_stat_config *config)
-{
- if (config->ctl_fd_close) {
- config->ctl_fd_close = false;
- close(config->ctl_fd);
- if (config->ctl_fd_ack >= 0)
- close(config->ctl_fd_ack);
- }
-}
-
static struct option stat_options[] = {
OPT_BOOLEAN('T', "transaction", &transaction_run,
"hardware transaction statistics"),
@@ -2410,7 +2400,7 @@ out:
metricgroup__rblist_exit(&stat_config.metric_events);
runtime_stat_delete(&stat_config);
- close_control_option(&stat_config);
+ evlist__close_control(stat_config.ctl_fd, stat_config.ctl_fd_ack, &stat_config.ctl_fd_close);
return status;
}