filter by facility
[lttv.git] / ltt / branches / poly / lttv / lttv / filter.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2005 Michel Dagenais and Simon Bouvier-Zappa
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
19 /*! \file lttv/lttv/filter.c
20 * \brief Defines the core filter of application
21 *
22 * consist in AND, OR and NOT nested expressions, forming a tree with
23 * simple relations as leaves. The simple relations test if a field
24 * in an event is equal, not equal, smaller, smaller or equal, larger, or
25 * larger or equal to a specified value.
26 *
27 * Fields specified in a simple expression can take following
28 * values
29 *
30 * \verbatim
31 * LttvTracefileContext{}
32 * |->event\
33 * | |->name (String, converted to GQuark)
34 * | |->facility (String, converted to GQuark)
35 * | |->category (String, not yet implemented)
36 * | |->time (LttTime)
37 * | |->tsc (LttCycleCount --> uint64)
38 * | |->fields
39 * | |->"event name"
40 * | |->"field name"
41 * | |->"sub-field name"
42 * | |->...
43 * | |->"leaf-field name" (field type)
44 * |->tracefile
45 * | |->name (String, converted to GQuark)
46 * |->trace
47 * | |->name (String, converted to GQuark)
48 * |->state
49 * |->pid (guint)
50 * |->ppid (guint)
51 * |->creation_time (LttTime)
52 * |->insertion_time (LttTime)
53 * |->process_name (String, converted to GQuark)
54 * |->execution_mode (LttvExecutionMode)
55 * |->execution_submode (LttvExecutionSubmode)
56 * |->process_status (LttvProcessStatus)
57 * |->cpu (guint)
58 * \endverbatim
59 */
60
61 /*
62 * \todo
63 * - refine switch of expression in multiple uses functions
64 * - remove the idle expressions in the tree
65 */
66
67 #ifdef HAVE_CONFIG_H
68 #include <config.h>
69 #endif
70
71 //#define TEST
72 #ifdef TEST
73 #include <time.h>
74 #include <sys/time.h>
75 #endif
76
77 #include <lttv/filter.h>
78 #include <ltt/trace.h>
79 #include <ltt/type.h>
80 #include <stdlib.h>
81 #include <string.h>
82
83 /**
84 * @fn LttvSimpleExpression* lttv_simple_expression_new()
85 *
86 * Constructor for LttvSimpleExpression
87 * @return pointer to new LttvSimpleExpression
88 */
89 LttvSimpleExpression*
90 lttv_simple_expression_new() {
91
92 LttvSimpleExpression* se = g_new(LttvSimpleExpression,1);
93
94 se->field = LTTV_FILTER_UNDEFINED;
95 se->op = NULL;
96 se->offset = 0;
97
98 return se;
99 }
100
101 /**
102 * @fn gboolean lttv_simple_expression_assign_field(GPtrArray*,LttvSimpleExpression*)
103 *
104 * Parse through filtering field hierarchy as specified
105 * by user. This function compares each value to
106 * predetermined quarks
107 * @param fp The field path list
108 * @param se current simple expression
109 * @return success/failure of operation
110 */
111 gboolean
112 lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) {
113
114 GString* f = NULL;
115
116 if(fp->len < 2) return FALSE;
117 g_assert((f=g_ptr_array_remove_index(fp,0)));
118
119 /*
120 * Parse through the specified
121 * hardcoded fields.
122 *
123 * Take note however that the
124 * 'event' subfields might change
125 * depending on values specified
126 * in core.xml file. Hence, if
127 * none of the subfields in the
128 * array match the hardcoded
129 * subfields, it will be considered
130 * as a dynamic field
131 */
132 if(!g_strcasecmp(f->str,"trace") ) {
133 /*
134 * Possible values:
135 * trace.name
136 */
137 g_string_free(f,TRUE);
138 f=g_ptr_array_remove_index(fp,0);
139 if(!g_strcasecmp(f->str,"name")) {
140 se->field = LTTV_FILTER_TRACE_NAME;
141 }
142 } else if(!g_strcasecmp(f->str,"traceset") ) {
143 /*
144 * FIXME: not yet implemented !
145 */
146 } else if(!g_strcasecmp(f->str,"tracefile") ) {
147 /*
148 * Possible values:
149 * tracefile.name
150 */
151 g_string_free(f,TRUE);
152 f=g_ptr_array_remove_index(fp,0);
153 if(!g_strcasecmp(f->str,"name")) {
154 se->field = LTTV_FILTER_TRACEFILE_NAME;
155 }
156 } else if(!g_strcasecmp(f->str,"state") ) {
157 /*
158 * Possible values:
159 * state.pid
160 * state.ppid
161 * state.creation_time
162 * state.insertion_time
163 * state.process_name
164 * state.execution_mode
165 * state.execution_submode
166 * state.process_status
167 * state.cpu
168 */
169 g_string_free(f,TRUE);
170 f=g_ptr_array_remove_index(fp,0);
171 if(!g_strcasecmp(f->str,"pid") ) {
172 se->field = LTTV_FILTER_STATE_PID;
173 }
174 else if(!g_strcasecmp(f->str,"ppid") ) {
175 se->field = LTTV_FILTER_STATE_PPID;
176 }
177 else if(!g_strcasecmp(f->str,"creation_time") ) {
178 se->field = LTTV_FILTER_STATE_CT;
179 }
180 else if(!g_strcasecmp(f->str,"insertion_time") ) {
181 se->field = LTTV_FILTER_STATE_IT;
182 }
183 else if(!g_strcasecmp(f->str,"process_name") ) {
184 se->field = LTTV_FILTER_STATE_P_NAME;
185 }
186 else if(!g_strcasecmp(f->str,"execution_mode") ) {
187 se->field = LTTV_FILTER_STATE_EX_MODE;
188 }
189 else if(!g_strcasecmp(f->str,"execution_submode") ) {
190 se->field = LTTV_FILTER_STATE_EX_SUBMODE;
191 }
192 else if(!g_strcasecmp(f->str,"process_status") ) {
193 se->field = LTTV_FILTER_STATE_P_STATUS;
194 }
195 else if(!g_strcasecmp(f->str,"cpu") ) {
196 se->field = LTTV_FILTER_STATE_CPU;
197 }
198 } else if(!g_strcasecmp(f->str,"event") ) {
199 /*
200 * Possible values:
201 * event.name
202 * event.category
203 * event.time
204 * event.tsc
205 */
206 g_string_free(f,TRUE);
207 f=g_ptr_array_remove_index(fp,0);
208 if(!g_strcasecmp(f->str,"name") ) {
209 se->field = LTTV_FILTER_EVENT_NAME;
210 }
211 else if(!g_strcasecmp(f->str,"facility") ) {
212 se->field = LTTV_FILTER_EVENT_FACILITY;
213 }
214 else if(!g_strcasecmp(f->str,"category") ) {
215 /*
216 * FIXME: Category not yet functional in lttv
217 */
218 se->field = LTTV_FILTER_EVENT_CATEGORY;
219 }
220 else if(!g_strcasecmp(f->str,"time") ) {
221 se->field = LTTV_FILTER_EVENT_TIME;
222 }
223 else if(!g_strcasecmp(f->str,"tsc") ) {
224 se->field = LTTV_FILTER_EVENT_TSC;
225 }
226 else { /* core.xml specified options */
227 se->field = LTTV_FILTER_EVENT_FIELD;
228 }
229 } else {
230 g_warning("Unrecognized field in filter string");
231 }
232
233 /* free memory for last string */
234 g_string_free(f,TRUE);
235
236 /* array should be empty */
237 g_assert(fp->len == 0);
238
239 if(se->field == LTTV_FILTER_UNDEFINED) {
240 g_warning("The specified field was not recognized !");
241 return FALSE;
242 }
243 return TRUE;
244 }
245
246 /**
247 * @fn gboolean lttv_simple_expression_assign_operator(LttvSimpleExpression*,LttvExpressionOp)
248 *
249 * Sets the function pointer for the current
250 * Simple Expression
251 * @param se current simple expression
252 * @param op current operator
253 * @return success/failure of operation
254 */
255 gboolean
256 lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionOp op) {
257
258 switch(se->field) {
259 /*
260 * string
261 */
262 case LTTV_FILTER_TRACE_NAME:
263 case LTTV_FILTER_TRACEFILE_NAME:
264 case LTTV_FILTER_STATE_P_NAME:
265 case LTTV_FILTER_EVENT_NAME:
266 case LTTV_FILTER_STATE_EX_MODE:
267 case LTTV_FILTER_STATE_EX_SUBMODE:
268 case LTTV_FILTER_STATE_P_STATUS:
269 switch(op) {
270 case LTTV_FIELD_EQ:
271 se->op = lttv_apply_op_eq_quark;
272 break;
273 case LTTV_FIELD_NE:
274 se->op = lttv_apply_op_ne_quark;
275 break;
276 default:
277 g_warning("Error encountered in operator assignment = or != expected");
278 return FALSE;
279 }
280 break;
281 /*
282 * integer
283 */
284 case LTTV_FILTER_EVENT_TSC:
285 switch(op) {
286 case LTTV_FIELD_EQ:
287 se->op = lttv_apply_op_eq_uint64;
288 break;
289 case LTTV_FIELD_NE:
290 se->op = lttv_apply_op_ne_uint64;
291 break;
292 case LTTV_FIELD_LT:
293 se->op = lttv_apply_op_lt_uint64;
294 break;
295 case LTTV_FIELD_LE:
296 se->op = lttv_apply_op_le_uint64;
297 break;
298 case LTTV_FIELD_GT:
299 se->op = lttv_apply_op_gt_uint64;
300 break;
301 case LTTV_FIELD_GE:
302 se->op = lttv_apply_op_ge_uint64;
303 break;
304 default:
305 g_warning("Error encountered in operator assignment");
306 return FALSE;
307 }
308 break;
309 /*
310 * unsigned integers
311 */
312 case LTTV_FILTER_STATE_CPU:
313 case LTTV_FILTER_STATE_PID:
314 case LTTV_FILTER_STATE_PPID:
315 switch(op) {
316 case LTTV_FIELD_EQ:
317 se->op = lttv_apply_op_eq_uint;
318 break;
319 case LTTV_FIELD_NE:
320 se->op = lttv_apply_op_ne_uint;
321 break;
322 case LTTV_FIELD_LT:
323 se->op = lttv_apply_op_lt_uint;
324 break;
325 case LTTV_FIELD_LE:
326 se->op = lttv_apply_op_le_uint;
327 break;
328 case LTTV_FIELD_GT:
329 se->op = lttv_apply_op_gt_uint;
330 break;
331 case LTTV_FIELD_GE:
332 se->op = lttv_apply_op_ge_uint;
333 break;
334 default:
335 g_warning("Error encountered in operator assignment");
336 return FALSE;
337 }
338 break;
339
340 /*
341 * Enums
342 * Entered as string, converted to enum
343 *
344 * can only be compared with 'equal' or 'not equal' operators
345 *
346 * unsigned int of 16 bits are used here since enums
347 * should not go over 2^16-1 values
348 */
349 // case /*NOTHING*/:
350 // switch(op) {
351 // case LTTV_FIELD_EQ:
352 // se->op = lttv_apply_op_eq_uint16;
353 // break;
354 // case LTTV_FIELD_NE:
355 // se->op = lttv_apply_op_ne_uint16;
356 // break;
357 // default:
358 // g_warning("Error encountered in operator assignment = or != expected");
359 // return FALSE;
360 // }
361 // break;
362 /*
363 * Ltttime
364 */
365 case LTTV_FILTER_STATE_CT:
366 case LTTV_FILTER_STATE_IT:
367 case LTTV_FILTER_EVENT_TIME:
368 switch(op) {
369 case LTTV_FIELD_EQ:
370 se->op = lttv_apply_op_eq_ltttime;
371 break;
372 case LTTV_FIELD_NE:
373 se->op = lttv_apply_op_ne_ltttime;
374 break;
375 case LTTV_FIELD_LT:
376 se->op = lttv_apply_op_lt_ltttime;
377 break;
378 case LTTV_FIELD_LE:
379 se->op = lttv_apply_op_le_ltttime;
380 break;
381 case LTTV_FIELD_GT:
382 se->op = lttv_apply_op_gt_ltttime;
383 break;
384 case LTTV_FIELD_GE:
385 se->op = lttv_apply_op_ge_ltttime;
386 break;
387 default:
388 g_warning("Error encountered in operator assignment");
389 return FALSE;
390 }
391 break;
392 default:
393 g_warning("Error encountered in operator assignation ! Field type:%i",se->field);
394 return FALSE;
395 }
396
397 return TRUE;
398
399 }
400
401 /**
402 * @fn gboolean lttv_simple_expression_assign_value(LttvSimpleExpression*,char*)
403 *
404 * Assign the value field to the current LttvSimpleExpression
405 * @param se pointer to the current LttvSimpleExpression
406 * @param value string value for simple expression
407 */
408 gboolean
409 lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) {
410
411 unsigned i;
412 gboolean is_double = FALSE;
413 LttTime t = ltt_time_zero;
414 GString* v;
415
416 switch(se->field) {
417 /*
418 * Strings
419 * entered as strings, converted to Quarks
420 */
421 case LTTV_FILTER_TRACE_NAME:
422 case LTTV_FILTER_TRACEFILE_NAME:
423 case LTTV_FILTER_STATE_P_NAME:
424 case LTTV_FILTER_EVENT_NAME:
425 case LTTV_FILTER_STATE_EX_MODE:
426 case LTTV_FILTER_STATE_EX_SUBMODE:
427 case LTTV_FILTER_STATE_P_STATUS:
428 // se->value.v_string = value;
429 se->value.v_uint32 = g_quark_from_string(value);
430 g_free(value);
431 break;
432 /*
433 * integer -- supposed to be uint64
434 */
435 case LTTV_FILTER_EVENT_TSC:
436 se->value.v_uint64 = atoi(value);
437 g_free(value);
438 break;
439 /*
440 * unsigned integers
441 */
442 case LTTV_FILTER_STATE_PID:
443 case LTTV_FILTER_STATE_PPID:
444 case LTTV_FILTER_STATE_CPU:
445 se->value.v_uint = atoi(value);
446 g_free(value);
447 break;
448 /*
449 * LttTime
450 */
451 case LTTV_FILTER_STATE_CT:
452 case LTTV_FILTER_STATE_IT:
453 case LTTV_FILTER_EVENT_TIME:
454 //se->value.v_double = atof(value);
455 /*
456 * parsing logic could be optimised,
457 * but as for now, simpler this way
458 */
459 v = g_string_new("");
460 for(i=0;i<strlen(value);i++) {
461 if(value[i] == '.') {
462 /* cannot specify number with more than one '.' */
463 if(is_double) return FALSE;
464 else is_double = TRUE;
465 t.tv_sec = atoi(v->str);
466 g_string_free(v,TRUE);
467 v = g_string_new("");
468 } else g_string_append_c(v,value[i]);
469 }
470 /* number can be integer or double */
471 if(is_double) t.tv_nsec = atoi(v->str);
472 else t.tv_sec = atoi(v->str);
473
474 g_string_free(v,TRUE);
475
476 se->value.v_ltttime = t;
477 g_free(value);
478 break;
479 default:
480 g_warning("Error encountered in value assignation ! Field type = %i",se->field);
481 g_free(value);
482 return FALSE;
483 }
484
485 return TRUE;
486
487 }
488
489 /**
490 * @fn void lttv_simple_expression_destroy(LttvSimpleExpression*)
491 *
492 * Disallocate memory for the current
493 * simple expression
494 * @param se pointer to the current LttvSimpleExpression
495 */
496 void
497 lttv_simple_expression_destroy(LttvSimpleExpression* se) {
498
499 // g_free(se->value);
500 // switch(se->field) {
501 // case LTTV_FILTER_TRACE_NAME:
502 // case LTTV_FILTER_TRACEFILE_NAME:
503 // case LTTV_FILTER_STATE_P_NAME:
504 // case LTTV_FILTER_EVENT_NAME:
505 // g_free(se->value.v_string);
506 // break;
507 // }
508 g_free(se);
509
510 }
511
512 /**
513 * @fn gint lttv_struct_type(gint)
514 *
515 * Finds the structure type depending
516 * on the fields in parameters
517 * @params ft Field of the current structure
518 * @return LttvStructType enum or -1 for error
519 */
520 gint
521 lttv_struct_type(gint ft) {
522
523 switch(ft) {
524 case LTTV_FILTER_TRACE_NAME:
525 return LTTV_FILTER_TRACE;
526 break;
527 case LTTV_FILTER_TRACEFILE_NAME:
528 return LTTV_FILTER_TRACEFILE;
529 break;
530 case LTTV_FILTER_STATE_PID:
531 case LTTV_FILTER_STATE_PPID:
532 case LTTV_FILTER_STATE_CT:
533 case LTTV_FILTER_STATE_IT:
534 case LTTV_FILTER_STATE_P_NAME:
535 case LTTV_FILTER_STATE_EX_MODE:
536 case LTTV_FILTER_STATE_EX_SUBMODE:
537 case LTTV_FILTER_STATE_P_STATUS:
538 case LTTV_FILTER_STATE_CPU:
539 return LTTV_FILTER_STATE;
540 break;
541 case LTTV_FILTER_EVENT_NAME:
542 case LTTV_FILTER_EVENT_FACILITY:
543 case LTTV_FILTER_EVENT_CATEGORY:
544 case LTTV_FILTER_EVENT_TIME:
545 case LTTV_FILTER_EVENT_TSC:
546 case LTTV_FILTER_EVENT_FIELD:
547 return LTTV_FILTER_EVENT;
548 break;
549 default:
550 return -1;
551 }
552 }
553
554 /**
555 * @fn gboolean lttv_apply_op_eq_uint(gpointer,LttvFieldValue)
556 *
557 * Applies the 'equal' operator to the
558 * specified structure and value
559 * @param v1 left member of comparison
560 * @param v2 right member of comparison
561 * @return success/failure of operation
562 */
563 gboolean lttv_apply_op_eq_uint(const gpointer v1, LttvFieldValue v2) {
564
565 guint* r = (guint*) v1;
566 return (*r == v2.v_uint);
567
568 }
569
570 /**
571 * @fn gboolean lttv_apply_op_eq_uint64(gpointer,LttvFieldValue)
572 *
573 * Applies the 'equal' operator to the
574 * specified structure and value
575 * @param v1 left member of comparison
576 * @param v2 right member of comparison
577 * @return success/failure of operation
578 */
579 gboolean lttv_apply_op_eq_uint64(const gpointer v1, LttvFieldValue v2) {
580
581 guint64* r = (guint64*) v1;
582 return (*r == v2.v_uint64);
583
584 }
585
586 /**
587 * @fn gboolean lttv_apply_op_eq_uint32(gpointer,LttvFieldValue)
588 *
589 * Applies the 'equal' operator to the
590 * specified structure and value
591 * @param v1 left member of comparison
592 * @param v2 right member of comparison
593 * @return success/failure of operation
594 */
595 gboolean lttv_apply_op_eq_uint32(const gpointer v1, LttvFieldValue v2) {
596 guint32* r = (guint32*) v1;
597 return (*r == v2.v_uint32);
598 }
599
600 /**
601 * @fn gboolean lttv_apply_op_eq_uint16(gpointer,LttvFieldValue)
602 *
603 * Applies the 'equal' operator to the
604 * specified structure and value
605 * @param v1 left member of comparison
606 * @param v2 right member of comparison
607 * @return success/failure of operation
608 */
609 gboolean lttv_apply_op_eq_uint16(const gpointer v1, LttvFieldValue v2) {
610 guint16* r = (guint16*) v1;
611 return (*r == v2.v_uint16);
612 }
613
614 /**
615 * @fn gboolean lttv_apply_op_eq_double(gpointer,LttvFieldValue)
616 *
617 * Applies the 'equal' operator to the
618 * specified structure and value
619 * @param v1 left member of comparison
620 * @param v2 right member of comparison
621 * @return success/failure of operation
622 */
623 gboolean lttv_apply_op_eq_double(const gpointer v1, LttvFieldValue v2) {
624 double* r = (double*) v1;
625 return (*r == v2.v_double);
626 }
627
628 /**
629 * @fn gboolean lttv_apply_op_eq_string(gpointer,LttvFieldValue)
630 *
631 * Applies the 'equal' operator to the
632 * specified structure and value
633 * @param v1 left member of comparison
634 * @param v2 right member of comparison
635 * @return success/failure of operation
636 */
637 gboolean lttv_apply_op_eq_string(const gpointer v1, LttvFieldValue v2) {
638 char* r = (char*) v1;
639 return (!g_strcasecmp(r,v2.v_string));
640 }
641
642 /**
643 * @fn gboolean lttv_apply_op_eq_quark(gpointer,LttvFieldValue)
644 *
645 * Applies the 'equal' operator to the
646 * specified structure and value
647 * @param v1 left member of comparison
648 * @param v2 right member of comparison
649 * @return success/failure of operation
650 */
651 gboolean lttv_apply_op_eq_quark(const gpointer v1, LttvFieldValue v2) {
652 GQuark* r = (GQuark*) v1;
653 // g_print("v1:%i v2:%i\n",*r,v2.v_uint32);
654 return (*r == v2.v_uint32);
655 }
656
657 /**
658 * @fn gboolean lttv_apply_op_eq_ltttime(gpointer,LttvFieldValue)
659 *
660 * Applies the 'equal' operator to the
661 * specified structure and value
662 * @param v1 left member of comparison
663 * @param v2 right member of comparison
664 * @return success/failure of operation
665 */
666 gboolean lttv_apply_op_eq_ltttime(const gpointer v1, LttvFieldValue v2) {
667 LttTime* r = (LttTime*) v1;
668 return ltt_time_compare(*r, v2.v_ltttime)==0?1:0;
669 }
670
671 /**
672 * @fn gboolean lttv_apply_op_ne_uint(gpointer,LttvFieldValue)
673 *
674 * Applies the 'not equal' operator to the
675 * specified structure and value
676 * @param v1 left member of comparison
677 * @param v2 right member of comparison
678 * @return success/failure of operation
679 */
680 gboolean lttv_apply_op_ne_uint(const gpointer v1, LttvFieldValue v2) {
681 guint* r = (guint*) v1;
682 return (*r != v2.v_uint);
683 }
684
685 /**
686 * @fn gboolean lttv_apply_op_ne_uint64(gpointer,LttvFieldValue)
687 *
688 * Applies the 'not equal' operator to the
689 * specified structure and value
690 * @param v1 left member of comparison
691 * @param v2 right member of comparison
692 * @return success/failure of operation
693 */
694 gboolean lttv_apply_op_ne_uint64(const gpointer v1, LttvFieldValue v2) {
695 guint64* r = (guint64*) v1;
696 return (*r != v2.v_uint64);
697 }
698
699 /**
700 * @fn gboolean lttv_apply_op_ne_uint32(gpointer,LttvFieldValue)
701 *
702 * Applies the 'not equal' operator to the
703 * specified structure and value
704 * @param v1 left member of comparison
705 * @param v2 right member of comparison
706 * @return success/failure of operation
707 */
708 gboolean lttv_apply_op_ne_uint32(const gpointer v1, LttvFieldValue v2) {
709 guint32* r = (guint32*) v1;
710 return (*r != v2.v_uint32);
711 }
712
713 /**
714 * @fn gboolean lttv_apply_op_ne_uint16(gpointer,LttvFieldValue)
715 *
716 * Applies the 'not equal' operator to the
717 * specified structure and value
718 * @param v1 left member of comparison
719 * @param v2 right member of comparison
720 * @return success/failure of operation
721 */
722 gboolean lttv_apply_op_ne_uint16(const gpointer v1, LttvFieldValue v2) {
723 guint16* r = (guint16*) v1;
724 return (*r != v2.v_uint16);
725 }
726
727 /**
728 * @fn gboolean lttv_apply_op_ne_double(gpointer,LttvFieldValue)
729 *
730 * Applies the 'not equal' operator to the
731 * specified structure and value
732 * @param v1 left member of comparison
733 * @param v2 right member of comparison
734 * @return success/failure of operation
735 */
736 gboolean lttv_apply_op_ne_double(const gpointer v1, LttvFieldValue v2) {
737 double* r = (double*) v1;
738 return (*r != v2.v_double);
739 }
740
741 /**
742 * @fn gboolean lttv_apply_op_ne_string(gpointer,LttvFieldValue)
743 *
744 * Applies the 'not equal' operator to the
745 * specified structure and value
746 * @param v1 left member of comparison
747 * @param v2 right member of comparison
748 * @return success/failure of operation
749 */
750 gboolean lttv_apply_op_ne_string(const gpointer v1, LttvFieldValue v2) {
751 char* r = (char*) v1;
752 return (g_strcasecmp(r,v2.v_string));
753 }
754
755 /**
756 * @fn gboolean lttv_apply_op_ne_quark(gpointer,LttvFieldValue)
757 *
758 * Applies the 'not equal' operator to the
759 * specified structure and value
760 * @param v1 left member of comparison
761 * @param v2 right member of comparison
762 * @return success/failure of operation
763 */
764 gboolean lttv_apply_op_ne_quark(const gpointer v1, LttvFieldValue v2) {
765 GQuark* r = (GQuark*) v1;
766 return (*r != v2.v_uint32);
767 }
768
769
770 /**
771 * @fn gboolean lttv_apply_op_ne_ltttime(gpointer,LttvFieldValue)
772 *
773 * Applies the 'not equal' operator to the
774 * specified structure and value
775 * @param v1 left member of comparison
776 * @param v2 right member of comparison
777 * @return success/failure of operation
778 */
779 gboolean lttv_apply_op_ne_ltttime(const gpointer v1, LttvFieldValue v2) {
780 LttTime* r = (LttTime*) v1;
781 return ltt_time_compare(*r, v2.v_ltttime)!=0?1:0;
782 }
783
784 /**
785 * @fn gboolean lttv_apply_op_lt_uint(gpointer,LttvFieldValue)
786 *
787 * Applies the 'lower than' operator to the
788 * specified structure and value
789 * @param v1 left member of comparison
790 * @param v2 right member of comparison
791 * @return success/failure of operation
792 */
793 gboolean lttv_apply_op_lt_uint(const gpointer v1, LttvFieldValue v2) {
794 guint* r = (guint*) v1;
795 return (*r < v2.v_uint);
796 }
797
798 /**
799 * @fn gboolean lttv_apply_op_lt_uint64(gpointer,LttvFieldValue)
800 *
801 * Applies the 'lower than' operator to the
802 * specified structure and value
803 * @param v1 left member of comparison
804 * @param v2 right member of comparison
805 * @return success/failure of operation
806 */
807 gboolean lttv_apply_op_lt_uint64(const gpointer v1, LttvFieldValue v2) {
808 guint64* r = (guint64*) v1;
809 return (*r < v2.v_uint64);
810 }
811
812 /**
813 * @fn gboolean lttv_apply_op_lt_uint32(gpointer,LttvFieldValue)
814 *
815 * Applies the 'lower than' operator to the
816 * specified structure and value
817 * @param v1 left member of comparison
818 * @param v2 right member of comparison
819 * @return success/failure of operation
820 */
821 gboolean lttv_apply_op_lt_uint32(const gpointer v1, LttvFieldValue v2) {
822 guint32* r = (guint32*) v1;
823 return (*r < v2.v_uint32);
824 }
825
826 /**
827 * @fn gboolean lttv_apply_op_lt_uint16(gpointer,LttvFieldValue)
828 *
829 * Applies the 'lower than' operator to the
830 * specified structure and value
831 * @param v1 left member of comparison
832 * @param v2 right member of comparison
833 * @return success/failure of operation
834 */
835 gboolean lttv_apply_op_lt_uint16(const gpointer v1, LttvFieldValue v2) {
836 guint16* r = (guint16*) v1;
837 return (*r < v2.v_uint16);
838 }
839
840 /**
841 * @fn gboolean lttv_apply_op_lt_double(gpointer,LttvFieldValue)
842 *
843 * Applies the 'lower than' operator to the
844 * specified structure and value
845 * @param v1 left member of comparison
846 * @param v2 right member of comparison
847 * @return success/failure of operation
848 */
849 gboolean lttv_apply_op_lt_double(const gpointer v1, LttvFieldValue v2) {
850 double* r = (double*) v1;
851 return (*r < v2.v_double);
852 }
853
854 /**
855 * @fn gboolean lttv_apply_op_lt_ltttime(gpointer,LttvFieldValue)
856 *
857 * Applies the 'lower than' operator to the
858 * specified structure and value
859 * @param v1 left member of comparison
860 * @param v2 right member of comparison
861 * @return success/failure of operation
862 */
863 gboolean lttv_apply_op_lt_ltttime(const gpointer v1, LttvFieldValue v2) {
864 LttTime* r = (LttTime*) v1;
865 // return ((r->tv_sec < v2.v_ltttime.tv_sec) || ((r->tv_sec == v2.v_ltttime.tv_sec) && (r->tv_nsec < v2.v_ltttime.tv_nsec)));
866 return ltt_time_compare(*r, v2.v_ltttime)==-1?1:0;
867 }
868
869 /**
870 * @fn gboolean lttv_apply_op_le_uint(gpointer,LttvFieldValue)
871 *
872 * Applies the 'lower or equal' operator to the
873 * specified structure and value
874 * @param v1 left member of comparison
875 * @param v2 right member of comparison
876 * @return success/failure of operation
877 */
878 gboolean lttv_apply_op_le_uint(const gpointer v1, LttvFieldValue v2) {
879 guint* r = (guint*) v1;
880 return (*r <= v2.v_uint);
881 }
882
883 /**
884 * @fn gboolean lttv_apply_op_le_uint64(gpointer,LttvFieldValue)
885 *
886 * Applies the 'lower or equal' operator to the
887 * specified structure and value
888 * @param v1 left member of comparison
889 * @param v2 right member of comparison
890 * @return success/failure of operation
891 */
892 gboolean lttv_apply_op_le_uint64(const gpointer v1, LttvFieldValue v2) {
893 guint64* r = (guint64*) v1;
894 return (*r <= v2.v_uint64);
895 }
896
897 /**
898 * @fn gboolean lttv_apply_op_le_uint32(gpointer,LttvFieldValue)
899 *
900 * Applies the 'lower or equal' operator to the
901 * specified structure and value
902 * @param v1 left member of comparison
903 * @param v2 right member of comparison
904 * @return success/failure of operation
905 */
906 gboolean lttv_apply_op_le_uint32(const gpointer v1, LttvFieldValue v2) {
907 guint32* r = (guint32*) v1;
908 return (*r <= v2.v_uint32);
909 }
910
911 /**
912 * @fn gboolean lttv_apply_op_le_uint16(gpointer,LttvFieldValue)
913 *
914 * Applies the 'lower or equal' operator to the
915 * specified structure and value
916 * @param v1 left member of comparison
917 * @param v2 right member of comparison
918 * @return success/failure of operation
919 */
920 gboolean lttv_apply_op_le_uint16(const gpointer v1, LttvFieldValue v2) {
921 guint16* r = (guint16*) v1;
922 return (*r <= v2.v_uint16);
923 }
924
925 /**
926 * @fn gboolean lttv_apply_op_le_double(gpointer,LttvFieldValue)
927 *
928 * Applies the 'lower or equal' operator to the
929 * specified structure and value
930 * @param v1 left member of comparison
931 * @param v2 right member of comparison
932 * @return success/failure of operation
933 */
934 gboolean lttv_apply_op_le_double(const gpointer v1, LttvFieldValue v2) {
935 double* r = (double*) v1;
936 return (*r <= v2.v_double);
937 }
938
939 /**
940 * @fn gboolean lttv_apply_op_le_ltttime(gpointer,LttvFieldValue)
941 *
942 * Applies the 'lower or equal' operator to the
943 * specified structure and value
944 * @param v1 left member of comparison
945 * @param v2 right member of comparison
946 * @return success/failure of operation
947 */
948 gboolean lttv_apply_op_le_ltttime(const gpointer v1, LttvFieldValue v2) {
949 LttTime* r = (LttTime*) v1;
950 // return ((r->tv_sec < v2.v_ltttime.tv_sec) || ((r->tv_sec == v2.v_ltttime.tv_sec) && (r->tv_nsec <= v2.v_ltttime.tv_nsec)));
951 return ltt_time_compare(*r, v2.v_ltttime)<1?1:0;
952 }
953
954
955 /**
956 * @fn gboolean lttv_apply_op_gt_uint(gpointer,LttvFieldValue)
957 *
958 * Applies the 'greater than' operator to the
959 * specified structure and value
960 * @param v1 left member of comparison
961 * @param v2 right member of comparison
962 * @return success/failure of operation
963 */
964 gboolean lttv_apply_op_gt_uint(const gpointer v1, LttvFieldValue v2) {
965 guint* r = (guint*) v1;
966 return (*r > v2.v_uint);
967 }
968
969 /**
970 * @fn gboolean lttv_apply_op_gt_uint64(gpointer,LttvFieldValue)
971 *
972 * Applies the 'greater than' operator to the
973 * specified structure and value
974 * @param v1 left member of comparison
975 * @param v2 right member of comparison
976 * @return success/failure of operation
977 */
978 gboolean lttv_apply_op_gt_uint64(const gpointer v1, LttvFieldValue v2) {
979 guint64* r = (guint64*) v1;
980 return (*r > v2.v_uint64);
981 }
982
983 /**
984 * @fn gboolean lttv_apply_op_gt_uint32(gpointer,LttvFieldValue)
985 *
986 * Applies the 'greater than' operator to the
987 * specified structure and value
988 * @param v1 left member of comparison
989 * @param v2 right member of comparison
990 * @return success/failure of operation
991 */
992 gboolean lttv_apply_op_gt_uint32(const gpointer v1, LttvFieldValue v2) {
993 guint32* r = (guint32*) v1;
994 return (*r > v2.v_uint32);
995 }
996
997 /**
998 * @fn gboolean lttv_apply_op_gt_uint16(gpointer,LttvFieldValue)
999 *
1000 * Applies the 'greater than' operator to the
1001 * specified structure and value
1002 * @param v1 left member of comparison
1003 * @param v2 right member of comparison
1004 * @return success/failure of operation
1005 */
1006 gboolean lttv_apply_op_gt_uint16(const gpointer v1, LttvFieldValue v2) {
1007 guint16* r = (guint16*) v1;
1008 return (*r > v2.v_uint16);
1009 }
1010
1011 /**
1012 * @fn gboolean lttv_apply_op_gt_double(gpointer,LttvFieldValue)
1013 *
1014 * Applies the 'greater than' operator to the
1015 * specified structure and value
1016 * @param v1 left member of comparison
1017 * @param v2 right member of comparison
1018 * @return success/failure of operation
1019 */
1020 gboolean lttv_apply_op_gt_double(const gpointer v1, LttvFieldValue v2) {
1021 double* r = (double*) v1;
1022 return (*r > v2.v_double);
1023 }
1024
1025 /**
1026 * @fn gboolean lttv_apply_op_gt_ltttime(gpointer,LttvFieldValue)
1027 *
1028 * Applies the 'greater than' operator to the
1029 * specified structure and value
1030 * @param v1 left member of comparison
1031 * @param v2 right member of comparison
1032 * @return success/failure of operation
1033 */
1034 gboolean lttv_apply_op_gt_ltttime(const gpointer v1, LttvFieldValue v2) {
1035 LttTime* r = (LttTime*) v1;
1036 // return ((r->tv_sec > v2.v_ltttime.tv_sec) || ((r->tv_sec == v2.v_ltttime.tv_sec) && (r->tv_nsec > v2.v_ltttime.tv_nsec)));
1037 return ltt_time_compare(*r, v2.v_ltttime)==1?1:0;
1038 }
1039
1040 /**
1041 * @fn gboolean lttv_apply_op_ge_uint(gpointer,LttvFieldValue)
1042 *
1043 * Applies the 'greater or equal' operator to the
1044 * specified structure and value
1045 * @param v1 left member of comparison
1046 * @param v2 right member of comparison
1047 * @return success/failure of operation
1048 */
1049 gboolean lttv_apply_op_ge_uint(const gpointer v1, LttvFieldValue v2) {
1050 guint* r = (guint*) v1;
1051 return (*r >= v2.v_uint);
1052 }
1053
1054 /**
1055 * @fn gboolean lttv_apply_op_ge_uint64(gpointer,LttvFieldValue)
1056 *
1057 * Applies the 'greater or equal' operator to the
1058 * specified structure and value
1059 * @param v1 left member of comparison
1060 * @param v2 right member of comparison
1061 * @return success/failure of operation
1062 */
1063 gboolean lttv_apply_op_ge_uint64(const gpointer v1, LttvFieldValue v2) {
1064 guint64* r = (guint64*) v1;
1065 return (*r >= v2.v_uint64);
1066 }
1067
1068 /**
1069 * @fn gboolean lttv_apply_op_ge_uint32(gpointer,LttvFieldValue)
1070 *
1071 * Applies the 'greater or equal' operator to the
1072 * specified structure and value
1073 * @param v1 left member of comparison
1074 * @param v2 right member of comparison
1075 * @return success/failure of operation
1076 */
1077 gboolean lttv_apply_op_ge_uint32(const gpointer v1, LttvFieldValue v2) {
1078 guint32* r = (guint32*) v1;
1079 return (*r >= v2.v_uint32);
1080 }
1081
1082 /**
1083 * @fn gboolean lttv_apply_op_ge_uint16(gpointer,LttvFieldValue)
1084 *
1085 * Applies the 'greater or equal' operator to the
1086 * specified structure and value
1087 * @param v1 left member of comparison
1088 * @param v2 right member of comparison
1089 * @return success/failure of operation
1090 */
1091 gboolean lttv_apply_op_ge_uint16(const gpointer v1, LttvFieldValue v2) {
1092 guint16* r = (guint16*) v1;
1093 return (*r >= v2.v_uint16);
1094 }
1095
1096 /**
1097 * @fn gboolean lttv_apply_op_ge_double(gpointer,LttvFieldValue)
1098 *
1099 * Applies the 'greater or equal' operator to the
1100 * specified structure and value
1101 * @param v1 left member of comparison
1102 * @param v2 right member of comparison
1103 * @return success/failure of operation
1104 */
1105 gboolean lttv_apply_op_ge_double(const gpointer v1, LttvFieldValue v2) {
1106 double* r = (double*) v1;
1107 return (*r >= v2.v_double);
1108 }
1109
1110 /**
1111 * @fn gboolean lttv_apply_op_ge_ltttime(gpointer,LttvFieldValue)
1112 *
1113 * Applies the 'greater or equal' operator to the
1114 * specified structure and value
1115 * @param v1 left member of comparison
1116 * @param v2 right member of comparison
1117 * @return success/failure of operation
1118 */
1119 gboolean lttv_apply_op_ge_ltttime(const gpointer v1, LttvFieldValue v2) {
1120 LttTime* r = (LttTime*) v1;
1121 // return ((r->tv_sec > v2.v_ltttime.tv_sec) || ((r->tv_sec == v2.v_ltttime.tv_sec) && (r->tv_nsec >= v2.v_ltttime.tv_nsec)));
1122 return ltt_time_compare(*r, v2.v_ltttime)>-1?1:0;
1123 }
1124
1125
1126
1127 /**
1128 * Makes a copy of the current filter tree
1129 * @param tree pointer to the current tree
1130 * @return new copy of the filter tree
1131 */
1132 LttvFilterTree*
1133 lttv_filter_tree_clone(const LttvFilterTree* tree) {
1134
1135 LttvFilterTree* newtree = lttv_filter_tree_new();
1136
1137 newtree->node = tree->node;
1138
1139 newtree->left = tree->left;
1140 if(newtree->left == LTTV_TREE_NODE) {
1141 newtree->l_child.t = lttv_filter_tree_clone(tree->l_child.t);
1142 } else if(newtree->left == LTTV_TREE_LEAF) {
1143 newtree->l_child.leaf = lttv_simple_expression_new();
1144 newtree->l_child.leaf->field = tree->l_child.leaf->field;
1145 newtree->l_child.leaf->offset = tree->l_child.leaf->offset;
1146 newtree->l_child.leaf->op = tree->l_child.leaf->op;
1147 /* FIXME: special case for string copy ! */
1148 newtree->l_child.leaf->value = tree->l_child.leaf->value;
1149 }
1150
1151 newtree->right = tree->right;
1152 if(newtree->right == LTTV_TREE_NODE) {
1153 newtree->r_child.t = lttv_filter_tree_clone(tree->r_child.t);
1154 } else if(newtree->right == LTTV_TREE_LEAF) {
1155 newtree->r_child.leaf = lttv_simple_expression_new();
1156 newtree->r_child.leaf->field = tree->r_child.leaf->field;
1157 newtree->r_child.leaf->offset = tree->r_child.leaf->offset;
1158 newtree->r_child.leaf->op = tree->r_child.leaf->op;
1159 newtree->r_child.leaf->value = tree->r_child.leaf->value;
1160 }
1161
1162 return newtree;
1163
1164 }
1165
1166 /**
1167 * Makes a copy of the current filter
1168 * @param filter pointer to the current filter
1169 * @return new copy of the filter
1170 */
1171 LttvFilter*
1172 lttv_filter_clone(const LttvFilter* filter) {
1173
1174 if(!filter) return NULL;
1175
1176 LttvFilter* newfilter = g_new(LttvFilter,1);
1177
1178 strcpy(newfilter->expression,filter->expression);
1179
1180 newfilter->head = lttv_filter_tree_clone(filter->head);
1181
1182 return newfilter;
1183
1184 }
1185
1186
1187 /**
1188 * @fn LttvFilter* lttv_filter_new()
1189 *
1190 * Creates a new LttvFilter
1191 * @return the current LttvFilter or NULL if error
1192 */
1193 LttvFilter*
1194 lttv_filter_new() {
1195
1196 LttvFilter* filter = g_new(LttvFilter,1);
1197 filter->expression = NULL;
1198 filter->head = NULL;
1199
1200 return filter;
1201
1202 }
1203
1204 /**
1205 * @fn gboolean lttv_filter_update(LttvFilter*)
1206 *
1207 * Updates the current LttvFilter by building
1208 * its tree based upon the expression string
1209 * @param filter pointer to the current LttvFilter
1210 * @return Failure/Success of operation
1211 */
1212 gboolean
1213 lttv_filter_update(LttvFilter* filter) {
1214
1215 // g_print("filter::lttv_filter_new()\n"); /* debug */
1216
1217 if(filter->expression == NULL) return FALSE;
1218
1219 int
1220 i,
1221 p_nesting=0, /* parenthesis nesting value */
1222 not=0;
1223
1224 /* trees */
1225 LttvFilterTree
1226 *tree = lttv_filter_tree_new(), /* main tree */
1227 *subtree = NULL, /* buffer for subtrees */
1228 *t1, /* buffer #1 */
1229 *t2, /* buffer #2 */
1230 *t3; /* buffer #3 */
1231
1232 /*
1233 * the filter
1234 * If the tree already exists,
1235 * destroy it and build a new one
1236 */
1237 if(filter->head != NULL) lttv_filter_tree_destroy(filter->head);
1238 filter->head = NULL; /* will be assigned at the end */
1239
1240 /*
1241 * Tree Stack
1242 * each element of the list
1243 * is a sub tree created
1244 * by the use of parenthesis in the
1245 * global expression. The final tree
1246 * will be the one left at the root of
1247 * the list
1248 */
1249 GPtrArray *tree_stack = g_ptr_array_new();
1250 g_ptr_array_add( tree_stack,(gpointer) tree );
1251
1252 /* temporary values */
1253 GString *a_field_component = g_string_new("");
1254 GPtrArray *a_field_path = g_ptr_array_new();
1255
1256 /* simple expression buffer */
1257 LttvSimpleExpression* a_simple_expression = lttv_simple_expression_new();
1258
1259 /*
1260 * Parse entire expression and construct
1261 * the binary tree. There are two steps
1262 * in browsing that string
1263 * 1. finding boolean ops " &,|,^,! " and parenthesis " {,(,[,],),} "
1264 * 2. finding simple expressions
1265 * - field path ( separated by dots )
1266 * - op ( >, <, =, >=, <=, !=)
1267 * - value ( integer, string ... )
1268 * To spare computing time, the whole
1269 * string is parsed in this loop for a
1270 * O(n) complexity order.
1271 *
1272 * When encountering logical op &,|,^
1273 * 1. parse the last value if any
1274 * 2. create a new tree
1275 * 3. add the expression (simple exp, or exp (subtree)) to the tree
1276 * 4. concatenate this tree with the current tree on top of the stack
1277 * When encountering math ops >,>=,<,<=,=,!=
1278 * 1. add to op to the simple expression
1279 * 2. concatenate last field component to field path
1280 * When encountering concatening ops .
1281 * 1. concatenate last field component to field path
1282 * When encountering opening parenthesis (,{,[
1283 * 1. create a new subtree on top of tree stack
1284 * When encountering closing parenthesis ),},]
1285 * 1. add the expression on right child of the current tree
1286 * 2. the subtree is completed, allocate a new subtree
1287 * 3. pop the tree value from the tree stack
1288 */
1289
1290 #ifdef TEST
1291 struct timeval starttime;
1292 struct timeval endtime;
1293 gettimeofday(&starttime, NULL);
1294 #endif
1295
1296 for(i=0;i<strlen(filter->expression);i++) {
1297 // debug
1298 // g_print("%c\n ",filter->expression[i]);
1299
1300 switch(filter->expression[i]) {
1301 /*
1302 * logical operators
1303 */
1304 case '&': /* and */
1305
1306 /* get current tree in tree stack */
1307 t1 = (LttvFilterTree*)g_ptr_array_index(tree_stack,tree_stack->len-1);
1308
1309 /* get current node at absolute right */
1310 while(t1->right != LTTV_TREE_IDLE) {
1311 g_assert(t1->right == LTTV_TREE_NODE);
1312 t1 = t1->r_child.t;
1313 }
1314 t2 = lttv_filter_tree_new();
1315 t2->node = LTTV_LOGICAL_AND;
1316 t1->right = LTTV_TREE_NODE;
1317 t1->r_child.t = t2;
1318 if(not) { /* add not operator to tree */
1319 t3 = lttv_filter_tree_new();
1320 t3->node = LTTV_LOGICAL_NOT;
1321 t2->left = LTTV_TREE_NODE;
1322 t2->l_child.t = t3;
1323 t2 = t3;
1324 not = 0;
1325 }
1326 if(subtree != NULL) { /* append subtree to current tree */
1327 t2->left = LTTV_TREE_NODE;
1328 t2->l_child.t = subtree;
1329 subtree = NULL;
1330 } else { /* append a simple expression */
1331 lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE));
1332 a_field_component = g_string_new("");
1333 t2->left = LTTV_TREE_LEAF;
1334 t2->l_child.leaf = a_simple_expression;
1335 a_simple_expression = lttv_simple_expression_new();
1336 }
1337 break;
1338
1339 case '|': /* or */
1340
1341 t1 = (LttvFilterTree*)g_ptr_array_index(tree_stack,tree_stack->len-1);
1342 while(t1->right != LTTV_TREE_IDLE) {
1343 g_assert(t1->right == LTTV_TREE_NODE);
1344 t1 = t1->r_child.t;
1345 }
1346 t2 = lttv_filter_tree_new();
1347 t2->node = LTTV_LOGICAL_OR;
1348 t1->right = LTTV_TREE_NODE;
1349 t1->r_child.t = t2;
1350 if(not) { // add not operator to tree
1351 t3 = lttv_filter_tree_new();
1352 t3->node = LTTV_LOGICAL_NOT;
1353 t2->left = LTTV_TREE_NODE;
1354 t2->l_child.t = t3;
1355 t2 = t3;
1356 not = 0;
1357 }
1358 if(subtree != NULL) { /* append subtree to current tree */
1359 t2->left = LTTV_TREE_NODE;
1360 t2->l_child.t = subtree;
1361 subtree = NULL;
1362 } else { /* append a simple expression */
1363 lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE));
1364 a_field_component = g_string_new("");
1365 t2->left = LTTV_TREE_LEAF;
1366 t2->l_child.leaf = a_simple_expression;
1367 a_simple_expression = lttv_simple_expression_new();
1368 }
1369 break;
1370
1371 case '^': /* xor */
1372
1373 t1 = (LttvFilterTree*)g_ptr_array_index(tree_stack,tree_stack->len-1);
1374 while(t1->right != LTTV_TREE_IDLE) {
1375 g_assert(t1->right == LTTV_TREE_NODE);
1376 t1 = t1->r_child.t;
1377 }
1378 t2 = lttv_filter_tree_new();
1379 t2->node = LTTV_LOGICAL_XOR;
1380 t1->right = LTTV_TREE_NODE;
1381 t1->r_child.t = t2;
1382 if(not) { // add not operator to tree
1383 t3 = lttv_filter_tree_new();
1384 t3->node = LTTV_LOGICAL_NOT;
1385 t2->left = LTTV_TREE_NODE;
1386 t2->l_child.t = t3;
1387 t2 = t3;
1388 not = 0;
1389 }
1390 if(subtree != NULL) { /* append subtree to current tree */
1391 t2->left = LTTV_TREE_NODE;
1392 t2->l_child.t = subtree;
1393 subtree = NULL;
1394 } else { /* append a simple expression */
1395 lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE));
1396 a_field_component = g_string_new("");
1397 t2->left = LTTV_TREE_LEAF;
1398 t2->l_child.leaf = a_simple_expression;
1399 a_simple_expression = lttv_simple_expression_new();
1400 }
1401 break;
1402
1403 case '!': /* not, or not equal (math op) */
1404
1405 if(filter->expression[i+1] == '=') { /* != */
1406 g_ptr_array_add( a_field_path,(gpointer) a_field_component );
1407 lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
1408 a_field_component = g_string_new("");
1409 lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_NE);
1410 i++;
1411 } else { /* ! */
1412 not=1;
1413 }
1414 break;
1415
1416 case '(': /* start of parenthesis */
1417 case '[':
1418 case '{':
1419
1420 p_nesting++; /* incrementing parenthesis nesting value */
1421 t1 = lttv_filter_tree_new();
1422 if(not) { /* add not operator to tree */
1423 t3 = lttv_filter_tree_new();
1424 t3->node = LTTV_LOGICAL_NOT;
1425 t1->right = LTTV_TREE_NODE;
1426 t1->r_child.t = t3;
1427 not = 0;
1428 }
1429 g_ptr_array_add( tree_stack,(gpointer) t1 );
1430 break;
1431
1432 case ')': /* end of parenthesis */
1433 case ']':
1434 case '}':
1435
1436 p_nesting--; /* decrementing parenthesis nesting value */
1437 if(p_nesting<0 || tree_stack->len<2) {
1438 g_warning("Wrong filtering options, the string\n\"%s\"\n\
1439 is not valid due to parenthesis incorrect use",filter->expression);
1440 return FALSE;
1441 }
1442
1443 /* there must at least be the root tree left in the array */
1444 g_assert(tree_stack->len>0);
1445
1446 t1 = g_ptr_array_index(tree_stack,tree_stack->len-1);
1447 while(t1->right != LTTV_TREE_IDLE) {
1448 t1 = t1->r_child.t;
1449 }
1450 if(not) { // add not operator to tree
1451 g_print("ici");
1452 t3 = lttv_filter_tree_new();
1453 t3->node = LTTV_LOGICAL_NOT;
1454 t1->right = LTTV_TREE_NODE;
1455 t1->r_child.t = t3;
1456 t1 = t3;
1457 not = 0;
1458 }
1459 if(subtree != NULL) { /* append subtree to current tree */
1460 t1->right = LTTV_TREE_NODE;
1461 t1->r_child.t = subtree;
1462 subtree = g_ptr_array_index(tree_stack,tree_stack->len-1);
1463 g_ptr_array_remove_index(tree_stack,tree_stack->len-1);
1464 } else { /* assign subtree as current tree */
1465 lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE));
1466 a_field_component = g_string_new("");
1467 t1->right = LTTV_TREE_LEAF;
1468 t1->r_child.leaf = a_simple_expression;
1469 a_simple_expression = lttv_simple_expression_new();
1470 subtree = g_ptr_array_remove_index(tree_stack,tree_stack->len-1);
1471 }
1472 break;
1473
1474 /*
1475 * mathematic operators
1476 */
1477 case '<': /* lower, lower or equal */
1478
1479 g_ptr_array_add( a_field_path,(gpointer) a_field_component );
1480 lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
1481 a_field_component = g_string_new("");
1482 if(filter->expression[i+1] == '=') { /* <= */
1483 i++;
1484 lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_LE);
1485 } else lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_LT);
1486 break;
1487
1488 case '>': /* higher, higher or equal */
1489
1490 g_ptr_array_add( a_field_path,(gpointer) a_field_component );
1491 lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
1492 a_field_component = g_string_new("");
1493 if(filter->expression[i+1] == '=') { /* >= */
1494 i++;
1495 lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_GE);
1496 } else lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_GT);
1497 break;
1498
1499 case '=': /* equal */
1500
1501 g_ptr_array_add( a_field_path,(gpointer) a_field_component );
1502 lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
1503 a_field_component = g_string_new("");
1504 lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_EQ);
1505 break;
1506
1507 /*
1508 * Field concatening caracter
1509 */
1510 case '.': /* dot */
1511
1512 /*
1513 * divide field expression into elements
1514 * in a_field_path array.
1515 *
1516 * A dot can also be present in double values
1517 */
1518 if(a_simple_expression->field == LTTV_FILTER_UNDEFINED) {
1519 g_ptr_array_add( a_field_path,(gpointer) a_field_component );
1520 a_field_component = g_string_new("");
1521 }
1522 break;
1523 case ' ': /* ignore */
1524 case '\n': /* ignore */
1525 break;
1526 default: /* concatening current string */
1527 g_string_append_c(a_field_component,filter->expression[i]);
1528 }
1529 }
1530
1531 /*
1532 * Preliminary check to see
1533 * if tree was constructed correctly
1534 */
1535 if( p_nesting>0 ) {
1536 g_warning("Wrong filtering options, the string\n\"%s\"\n\
1537 is not valid due to parenthesis incorrect use",filter->expression);
1538 return FALSE;
1539 }
1540
1541 if(tree_stack->len != 1) /* only root tree should remain */
1542 return FALSE;
1543
1544 /*
1545 * processing last element of expression
1546 */
1547 t1 = g_ptr_array_index(tree_stack,tree_stack->len-1);
1548 while(t1->right != LTTV_TREE_IDLE) {
1549 g_assert(t1->right == LTTV_TREE_NODE);
1550 t1 = t1->r_child.t;
1551 }
1552 if(not) { // add not operator to tree
1553 t3 = lttv_filter_tree_new();
1554 t3->node = LTTV_LOGICAL_NOT;
1555 t1->right = LTTV_TREE_NODE;
1556 t1->r_child.t = t3;
1557 t1 = t3;
1558 not = 0;
1559 }
1560 if(subtree != NULL) { /* add the subtree */
1561 t1->right = LTTV_TREE_NODE;
1562 t1->r_child.t = subtree;
1563 subtree = NULL;
1564 } else { /* add a leaf */
1565 lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE));
1566 a_field_component = NULL;
1567 t1->right = LTTV_TREE_LEAF;
1568 t1->r_child.leaf = a_simple_expression;
1569 a_simple_expression = NULL;
1570 }
1571
1572
1573 /* free the pointer array */
1574 g_assert(a_field_path->len == 0);
1575 g_ptr_array_free(a_field_path,TRUE);
1576
1577 /* free the tree stack -- but keep the root tree */
1578 filter->head = g_ptr_array_remove_index(tree_stack,0);
1579 g_ptr_array_free(tree_stack,TRUE);
1580
1581 /* free the field buffer if allocated */
1582 if(a_field_component != NULL) g_string_free(a_field_component,TRUE);
1583
1584 /* free the simple expression buffer if allocated */
1585 if(a_simple_expression != NULL) lttv_simple_expression_destroy(a_simple_expression);
1586
1587 g_assert(filter->head != NULL); /* tree should exist */
1588 g_assert(subtree == NULL); /* remaining subtree should be included in main tree */
1589
1590 #ifdef TEST
1591 gettimeofday(&endtime, NULL);
1592
1593 /* Calcul du temps de l'algorithme */
1594 double time1 = starttime.tv_sec + (starttime.tv_usec/1000000.0);
1595 double time2 = endtime.tv_sec + (endtime.tv_usec/1000000.0);
1596 // g_print("Tree build took %.10f ms for strlen of %i\n",(time2-time1)*1000,strlen(filter->expression));
1597 g_print("%.10f %i\n",(time2-time1)*1000,strlen(filter->expression));
1598 #endif
1599
1600 /* debug */
1601 g_debug("+++++++++++++++ BEGIN PRINT ++++++++++++++++\n");
1602 lttv_print_tree(filter->head,0) ;
1603 g_debug("+++++++++++++++ END PRINT ++++++++++++++++++\n");
1604
1605 /* success */
1606 return TRUE;
1607
1608 }
1609
1610 /**
1611 * @fn void lttv_filter_destroy(LttvFilter*)
1612 *
1613 * Destroy the current LttvFilter
1614 * @param filter pointer to the current LttvFilter
1615 */
1616 void
1617 lttv_filter_destroy(LttvFilter* filter) {
1618
1619 if(!filter) return;
1620
1621 if(filter->expression)
1622 g_free(filter->expression);
1623 if(filter->head)
1624 lttv_filter_tree_destroy(filter->head);
1625 g_free(filter);
1626
1627 }
1628
1629 /**
1630 * @fn LttvFilterTree* lttv_filter_tree_new()
1631 *
1632 * Assign a new tree for the current expression
1633 * or sub expression
1634 * @return pointer of LttvFilterTree
1635 */
1636 LttvFilterTree*
1637 lttv_filter_tree_new() {
1638 LttvFilterTree* tree;
1639
1640 tree = g_new(LttvFilterTree,1);
1641 tree->node = 0; //g_new(lttv_expression,1);
1642 tree->left = LTTV_TREE_IDLE;
1643 tree->right = LTTV_TREE_IDLE;
1644 tree->r_child.t = NULL;
1645 tree->l_child.t = NULL;
1646
1647 return tree;
1648 }
1649
1650 /**
1651 * @fn void lttv_filter_append_expression(LttvFilter*,char*)
1652 *
1653 * Append a new expression to the expression
1654 * defined in the current filter
1655 * @param filter pointer to the current LttvFilter
1656 * @param expression string that must be appended
1657 * @return Success/Failure of operation
1658 */
1659 gboolean
1660 lttv_filter_append_expression(LttvFilter* filter, const char *expression) {
1661
1662 if(expression == NULL) return FALSE;
1663 if(filter == NULL) return FALSE;
1664 if(expression[0] == '\0') return FALSE; /* Empty expression */
1665
1666 GString* s = g_string_new("");
1667 if(filter->expression != NULL) {
1668 g_string_append(s,filter->expression);
1669 g_string_append_c(s,'&');
1670 }
1671 g_string_append(s,expression);
1672
1673 g_free(filter->expression);
1674 filter->expression = g_string_free(s,FALSE);
1675
1676 /* TRUE if construction of tree proceeded without errors */
1677 return lttv_filter_update(filter);
1678
1679 }
1680
1681 /**
1682 * @fn void lttv_filter_clear_expression(LttvFilter*)
1683 *
1684 * Clear the filter expression from the
1685 * current filter and sets its pointer to NULL
1686 * @param filter pointer to the current LttvFilter
1687 */
1688 void
1689 lttv_filter_clear_expression(LttvFilter* filter) {
1690
1691 if(filter->expression != NULL) {
1692 g_free(filter->expression);
1693 filter->expression = NULL;
1694 }
1695
1696 }
1697
1698 /**
1699 * @fn void lttv_filter_tree_destroy(LttvFilterTree*)
1700 *
1701 * Destroys the tree and his sub-trees
1702 * @param tree Tree which must be destroyed
1703 */
1704 void
1705 lttv_filter_tree_destroy(LttvFilterTree* tree) {
1706
1707 if(tree == NULL) return;
1708
1709 if(tree->left == LTTV_TREE_LEAF) lttv_simple_expression_destroy(tree->l_child.leaf);
1710 else if(tree->left == LTTV_TREE_NODE) lttv_filter_tree_destroy(tree->l_child.t);
1711
1712 if(tree->right == LTTV_TREE_LEAF) lttv_simple_expression_destroy(tree->r_child.leaf);
1713 else if(tree->right == LTTV_TREE_NODE) lttv_filter_tree_destroy(tree->r_child.t);
1714
1715 // g_free(tree->node);
1716 g_free(tree);
1717 }
1718
1719 /**
1720 * Global parsing function for the current
1721 * LttvFilterTree
1722 * @param t pointer to the current LttvFilterTree
1723 * @param event current LttEvent, NULL if not used
1724 * @param tracefile current LttTracefile, NULL if not used
1725 * @param trace current LttTrace, NULL if not used
1726 * @param state current LttvProcessState, NULL if not used
1727 * @param context current LttvTracefileContext, NULL if not used
1728 * @return response of filter
1729 */
1730 gboolean
1731 lttv_filter_tree_parse(
1732 const LttvFilterTree* t,
1733 const LttEvent* event,
1734 const LttTracefile* tracefile,
1735 const LttTrace* trace,
1736 const LttvTracefileContext* context
1737 /*,...*/)
1738 {
1739
1740 /*
1741 * Each tree is parsed in inorder.
1742 * This way, it's possible to apply the left filter of the
1743 * tree, then decide whether or not the right branch should
1744 * be parsed depending on the linking logical operator
1745 *
1746 * Each node consists in a
1747 * 1. logical operator
1748 * 2. left child ( node or simple expression )
1749 * 3. right child ( node or simple expression )
1750 *
1751 * When the child is a simple expression, we must
1752 * before all determine if the expression refers to
1753 * a structure which is whithin observation ( not NULL ).
1754 * -If so, the expression is evaluated.
1755 * -If not, the result is set to TRUE since this particular
1756 * operation does not interfere with the lttv structure
1757 *
1758 * The result of each simple expression will directly
1759 * affect the next branch. This way, depending on
1760 * the linking logical operator, the parser will decide
1761 * to explore or not the next branch.
1762 * 1. AND OPERATOR
1763 * -If result of left branch is 0 / FALSE
1764 * then don't explore right branch and return 0;
1765 * -If result of left branch is 1 / TRUE then explore
1766 * 2. OR OPERATOR
1767 * -If result of left branch is 1 / TRUE
1768 * then don't explore right branch and return 1;
1769 * -If result of left branch is 0 / FALSE then explore
1770 * 3. XOR OPERATOR
1771 * -Result of left branch will not affect exploration of
1772 * right branch
1773 */
1774
1775 gboolean lresult = FALSE, rresult = FALSE;
1776
1777 LttvProcessState* state;
1778
1779 guint cpu = ltt_tracefile_num(context->tf);
1780 LttvTraceState *ts = (LttvTraceState*)context->t_context;
1781 state = ts->running_process[cpu];
1782
1783 /*
1784 * Parse left branch
1785 */
1786 if(t->left == LTTV_TREE_NODE) {
1787 lresult = lttv_filter_tree_parse(t->l_child.t,event,tracefile,trace,context);
1788 }
1789 else if(t->left == LTTV_TREE_LEAF) {
1790 lresult = lttv_filter_tree_parse_branch(t->l_child.leaf,event,tracefile,trace,state,context);
1791 }
1792
1793 /*
1794 * Parse linking operator
1795 * make a cutoff if possible
1796 */
1797 if((t->node & LTTV_LOGICAL_OR) && lresult == TRUE) return TRUE;
1798 if((t->node & LTTV_LOGICAL_AND) && lresult == FALSE) return FALSE;
1799
1800 /*
1801 * Parse right branch
1802 */
1803 if(t->right == LTTV_TREE_NODE) {
1804 rresult = lttv_filter_tree_parse(t->r_child.t,event,tracefile,trace,context);
1805 }
1806 else if(t->right == LTTV_TREE_LEAF) {
1807 rresult = lttv_filter_tree_parse_branch(t->r_child.leaf,event,tracefile,trace,state,context);
1808 }
1809
1810
1811 /*
1812 * Apply and return the
1813 * logical link between the
1814 * two operation
1815 */
1816 switch(t->node) {
1817 case LTTV_LOGICAL_OR: return (lresult | rresult);
1818 case LTTV_LOGICAL_AND: return (lresult & rresult);
1819 case LTTV_LOGICAL_NOT:
1820 return (t->left==LTTV_TREE_LEAF)?!lresult:((t->right==LTTV_TREE_LEAF)?!rresult:TRUE);
1821 case LTTV_LOGICAL_XOR: return (lresult ^ rresult);
1822 case 0: return (rresult);
1823 default:
1824 /*
1825 * This case should never be
1826 * parsed, if so, this subtree
1827 * is cancelled !
1828 */
1829 return TRUE;
1830 }
1831
1832 }
1833
1834 /**
1835 * This function parses a particular branch of the tree
1836 * @param se pointer to the current LttvSimpleExpression
1837 * @param event current LttEvent, NULL if not used
1838 * @param tracefile current LttTracefile, NULL if not used
1839 * @param trace current LttTrace, NULL if not used
1840 * @param state current LttvProcessState, NULL if not used
1841 * @param context current LttvTracefileContext, NULL if not used
1842 * @return response of filter
1843 */
1844 gboolean
1845 lttv_filter_tree_parse_branch(
1846 const LttvSimpleExpression* se,
1847 const LttEvent* event,
1848 const LttTracefile* tracefile,
1849 const LttTrace* trace,
1850 const LttvProcessState* state,
1851 const LttvTracefileContext* context) {
1852
1853 LttvFieldValue v;
1854 v = se->value;
1855 switch(se->field) {
1856 case LTTV_FILTER_TRACE_NAME:
1857 if(trace == NULL) return TRUE;
1858 else {
1859 GQuark quark = ltt_trace_name(trace);
1860 return se->op((gpointer)&quark,v);
1861 }
1862 break;
1863 case LTTV_FILTER_TRACEFILE_NAME:
1864 if(tracefile == NULL) return TRUE;
1865 else {
1866 GQuark quark = ltt_tracefile_name(tracefile);
1867 return se->op((gpointer)&quark,v);
1868 }
1869 break;
1870 case LTTV_FILTER_STATE_PID:
1871 if(state == NULL) return TRUE;
1872 else return se->op((gpointer)&state->pid,v);
1873 break;
1874 case LTTV_FILTER_STATE_PPID:
1875 if(state == NULL) return TRUE;
1876 else return se->op((gpointer)&state->ppid,v);
1877 break;
1878 case LTTV_FILTER_STATE_CT:
1879 if(state == NULL) return TRUE;
1880 else {
1881 return se->op((gpointer)&state->creation_time,v);
1882 }
1883 break;
1884 case LTTV_FILTER_STATE_IT:
1885 if(state == NULL) return TRUE;
1886 else {
1887 return se->op((gpointer)&state->insertion_time,v);
1888 }
1889 break;
1890 case LTTV_FILTER_STATE_P_NAME:
1891 /*
1892 * All 'unnamed' for the moment
1893 */
1894 if(state == NULL) return TRUE;
1895 else {
1896 GQuark quark = state->name;
1897 return se->op((gpointer)&quark,v);
1898 }
1899 break;
1900 case LTTV_FILTER_STATE_EX_MODE:
1901 if(state == NULL) return TRUE;
1902 else return se->op((gpointer)&state->state->t,v);
1903 break;
1904 case LTTV_FILTER_STATE_EX_SUBMODE:
1905 if(state == NULL) return TRUE;
1906 else return se->op((gpointer)&state->state->n,v);
1907 break;
1908 case LTTV_FILTER_STATE_P_STATUS:
1909 if(state == NULL) return TRUE;
1910 else return se->op((gpointer)&state->state->s,v);
1911 break;
1912 case LTTV_FILTER_STATE_CPU:
1913 if(context == NULL) return TRUE;
1914 else {
1915 /* FIXME: not sure of that one Mathieu : fixed.*/
1916 // GQuark quark = ((LttvTracefileState*)context)->cpu_name;
1917 // return se->op((gpointer)&quark,v);
1918 if(state == NULL) return TRUE;
1919 else return se->op((gpointer)&state->cpu,v);
1920 }
1921 break;
1922 case LTTV_FILTER_EVENT_NAME:
1923 if(event == NULL) return TRUE;
1924 else {
1925 LttEventType* et;
1926 et = ltt_event_eventtype(event);
1927 GQuark quark = ltt_eventtype_name(et);
1928 return se->op((gpointer)&quark,v);
1929 }
1930 break;
1931 case LTTV_FILTER_EVENT_FACILITY:
1932 if(event == NULL) return TRUE;
1933 else {
1934 LttFacility* fac;
1935 fac = ltt_event_facility(event);
1936 GQuark quark = ltt_facility_name(fac);
1937 return se->op((gpointer)&quark,v);
1938 }
1939 break;
1940 case LTTV_FILTER_EVENT_CATEGORY:
1941 /*
1942 * TODO: Not yet implemented
1943 */
1944 return TRUE;
1945 break;
1946 case LTTV_FILTER_EVENT_TIME:
1947 if(event == NULL) return TRUE;
1948 else {
1949 LttTime time = ltt_event_time(event);
1950 return se->op((gpointer)&time,v);
1951 }
1952 break;
1953 case LTTV_FILTER_EVENT_TSC:
1954 if(event == NULL) return TRUE;
1955 else {
1956 LttCycleCount count = ltt_event_cycle_count(event);
1957 return se->op((gpointer)&count,v);
1958 }
1959 break;
1960 case LTTV_FILTER_EVENT_FIELD:
1961 /*
1962 * TODO: Use the offset to
1963 * find the dynamic field
1964 * in the event struct
1965 */
1966 return TRUE;
1967 default:
1968 /*
1969 * This case should never be
1970 * parsed, if so, the whole
1971 * filtering is cancelled
1972 */
1973 g_warning("Error while parsing the filter tree");
1974 return TRUE;
1975 }
1976
1977 /* should never get here */
1978 return TRUE;
1979
1980 }
1981
1982
1983
1984 /**
1985 * Debug function. Prints tree memory allocation.
1986 * @param t the pointer to the current LttvFilterTree
1987 */
1988 void
1989 lttv_print_tree(const LttvFilterTree* t, const int count) {
1990
1991 g_debug("node:%p lchild:%p rchild:%p depth:%i\n",t, //t->l_child.t,t->r_child.t);
1992 (t->left==LTTV_TREE_NODE)?t->l_child.t:NULL,
1993 (t->right==LTTV_TREE_NODE)?t->r_child.t:NULL,
1994 count);
1995 g_debug("logic operator: %s\n",(t->node&1)?"OR":((t->node&2)?"AND":((t->node&4)?"NOT":((t->node&8)?"XOR":"IDLE"))));
1996 g_debug("|-> left branch %p is a %s\n",t->l_child.t,(t->left==LTTV_TREE_NODE)?"NODE":((t->left==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
1997 if(t->left == LTTV_TREE_LEAF) {
1998 g_debug("| |-> field type number: %i\n",t->l_child.leaf->field);
1999 g_debug("| |-> offset is: %i\n",t->l_child.leaf->offset);
2000 g_debug("| |-> operator function is: %p\n",t->l_child.leaf->op);
2001 }
2002 g_debug("|-> right branch %p is a %s\n",t->r_child.t,(t->right==LTTV_TREE_NODE)?"NODE":((t->right==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
2003 if(t->right == LTTV_TREE_LEAF) {
2004 g_debug("| |-> field type number: %i\n",t->r_child.leaf->field);
2005 g_debug("| |-> offset is: %i\n",t->r_child.leaf->offset);
2006 g_debug("| |-> operator function is: %p\n",t->r_child.leaf->op);
2007 }
2008
2009 if(t->left == LTTV_TREE_NODE) lttv_print_tree(t->l_child.t,count+1);
2010 if(t->right == LTTV_TREE_NODE) lttv_print_tree(t->r_child.t,count+1);
2011 }
2012
2013 /**
2014 * @fn static void module_init()
2015 *
2016 * Initializes the filter module and specific values
2017 */
2018 static void module_init()
2019 {
2020
2021 }
2022
2023 /**
2024 * Destroys the filter module and specific values
2025 */
2026 static void module_destroy()
2027 {
2028
2029 }
2030
2031
2032 LTTV_MODULE("filter", "Filters traceset and events", \
2033 "Filters traceset and events specifically to user input", \
2034 module_init, module_destroy)
2035
2036
2037
This page took 0.071653 seconds and 4 git commands to generate.