aboutsummaryrefslogtreecommitdiff
path: root/report_ops.h
blob: 3e30dc692a9de1f62935f686280576bd8173b9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 *  report_ops.h
 *
 *  Copyright (C) 2014, Linaro Limited.
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 * Contributors:
 *     Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
 *
 */
#ifndef __REPORT_OPS_H
#define __REPORT_OPS_H

struct program_options;
struct cpuidle_cstate;
struct cpufreq_pstate;
struct wakeup_irq;

struct report_ops {
	const char *name;

	/* No other method may be called or address taken before this */
	int (*prepare)(struct report_ops *);

	int (*check_options)(struct program_options *);
	int (*check_output)(struct program_options *, void *);

	void * (*allocate_report_data)(struct program_options *);
	void (*release_report_data)(void *);

	int (*open_report_file)(char *path, void *);
	int (*close_report_file)(void *);

	void (*cstate_table_header)(void *);
	void (*cstate_table_footer)(void *);
	void (*cstate_cpu_header)(const char *cpu, void *);
	void (*cstate_baseline_state)(struct cpuidle_cstate*, void *);
	void (*cstate_single_state)(struct cpuidle_cstate*, void *);
	void (*cstate_end_cpu)(void *);

	void (*pstate_table_header)(void *);
	void (*pstate_table_footer)(void *);
	void (*pstate_cpu_header)(const char *cpu, void *);
	void (*pstate_baseline_freq)(struct cpufreq_pstate*, void *);
	void (*pstate_single_freq)(struct cpufreq_pstate*, void *);
	void (*pstate_end_cpu)(void*);

	void (*wakeup_table_header)(void *);
	void (*wakeup_table_footer)(void *);
	void (*wakeup_cpu_header)(const char *cpu, void *);
	void (*wakeup_single_irq)(struct wakeup_irq *irqinfo, void *);
	void (*wakeup_end_cpu)(void *);
};

extern void list_report_formats_to_stderr(void);
extern struct report_ops *get_report_ops(const char *name);

#define EXPORT_REPORT_OPS(reporttype_name)			\
	static const struct report_ops				\
	__attribute__ ((__used__))				\
	__attribute__ ((__section__ ("__report_ops")))		\
	* reporttype_name ## _report_ptr = &reporttype_name##_report_ops

extern const struct report_ops *report_ops_head;

#endif