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 | |
22 | /* A filter expression consists in nested AND, OR and NOT expressions |
23 | involving boolean relation (>, >=, =, !=, <, <=) between event fields and |
24 | specific values. It is compiled into an efficient data structure which |
25 | is used in functions to check if a given event or tracefile satisfies the |
26 | filter. |
27 | |
28 | The grammar for filters is: |
29 | |
30 | filter = expression |
31 | |
32 | expression = "(" expression ")" | "!" expression | |
33 | expression "&&" expression | expression "||" expression | |
34 | simpleExpression |
35 | |
36 | simpleExpression = fieldPath op value |
37 | |
38 | fieldPath = fieldComponent [ "." fieldPath ] |
39 | |
40 | fieldComponent = name [ "[" integer "]" ] |
41 | |
42 | value = integer | double | string |
43 | |
44 | */ |
45 | |
46 | |
47 | typedef struct _lttv_filter lttv_filter; |
48 | |
49 | |
50 | /* Compile the filter expression into an efficient data structure */ |
51 | |
52 | lttv_filter *lttv_filter_new(char *expression, lttv_trace *t); |
53 | |
54 | |
55 | /* Check if the tracefile or event satisfies the filter. The arguments are |
56 | declared as void * to allow these functions to be used as hooks. */ |
57 | |
58 | bool lttv_filter_tracefile(void *filter, void *tracefile); |
59 | |
60 | bool lttv_filter_event(void *filter, void *event); |
61 | |
62 | #endif // FILTER_H |
63 | |