forked from smihir/trace-cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trace-filter.h
184 lines (164 loc) · 6.45 KB
/
trace-filter.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Copyright (C) 2010 Red Hat Inc, Steven Rostedt <[email protected]>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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 (not later!)
*
* 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, see <http://www.gnu.org/licenses>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _TRACE_FILTER_H
#define _TRACE_FILTER_H
#include <gtk/gtk.h>
#include "trace-xml.h"
struct event_filter_list {
struct event_filter_list *next;
struct event *event;
};
/**
* trace_adv_filter_cb_func - callback type for advanced filter dialog
* @accept: TRUE if the accept button was pressed, otherwise FALSE
* @text: The text that was entered
* @delete_event_filters: The list of event ids for filters to remove
* @data: The data given passed in to the event dialog function
*
* If @accept is FALSE then @text and @delete_event_filters
* should be ignored. @data is still valid.
*
* @text may be NULL or empty, and @delete_event_ids may also be NULL.
* @delete_event_ids if not NULL, then ends with -1
*/
typedef void (*trace_adv_filter_cb_func)(gboolean accept,
const gchar *text,
gint *delete_event_filters,
gpointer data);
/**
* trace_task_cb_func - callback type for task dialog
* @accept: TRUE if the accept button was pressed, otherwise FALSE
* @selected: list of pids of tasks selected
* @non_select: list of pids of tasks not selected
* @data: The data given passed in to the event dialog function
*
* If @accept is FALSE then @selected and @non_select
* should be ignored. @data is still valid.
*
* Both @selected and @non_select may be NULL, if either is not
* NULL they will be sorted and end with -1.
*/
typedef void (*trace_task_cb_func)(gboolean accept,
gint *selected,
gint *non_selected,
gpointer data);
/**
* trace_filter_event_cb_func - callback type for event dialog
* @accept: TRUE if the accept button was pressed, otherwise FALSE
* @all_events: TRUE if "All Events" was checked
* @systems: NULL or a string array of systems terminated with NULL
* @events: NULL or a int array of event ids terminated with -1
* @data: The data given passed in to the event dialog function
*
* If @accept is FALSE then @all_events, @systems, and @events
* should be ignored. @data is still valid.
*
* If @all_events is TRUE then @systems and @events should be ignored.
*/
typedef void (*trace_filter_event_cb_func)(gboolean accept,
gboolean all_events,
char **systems,
gint *events,
gpointer data);
void trace_adv_filter_dialog(struct tracecmd_input *handle,
struct event_filter *event_filter,
trace_adv_filter_cb_func func,
gpointer data);
void trace_task_dialog(struct tracecmd_input *handle,
gint *tasks, gint *selected,
trace_task_cb_func func,
gpointer data);
void trace_filter_event_dialog(struct tracecmd_input *handle,
gboolean all_events,
gchar **systems,
gint *events,
trace_filter_event_cb_func func,
gpointer data);
void trace_filter_pevent_dialog(struct pevent *pevent,
gboolean all_events,
gchar **systems, gint *events,
trace_filter_event_cb_func func,
gpointer data);
void trace_filter_event_filter_dialog(struct tracecmd_input *handle,
struct event_filter *filter,
gboolean all_events,
trace_filter_event_cb_func func,
gpointer data);
void trace_filter_convert_filter_to_names(struct event_filter *filter,
gchar ***systems,
gint **events);
void trace_filter_convert_char_to_filter(struct event_filter *filter,
gchar **systems,
gint *events);
/**
* trace_filter_cpu_cb_func - callback type for CPU dialog
* @accept: TRUE if the accept button was pressed, otherwise FALSE
* @all_cpus: TRUE if "All CPUS" was checked
* @selected_cpus: NULL or a cpu_mask with the cpus that were checked set.
* @data: The data given passed in to the CPU dialog function
*
* If @accept is FALSE then @all_cpus and @selected_cpus should be ignored.
* @data is still valid.
*
* If @all_cpus is TRUE then @selected_cpus should be ignored.
*/
typedef void (*trace_filter_cpu_cb_func)(gboolean accept,
gboolean all_cpus,
guint64 *selected_cpus,
gpointer data);
void trace_filter_cpu_dialog(gboolean all_cpus, guint64 *cpu_mask_selected, gint cpus,
trace_filter_cpu_cb_func func, gpointer data);
void trace_array_add(gint **array, gint *count, gint val);
/* save and load filters */
int trace_filter_save_events(struct tracecmd_xml_handle *handle,
struct event_filter *filter);
int trace_filter_save_tasks(struct tracecmd_xml_handle *handle,
struct filter_task *filter);
int trace_filter_load_events(struct event_filter *event_filter,
struct tracecmd_xml_handle *handle,
struct tracecmd_xml_system_node *node);
int trace_filter_load_task_filter(struct filter_task *filter,
struct tracecmd_xml_handle *handle,
struct tracecmd_xml_system_node *node);
int trace_filter_load_filters(struct tracecmd_xml_handle *handle,
const char *system_name,
struct filter_task *task_filter,
struct filter_task *hide_tasks);
int trace_filter_save_filters(struct tracecmd_xml_handle *handle,
const char *system_name,
struct filter_task *task_filter,
struct filter_task *hide_tasks);
GtkWidget *trace_create_event_list_view(struct pevent *pevent,
struct event_filter *filter,
gboolean all_events, gchar **systems,
gint *events);
gint trace_extract_event_list_view(GtkWidget *event_view,
gboolean *all_events,
gchar ***systems,
gint **events);
int trace_update_event_view(GtkWidget *event_view,
struct pevent *pevent,
struct event_filter *filter,
gboolean all_events,
gchar **systems, gint *events);
/* put here because there's no other place */
int str_cmp(const void *a, const void *b);
int id_cmp(const void *a, const void *b);
#endif /* _TRACE_FILTER_H */