xref: /linux/tools/perf/util/iostat.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * perf iostat
4  *
5  * Copyright (C) 2020, Intel Corporation
6  *
7  * Authors: Alexander Antonov <alexander.antonov@linux.intel.com>
8  */
9 
10 #ifndef _IOSTAT_H
11 #define _IOSTAT_H
12 
13 #include <subcmd/parse-options.h>
14 #include "util/stat.h"
15 #include "util/parse-events.h"
16 #include "util/evlist.h"
17 
18 struct option;
19 struct perf_stat_config;
20 struct evlist;
21 struct timespec;
22 
23 enum iostat_mode_t {
24 	IOSTAT_NONE		= -1,
25 	IOSTAT_RUN		= 0,
26 	IOSTAT_LIST		= 1
27 };
28 
29 extern enum iostat_mode_t iostat_mode;
30 
31 typedef void (*iostat_print_counter_t)(struct perf_stat_config *, struct evsel *, void *);
32 
33 int iostat_prepare(struct evlist *evlist, struct perf_stat_config *config);
34 int iostat_parse(const struct option *opt, const char *str,
35 		 int unset __maybe_unused);
36 void iostat_list(struct evlist *evlist, struct perf_stat_config *config);
37 void iostat_release(struct evlist *evlist);
38 void iostat_prefix(struct evlist *evlist, struct perf_stat_config *config,
39 		   char *prefix, struct timespec *ts);
40 void iostat_print_header_prefix(struct perf_stat_config *config);
41 void iostat_print_metric(struct perf_stat_config *config, struct evsel *evsel,
42 			 struct perf_stat_output_ctx *out);
43 void iostat_print_counters(struct evlist *evlist,
44 			   struct perf_stat_config *config, struct timespec *ts,
45 			   char *prefix, iostat_print_counter_t print_cnt_cb, void *arg);
46 
47 #endif /* _IOSTAT_H */
48