9c312311 |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Michel Dagenais |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License Version 2 as |
6 | * published by the Free Software Foundation; |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
16 | * MA 02111-1307, USA. |
17 | */ |
18 | |
48f6f3c2 |
19 | #ifndef FILTER_H |
20 | #define FILTER_H |
21 | |
31452f49 |
22 | #include <lttv/traceset.h> |
23 | |
48f6f3c2 |
24 | /* A filter expression consists in nested AND, OR and NOT expressions |
25 | involving boolean relation (>, >=, =, !=, <, <=) between event fields and |
26 | specific values. It is compiled into an efficient data structure which |
27 | is used in functions to check if a given event or tracefile satisfies the |
28 | filter. |
29 | |
30 | The grammar for filters is: |
31 | |
32 | filter = expression |
33 | |
34 | expression = "(" expression ")" | "!" expression | |
35 | expression "&&" expression | expression "||" expression | |
36 | simpleExpression |
37 | |
38 | simpleExpression = fieldPath op value |
39 | |
40 | fieldPath = fieldComponent [ "." fieldPath ] |
41 | |
42 | fieldComponent = name [ "[" integer "]" ] |
43 | |
44 | value = integer | double | string |
45 | |
46 | */ |
47 | |
31452f49 |
48 | /** |
49 | * @struct lttv_filter |
50 | * ( will later contain a binary tree of filtering options ) |
51 | */ |
48f6f3c2 |
52 | typedef struct _lttv_filter lttv_filter; |
53 | |
48f6f3c2 |
54 | /* Compile the filter expression into an efficient data structure */ |
55 | |
31452f49 |
56 | lttv_filter *lttv_filter_new(char *expression, LttvTrace *t); |
48f6f3c2 |
57 | |
58 | |
59 | /* Check if the tracefile or event satisfies the filter. The arguments are |
60 | declared as void * to allow these functions to be used as hooks. */ |
61 | |
31452f49 |
62 | gboolean lttv_filter_tracefile(lttv_filter *filter, void *tracefile); |
48f6f3c2 |
63 | |
31452f49 |
64 | gboolean lttv_filter_event(lttv_filter *filter, void *event); |
48f6f3c2 |
65 | |
66 | #endif // FILTER_H |
67 | |