1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2005 Michel Dagenais
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;
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.
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,
24 simple expr [ op expr ]
26 read_simple_expression
27 read_field_path [ rel value ]
30 read_field_component [. field path]
39 path(component...) -> field
41 consist in AND, OR and NOT nested expressions, forming a tree with
42 simple relations as leaves. The simple relations test is a field
43 in an event is equal, not equal, smaller, smaller or equal, larger, or
44 larger or equal to a specified value.
54 * - refine switch of expression in multiple uses functions
55 * - remove the idle expressions in the tree ****
56 * - add the current simple expression to the tree
57 * * clear the field_path array after use
60 #include <lttv/filter.h>
66 LTTV_FILTER_TRACEFILE,
79 LTTV_FILTER_EX_SUBMODE,
85 * add a node to the current tree
86 * FIXME: Might be used to lower coding in lttv_filter_new switch expression
87 * @param stack the tree stack
88 * @param subtree the subtree if available (pointer or NULL)
89 * @param op the logical operator that will form the node
92 lttv_filter_tree_add_node(GPtrArray
* stack
, LttvFilterTree
* subtree
, LttvLogicalOp op
) {
94 LttvFilterTree
* t1
= NULL
;
95 LttvFilterTree
* t2
= NULL
;
97 t1
= (LttvFilterTree
*)g_ptr_array_index(stack
,stack
->len
-1);
98 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
99 t2
= lttv_filter_tree_new();
101 if(subtree
!= NULL
) {
102 t2
->left
= LTTV_TREE_NODE
;
103 t2
->l_child
.t
= subtree
;
105 t1
->right
= LTTV_TREE_NODE
;
108 // a_simple_expression->value = a_field_component->str;
109 // a_field_component = g_string_new("");
110 t2
->left
= LTTV_TREE_LEAF
;
111 // t2->l_child.leaf = a_simple_expression;
112 // a_simple_expression = g_new(lttv_simple_expression,1);
113 t1
->right
= LTTV_TREE_NODE
;
121 * Constructor for LttvSimpleExpression
122 * @return pointer to new LttvSimpleExpression
124 LttvSimpleExpression
*
125 lttv_simple_expression_new() {
127 LttvSimpleExpression
* se
= g_new(LttvSimpleExpression
,1);
129 se
->field
= LTTV_FILTER_UNDEFINED
;
138 * Parse through filtering field hierarchy as specified
139 * by user. This function compares each value to
140 * predetermined quarks
141 * @param fp The field path list
142 * @param se current simple expression
143 * @return success/failure of operation
146 parse_field_path(GPtrArray
* fp
, LttvSimpleExpression
* se
) {
149 // g_print("fp->len:%i\n",fp->len);
151 // for(i=0;i<fp->len;i++) {
152 // GString* f2 = g_ptr_array_index(fp,i);
153 // g_print("%i=%s",i,f2->str);
155 if(fp
->len
< 2) return FALSE
;
156 g_assert(f
=g_ptr_array_index(fp
,0)); //list_first(fp)->data;
159 * Parse through the specified
162 * Take note however that the
163 * 'event' subfields might change
164 * depending on values specified
165 * in core.xml file. Hence, if
166 * none of the subfields in the
167 * array match the hardcoded
168 * subfields, it will be considered
171 if(!g_strcasecmp(f
->str
,"trace") ) {
176 f
=g_ptr_array_index(fp
,1);
177 if(!g_strcasecmp(f
->str
,"name")) {
178 se
->field
= LTTV_FILTER_TRACE_NAME
;
181 } else if(!g_strcasecmp(f
->str
,"traceset") ) {
183 * FIXME: not yet implemented !
185 } else if(!g_strcasecmp(f
->str
,"tracefile") ) {
190 f
=g_ptr_array_index(fp
,1);
191 if(!g_strcasecmp(f
->str
,"name")) {
192 se
->field
= LTTV_FILTER_TRACEFILE_NAME
;
195 } else if(!g_strcasecmp(f
->str
,"state") ) {
200 * state.creation_time
201 * state.insertion_time
203 * state.execution_mode
204 * state.execution_submode
205 * state.process_status
208 f
=g_ptr_array_index(fp
,1);
209 if(!g_strcasecmp(f
->str
,"pid") ) {
210 se
->field
= LTTV_FILTER_STATE_PID
;
212 else if(!g_strcasecmp(f
->str
,"ppid") ) {
213 se
->field
= LTTV_FILTER_STATE_PPID
;
215 else if(!g_strcasecmp(f
->str
,"creation_time") ) {
216 se
->field
= LTTV_FILTER_STATE_CT
;
218 else if(!g_strcasecmp(f
->str
,"insertion_time") ) {
219 se
->field
= LTTV_FILTER_STATE_IT
;
221 else if(!g_strcasecmp(f
->str
,"process_name") ) {
222 se
->field
= LTTV_FILTER_STATE_P_NAME
;
224 else if(!g_strcasecmp(f
->str
,"execution_mode") ) {
225 se
->field
= LTTV_FILTER_STATE_EX_MODE
;
227 else if(!g_strcasecmp(f
->str
,"execution_submode") ) {
228 se
->field
= LTTV_FILTER_STATE_EX_SUBMODE
;
230 else if(!g_strcasecmp(f
->str
,"process_status") ) {
231 se
->field
= LTTV_FILTER_STATE_P_STATUS
;
233 else if(!g_strcasecmp(f
->str
,"cpu") ) {
234 se
->field
= LTTV_FILTER_STATE_CPU
;
237 } else if(!g_strcasecmp(f
->str
,"event") ) {
245 f
=g_ptr_array_index(fp
,1);
246 if(!g_strcasecmp(f
->str
,"name") ) {
247 se
->field
= LTTV_FILTER_EVENT_NAME
;
249 else if(!g_strcasecmp(f
->str
,"category") ) {
251 * FIXME: Category not yet functional in lttv
253 se
->field
= LTTV_FILTER_EVENT_CATEGORY
;
255 else if(!g_strcasecmp(f
->str
,"time") ) {
256 se
->field
= LTTV_FILTER_EVENT_TIME
;
257 // offset = &((LttEvent*)NULL)->event_time);
259 else if(!g_strcasecmp(f
->str
,"tsc") ) {
260 se
->field
= LTTV_FILTER_EVENT_TSC
;
261 // offset = &((LttEvent*)NULL)->event_cycle_count);
263 else { /* core.xml specified options */
264 se
->field
= LTTV_FILTER_EVENT_FIELD
;
265 //se->offset = (...);
268 g_warning("Unrecognized field in filter string");
272 /* free the pointer array */
273 g_ptr_array_free(fp
,FALSE
);
279 * Sets the function pointer for the current
281 * @param se current simple expression
282 * @return success/failure of operation
284 gboolean
assign_operator(LttvSimpleExpression
* se
, LttvExpressionOp op
) {
286 // g_print("se->field = %i\n",se->field);
287 // g_print("se->offset = %i\n",se->offset);
288 // g_print("se->op = %p\n",se->op);
289 // g_print("se->value = %s\n",se->value);
293 case LTTV_FILTER_TRACE_NAME
:
294 case LTTV_FILTER_TRACEFILE_NAME
:
295 case LTTV_FILTER_STATE_P_NAME
:
296 case LTTV_FILTER_EVENT_NAME
:
299 se
->op
= lttv_apply_op_eq_string
;
302 se
->op
= lttv_apply_op_eq_string
;
305 g_warning("Error encountered in operator assignment");
309 case LTTV_FILTER_STATE_PID
:
310 case LTTV_FILTER_STATE_PPID
:
311 case LTTV_FILTER_STATE_EX_MODE
:
312 case LTTV_FILTER_STATE_EX_SUBMODE
:
313 case LTTV_FILTER_STATE_P_STATUS
:
316 se
->op
= lttv_apply_op_eq_uint64
;
319 se
->op
= lttv_apply_op_ne_uint64
;
322 se
->op
= lttv_apply_op_lt_uint64
;
325 se
->op
= lttv_apply_op_le_uint64
;
328 se
->op
= lttv_apply_op_gt_uint64
;
331 se
->op
= lttv_apply_op_ge_uint64
;
334 g_warning("Error encountered in operator assignment");
338 case LTTV_FILTER_STATE_CT
:
339 case LTTV_FILTER_STATE_IT
:
340 case LTTV_FILTER_EVENT_TIME
:
341 case LTTV_FILTER_EVENT_TSC
:
344 se
->op
= lttv_apply_op_eq_double
;
347 se
->op
= lttv_apply_op_ne_double
;
350 se
->op
= lttv_apply_op_lt_double
;
353 se
->op
= lttv_apply_op_le_double
;
356 se
->op
= lttv_apply_op_gt_double
;
359 se
->op
= lttv_apply_op_ge_double
;
362 g_warning("Error encountered in operator assignment");
367 g_warning("Error encountered in operator assignment");
376 * Finds the structure type depending
377 * on the fields in parameters
378 * @params ft Field of the current structure
379 * @return LttvStructType enum or -1 for error
382 lttv_struct_type(gint ft
) {
385 case LTTV_FILTER_TRACE_NAME
:
386 return LTTV_FILTER_TRACE
;
388 case LTTV_FILTER_TRACEFILE_NAME
:
389 return LTTV_FILTER_TRACEFILE
;
391 case LTTV_FILTER_STATE_PID
:
392 case LTTV_FILTER_STATE_PPID
:
393 case LTTV_FILTER_STATE_CT
:
394 case LTTV_FILTER_STATE_IT
:
395 case LTTV_FILTER_STATE_P_NAME
:
396 case LTTV_FILTER_STATE_EX_MODE
:
397 case LTTV_FILTER_STATE_EX_SUBMODE
:
398 case LTTV_FILTER_STATE_P_STATUS
:
399 case LTTV_FILTER_STATE_CPU
:
400 return LTTV_FILTER_STATE
;
402 case LTTV_FILTER_EVENT_NAME
:
403 case LTTV_FILTER_EVENT_CATEGORY
:
404 case LTTV_FILTER_EVENT_TIME
:
405 case LTTV_FILTER_EVENT_TSC
:
406 case LTTV_FILTER_EVENT_FIELD
:
407 return LTTV_FILTER_EVENT
;
415 * Applies the 'equal' operator to the
416 * specified structure and value
417 * @param v1 left member of comparison
418 * @param v2 right member of comparison
419 * @return success/failure of operation
421 gboolean
lttv_apply_op_eq_uint64(gpointer v1
, char* v2
) {
423 guint64
* r
= (guint64
*) v1
;
424 guint64 l
= atoi(v2
);
430 * Applies the 'equal' operator to the
431 * specified structure and value
432 * @param v1 left member of comparison
433 * @param v2 right member of comparison
434 * @return success/failure of operation
436 gboolean
lttv_apply_op_eq_uint32(gpointer v1
, char* v2
) {
437 guint32
* r
= (guint32
*) v1
;
438 guint32 l
= atoi(v2
);
443 * Applies the 'equal' operator to the
444 * specified structure and value
445 * @param v1 left member of comparison
446 * @param v2 right member of comparison
447 * @return success/failure of operation
449 gboolean
lttv_apply_op_eq_uint16(gpointer v1
, char* v2
) {
450 guint16
* r
= (guint16
*) v1
;
451 guint16 l
= atoi(v2
);
456 * Applies the 'equal' operator to the
457 * specified structure and value
458 * @param v1 left member of comparison
459 * @param v2 right member of comparison
460 * @return success/failure of operation
462 gboolean
lttv_apply_op_eq_double(gpointer v1
, char* v2
) {
463 double* r
= (double*) v1
;
469 * Applies the 'equal' operator to the
470 * specified structure and value
471 * @param v1 left member of comparison
472 * @param v2 right member of comparison
473 * @return success/failure of operation
475 gboolean
lttv_apply_op_eq_string(gpointer v1
, char* v2
) {
476 char* r
= (char*) v1
;
477 return (!g_strcasecmp(r
,v2
));
481 * Applies the 'not equal' operator to the
482 * specified structure and value
483 * @param v1 left member of comparison
484 * @param v2 right member of comparison
485 * @return success/failure of operation
487 gboolean
lttv_apply_op_ne_uint64(gpointer v1
, char* v2
) {
488 guint64
* r
= (guint64
*) v1
;
489 guint64 l
= atoi(v2
);
494 * Applies the 'not equal' operator to the
495 * specified structure and value
496 * @param v1 left member of comparison
497 * @param v2 right member of comparison
498 * @return success/failure of operation
500 gboolean
lttv_apply_op_ne_uint32(gpointer v1
, char* v2
) {
501 guint32
* r
= (guint32
*) v1
;
502 guint32 l
= atoi(v2
);
507 * Applies the 'not equal' operator to the
508 * specified structure and value
509 * @param v1 left member of comparison
510 * @param v2 right member of comparison
511 * @return success/failure of operation
513 gboolean
lttv_apply_op_ne_uint16(gpointer v1
, char* v2
) {
514 guint16
* r
= (guint16
*) v1
;
515 guint16 l
= atoi(v2
);
520 * Applies the 'not equal' operator to the
521 * specified structure and value
522 * @param v1 left member of comparison
523 * @param v2 right member of comparison
524 * @return success/failure of operation
526 gboolean
lttv_apply_op_ne_double(gpointer v1
, char* v2
) {
527 double* r
= (double*) v1
;
533 * Applies the 'not equal' operator to the
534 * specified structure and value
535 * @param v1 left member of comparison
536 * @param v2 right member of comparison
537 * @return success/failure of operation
539 gboolean
lttv_apply_op_ne_string(gpointer v1
, char* v2
) {
540 char* r
= (char*) v1
;
541 return (g_strcasecmp(r
,v2
));
545 * Applies the 'lower than' operator to the
546 * specified structure and value
547 * @param v1 left member of comparison
548 * @param v2 right member of comparison
549 * @return success/failure of operation
551 gboolean
lttv_apply_op_lt_uint64(gpointer v1
, char* v2
) {
552 guint64
* r
= (guint64
*) v1
;
553 guint64 l
= atoi(v2
);
558 * Applies the 'lower than' operator to the
559 * specified structure and value
560 * @param v1 left member of comparison
561 * @param v2 right member of comparison
562 * @return success/failure of operation
564 gboolean
lttv_apply_op_lt_uint32(gpointer v1
, char* v2
) {
565 guint32
* r
= (guint32
*) v1
;
566 guint32 l
= atoi(v2
);
571 * Applies the 'lower than' operator to the
572 * specified structure and value
573 * @param v1 left member of comparison
574 * @param v2 right member of comparison
575 * @return success/failure of operation
577 gboolean
lttv_apply_op_lt_uint16(gpointer v1
, char* v2
) {
578 guint16
* r
= (guint16
*) v1
;
579 guint16 l
= atoi(v2
);
584 * Applies the 'lower than' operator to the
585 * specified structure and value
586 * @param v1 left member of comparison
587 * @param v2 right member of comparison
588 * @return success/failure of operation
590 gboolean
lttv_apply_op_lt_double(gpointer v1
, char* v2
) {
591 double* r
= (double*) v1
;
597 * Applies the 'lower than' operator to the
598 * specified structure and value
599 * @param v1 left member of comparison
600 * @param v2 right member of comparison
601 * @return success/failure of operation
603 gboolean
lttv_apply_op_le_uint64(gpointer v1
, char* v2
) {
604 guint64
* r
= (guint64
*) v1
;
605 guint64 l
= atoi(v2
);
610 * Applies the 'lower or equal' operator to the
611 * specified structure and value
612 * @param v1 left member of comparison
613 * @param v2 right member of comparison
614 * @return success/failure of operation
616 gboolean
lttv_apply_op_le_uint32(gpointer v1
, char* v2
) {
617 guint32
* r
= (guint32
*) v1
;
618 guint32 l
= atoi(v2
);
623 * Applies the 'lower or equal' operator to the
624 * specified structure and value
625 * @param v1 left member of comparison
626 * @param v2 right member of comparison
627 * @return success/failure of operation
629 gboolean
lttv_apply_op_le_uint16(gpointer v1
, char* v2
) {
630 guint16
* r
= (guint16
*) v1
;
631 guint16 l
= atoi(v2
);
636 * Applies the 'lower or equal' operator to the
637 * specified structure and value
638 * @param v1 left member of comparison
639 * @param v2 right member of comparison
640 * @return success/failure of operation
642 gboolean
lttv_apply_op_le_double(gpointer v1
, char* v2
) {
643 double* r
= (double*) v1
;
649 * Applies the 'greater than' operator to the
650 * specified structure and value
651 * @param v1 left member of comparison
652 * @param v2 right member of comparison
653 * @return success/failure of operation
655 gboolean
lttv_apply_op_gt_uint64(gpointer v1
, char* v2
) {
656 guint64
* r
= (guint64
*) v1
;
657 guint64 l
= atoi(v2
);
662 * Applies the 'greater than' operator to the
663 * specified structure and value
664 * @param v1 left member of comparison
665 * @param v2 right member of comparison
666 * @return success/failure of operation
668 gboolean
lttv_apply_op_gt_uint32(gpointer v1
, char* v2
) {
669 guint32
* r
= (guint32
*) v1
;
670 guint32 l
= atoi(v2
);
675 * Applies the 'greater than' operator to the
676 * specified structure and value
677 * @param v1 left member of comparison
678 * @param v2 right member of comparison
679 * @return success/failure of operation
681 gboolean
lttv_apply_op_gt_uint16(gpointer v1
, char* v2
) {
682 guint16
* r
= (guint16
*) v1
;
683 guint16 l
= atoi(v2
);
688 * Applies the 'greater than' 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
694 gboolean
lttv_apply_op_gt_double(gpointer v1
, char* v2
) {
695 double* r
= (double*) v1
;
701 * Applies the 'greater or equal' operator to the
702 * specified structure and value
703 * @param v1 left member of comparison
704 * @param v2 right member of comparison
705 * @return success/failure of operation
707 gboolean
lttv_apply_op_ge_uint64(gpointer v1
, char* v2
) {
708 guint64
* r
= (guint64
*) v1
;
709 guint64 l
= atoi(v2
);
714 * Applies the 'greater or equal' operator to the
715 * specified structure and value
716 * @param v1 left member of comparison
717 * @param v2 right member of comparison
718 * @return success/failure of operation
720 gboolean
lttv_apply_op_ge_uint32(gpointer v1
, char* v2
) {
721 guint32
* r
= (guint32
*) v1
;
722 guint32 l
= atoi(v2
);
727 * Applies the 'greater or equal' operator to the
728 * specified structure and value
729 * @param v1 left member of comparison
730 * @param v2 right member of comparison
731 * @return success/failure of operation
733 gboolean
lttv_apply_op_ge_uint16(gpointer v1
, char* v2
) {
734 guint16
* r
= (guint16
*) v1
;
735 guint16 l
= atoi(v2
);
740 * Applies the 'greater or equal' operator to the
741 * specified structure and value
742 * @param v1 left member of comparison
743 * @param v2 right member of comparison
744 * @return success/failure of operation
746 gboolean
lttv_apply_op_ge_double(gpointer v1
, char* v2
) {
747 double* r
= (double*) v1
;
754 * Makes a copy of the current filter tree
755 * @param tree pointer to the current tree
756 * @return new copy of the filter tree
759 lttv_filter_tree_clone(LttvFilterTree
* tree
) {
761 LttvFilterTree
* newtree
= lttv_filter_tree_new();
763 newtree
->node
= tree
->node
;
765 newtree
->left
= tree
->left
;
766 if(newtree
->left
== LTTV_TREE_NODE
) {
767 newtree
->l_child
.t
= lttv_filter_tree_clone(tree
->l_child
.t
);
768 } else if(newtree
->left
== LTTV_TREE_LEAF
) {
769 newtree
->l_child
.leaf
= lttv_simple_expression_new();
770 newtree
->l_child
.leaf
->field
= tree
->l_child
.leaf
->field
;
771 newtree
->l_child
.leaf
->offset
= tree
->l_child
.leaf
->offset
;
772 newtree
->l_child
.leaf
->op
= tree
->l_child
.leaf
->op
;
773 newtree
->l_child
.leaf
->value
= g_strconcat(tree
->l_child
.leaf
->value
);
776 newtree
->right
= tree
->right
;
777 if(newtree
->right
== LTTV_TREE_NODE
) {
778 newtree
->r_child
.t
= lttv_filter_tree_clone(tree
->r_child
.t
);
779 } else if(newtree
->right
== LTTV_TREE_LEAF
) {
780 newtree
->r_child
.leaf
= lttv_simple_expression_new();
781 newtree
->r_child
.leaf
->field
= tree
->r_child
.leaf
->field
;
782 newtree
->r_child
.leaf
->offset
= tree
->r_child
.leaf
->offset
;
783 newtree
->r_child
.leaf
->op
= tree
->r_child
.leaf
->op
;
784 newtree
->r_child
.leaf
->value
= g_strconcat(tree
->r_child
.leaf
->value
);
792 * Makes a copy of the current filter
793 * @param filter pointer to the current filter
794 * @return new copy of the filter
797 lttv_filter_clone(LttvFilter
* filter
) {
800 LttvFilter
* newfilter
= g_new(LttvFilter
,1);
802 // newfilter->expression = g_new(char,1)
803 strcpy(newfilter
->expression
,filter
->expression
);
805 newfilter
->head
= lttv_filter_tree_clone(filter
->head
);
813 * Creates a new lttv_filter
814 * @param expression filtering options string
815 * @param t pointer to the current LttvTrace
816 * @return the current lttv_filter or NULL if error
821 LttvFilter
* filter
= g_new(LttvFilter
,1);
822 filter
->expression
= NULL
;
828 * Updates the current LttvFilter by building
829 * its tree based upon the expression string
830 * @param filter pointer to the current LttvFilter
831 * @return Failure/Success of operation
834 lttv_filter_update(LttvFilter
* filter
) {
836 g_print("filter::lttv_filter_new()\n"); /* debug */
838 if(filter
->expression
== NULL
) return FALSE
;
842 p_nesting
=0, /* parenthesis nesting value */
843 b
=0; /* current breakpoint in expression string */
847 *tree
= lttv_filter_tree_new(), /* main tree */
848 *subtree
= NULL
, /* buffer for subtrees */
854 * If the tree already exists,
855 * destroy it and build a new one
857 if(filter
->head
!= NULL
) lttv_filter_tree_destroy(filter
->head
);
862 * each element of the list
863 * is a sub tree created
864 * by the use of parenthesis in the
865 * global expression. The final tree
866 * will be the one left at the root of
869 GPtrArray
*tree_stack
= g_ptr_array_new();
870 g_ptr_array_add( tree_stack
,(gpointer
) tree
);
872 /* temporary values */
873 GString
*a_field_component
= g_string_new("");
874 GPtrArray
*a_field_path
= NULL
;
876 LttvSimpleExpression
* a_simple_expression
= lttv_simple_expression_new();
879 * Parse entire expression and construct
880 * the binary tree. There are two steps
881 * in browsing that string
882 * 1. finding boolean ops " &,|,^,! " and parenthesis " {,(,[,],),} "
883 * 2. finding simple expressions
884 * - field path ( separated by dots )
885 * - op ( >, <, =, >=, <=, !=)
886 * - value ( integer, string ... )
887 * To spare computing time, the whole
888 * string is parsed in this loop for a
889 * O(n) complexity order.
891 * When encountering logical op &,|,^
892 * 1. parse the last value if any
893 * 2. create a new tree
894 * 3. add the expression (simple exp, or exp (subtree)) to the tree
895 * 4. concatenate this tree with the current tree on top of the stack
896 * When encountering math ops >,>=,<,<=,=,!=
897 * 1. add to op to the simple expression
898 * 2. concatenate last field component to field path
899 * When encountering concatening ops .
900 * 1. concatenate last field component to field path
901 * When encountering opening parenthesis (,{,[
902 * 1. create a new subtree on top of tree stack
903 * When encountering closing parenthesis ),},]
904 * 1. add the expression on right child of the current tree
905 * 2. the subtree is completed, allocate a new subtree
906 * 3. pop the tree value from the tree stack
909 a_field_path
= g_ptr_array_new();
910 // g_ptr_array_set_size(a_field_path,2); /* by default, recording 2 field expressions */
913 for(i
=0;i
<strlen(filter
->expression
);i
++) {
916 // for(t=0;t<a_field_path->len;t++) {
917 // GString* t3 = g_ptr_array_index(a_field_path,t);
918 // g_print("%i=%s ",t,t3->str);
920 g_print("%c ",filter
->expression
[i
]);
921 switch(filter
->expression
[i
]) {
927 t1
= (LttvFilterTree
*)g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
928 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
929 t2
= lttv_filter_tree_new();
930 t2
->node
= LTTV_LOGICAL_AND
;
931 if(subtree
!= NULL
) { /* append subtree to current tree */
932 t2
->left
= LTTV_TREE_NODE
;
933 t2
->l_child
.t
= subtree
;
935 t1
->right
= LTTV_TREE_NODE
;
937 } else { /* append a simple expression */
938 a_simple_expression
->value
= a_field_component
->str
;
939 a_field_component
= g_string_new("");
940 t2
->left
= LTTV_TREE_LEAF
;
941 t2
->l_child
.leaf
= a_simple_expression
;
942 a_simple_expression
= lttv_simple_expression_new();
943 t1
->right
= LTTV_TREE_NODE
;
950 t1
= (LttvFilter
*)g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
951 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
952 t2
= lttv_filter_tree_new();
953 t2
->node
= LTTV_LOGICAL_OR
;
954 if(subtree
!= NULL
) { /* append subtree to current tree */
955 t2
->left
= LTTV_TREE_NODE
;
956 t2
->l_child
.t
= subtree
;
958 t1
->right
= LTTV_TREE_NODE
;
960 } else { /* append a simple expression */
961 a_simple_expression
->value
= a_field_component
->str
;
962 a_field_component
= g_string_new("");
963 t2
->left
= LTTV_TREE_LEAF
;
964 t2
->l_child
.leaf
= a_simple_expression
;
965 a_simple_expression
= lttv_simple_expression_new();
966 t1
->right
= LTTV_TREE_NODE
;
973 t1
= (LttvFilter
*)g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
974 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
975 t2
= lttv_filter_tree_new();
976 t2
->node
= LTTV_LOGICAL_XOR
;
977 if(subtree
!= NULL
) { /* append subtree to current tree */
978 t2
->left
= LTTV_TREE_NODE
;
979 t2
->l_child
.t
= subtree
;
981 t1
->right
= LTTV_TREE_NODE
;
983 } else { /* append a simple expression */
984 a_simple_expression
->value
= a_field_component
->str
;
985 a_field_component
= g_string_new("");
986 t2
->left
= LTTV_TREE_LEAF
;
987 t2
->l_child
.leaf
= a_simple_expression
;
988 a_simple_expression
= lttv_simple_expression_new();
989 t1
->right
= LTTV_TREE_NODE
;
994 case '!': /* not, or not equal (math op) */
996 if(filter
->expression
[i
+1] == '=') { /* != */
997 g_ptr_array_add( a_field_path
,(gpointer
) a_field_component
);
998 parse_field_path(a_field_path
,a_simple_expression
);
999 a_field_component
= g_string_new("");
1000 assign_operator(a_simple_expression
,LTTV_FIELD_NE
);
1003 // g_print("%s\n",a_field_component);
1004 // a_field_component = g_string_new("");
1005 t1
= (LttvFilter
*)g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1006 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
1007 t2
= lttv_filter_tree_new();
1008 t2
->node
= LTTV_LOGICAL_NOT
;
1009 t1
->right
= LTTV_TREE_NODE
;
1014 case '(': /* start of parenthesis */
1018 p_nesting
++; /* incrementing parenthesis nesting value */
1019 t1
= lttv_filter_tree_new();
1020 g_ptr_array_add( tree_stack
,(gpointer
) t1
);
1023 case ')': /* end of parenthesis */
1027 p_nesting
--; /* decrementing parenthesis nesting value */
1028 if(p_nesting
<0 || tree_stack
->len
<2) {
1029 g_warning("Wrong filtering options, the string\n\"%s\"\n\
1030 is not valid due to parenthesis incorrect use",filter
->expression
);
1034 g_assert(tree_stack
->len
>0);
1035 if(subtree
!= NULL
) { /* append subtree to current tree */
1036 t1
= g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1037 while(t1
->right
!= LTTV_TREE_IDLE
&& t1
->right
!= LTTV_TREE_LEAF
) {
1038 g_assert(t1
!=NULL
&& t1
->r_child
.t
!= NULL
);
1041 t1
->right
= LTTV_TREE_NODE
;
1042 t1
->r_child
.t
= subtree
;
1043 subtree
= g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1044 g_ptr_array_remove_index(tree_stack
,tree_stack
->len
-1);
1045 } else { /* assign subtree as current tree */
1046 a_simple_expression
->value
= a_field_component
->str
;
1047 a_field_component
= g_string_new("");
1048 t1
= g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1049 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
1050 t1
->right
= LTTV_TREE_LEAF
;
1051 t1
->r_child
.leaf
= a_simple_expression
;
1052 a_simple_expression
= lttv_simple_expression_new();
1053 subtree
= g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1054 g_assert(subtree
!= NULL
);
1055 g_ptr_array_remove_index(tree_stack
,tree_stack
->len
-1);
1060 * mathematic operators
1062 case '<': /* lower, lower or equal */
1064 g_ptr_array_add( a_field_path
,(gpointer
) a_field_component
);
1065 parse_field_path(a_field_path
,a_simple_expression
);
1066 a_field_component
= g_string_new("");
1067 if(filter
->expression
[i
+1] == '=') { /* <= */
1069 assign_operator(a_simple_expression
,LTTV_FIELD_LE
);
1070 } else assign_operator(a_simple_expression
,LTTV_FIELD_LT
);
1073 case '>': /* higher, higher or equal */
1075 g_ptr_array_add( a_field_path
,(gpointer
) a_field_component
);
1076 parse_field_path(a_field_path
,a_simple_expression
);
1077 a_field_component
= g_string_new("");
1078 if(filter
->expression
[i
+1] == '=') { /* >= */
1080 assign_operator(a_simple_expression
,LTTV_FIELD_GE
);
1081 } else assign_operator(a_simple_expression
,LTTV_FIELD_GT
);
1084 case '=': /* equal */
1086 g_ptr_array_add( a_field_path
,(gpointer
) a_field_component
);
1087 parse_field_path(a_field_path
,a_simple_expression
);
1088 a_field_component
= g_string_new("");
1089 assign_operator(a_simple_expression
,LTTV_FIELD_EQ
);
1093 * Field concatening caracter
1098 * divide field expression into elements
1099 * in a_field_path array.
1101 // if(a_simple_expression->op == NULL) {
1102 g_ptr_array_add( a_field_path
,(gpointer
) a_field_component
);
1103 a_field_component
= g_string_new("");
1107 default: /* concatening current string */
1108 g_string_append_c(a_field_component
,filter
->expression
[i
]);
1112 g_print("subtree:%p, tree:%p, t1:%p, t2:%p\n",subtree
,tree
,t1
,t2
);
1113 g_print("stack size: %i\n",tree_stack
->len
);
1116 * Preliminary check to see
1117 * if tree was constructed correctly
1120 g_warning("Wrong filtering options, the string\n\"%s\"\n\
1121 is not valid due to parenthesis incorrect use",filter
->expression
);
1125 if(tree_stack
->len
!= 1) /* only root tree should remain */
1128 /* processing last element of expression */
1129 t1
= g_ptr_array_index(tree_stack
,tree_stack
->len
-1);
1130 while(t1
->right
!= LTTV_TREE_IDLE
) t1
= t1
->r_child
.t
;
1131 if(subtree
!= NULL
) { /* add the subtree */
1132 t1
->right
= LTTV_TREE_NODE
;
1133 t1
->r_child
.t
= subtree
;
1135 } else { /* add a leaf */
1136 a_simple_expression
->value
= a_field_component
->str
;
1137 a_field_component
= g_string_new("");
1138 t1
->right
= LTTV_TREE_LEAF
;
1139 t1
->r_child
.leaf
= a_simple_expression
;
1141 * FIXME: is it really necessary to reallocate
1142 * LttvSimpleExpression at this point ??
1144 a_simple_expression
= lttv_simple_expression_new();
1147 g_assert(tree
!= NULL
);
1148 g_assert(subtree
== NULL
);
1150 lttv_print_tree(filter
->head
) ;
1152 g_print("ended update tree!\n");
1160 * Destroy the current LttvFilter
1161 * @param filter pointer to the current LttvFilter
1164 lttv_filter_destroy(LttvFilter
* filter
) {
1166 g_free(filter
->expression
);
1167 lttv_filter_tree_destroy(filter
->head
);
1173 * Assign a new tree for the current expression
1175 * @return pointer of LttvFilterTree
1178 lttv_filter_tree_new() {
1179 LttvFilterTree
* tree
;
1181 tree
= g_new(LttvFilter
,1);
1182 tree
->node
= 0; //g_new(lttv_expression,1);
1183 tree
->left
= LTTV_TREE_IDLE
;
1184 tree
->right
= LTTV_TREE_IDLE
;
1190 * Append a new expression to the expression
1191 * defined in the current filter
1192 * @param filter pointer to the current LttvFilter
1193 * @param expression string that must be appended
1195 void lttv_filter_append_expression(LttvFilter
* filter
, char *expression
) {
1197 if(expression
== NULL
) return;
1198 if(filter
== NULL
) {
1199 filter
= lttv_filter_new();
1200 filter
->expression
= expression
;
1201 } else if(filter
->expression
== NULL
) {
1202 filter
->expression
= expression
;
1204 filter
->expression
= g_strconcat(filter
->expression
,"&",expression
);
1207 lttv_filter_update(filter
);
1212 * Clear the filter expression from the
1213 * current filter and sets its pointer to NULL
1214 * @param filter pointer to the current LttvFilter
1216 void lttv_filter_clear_expression(LttvFilter
* filter
) {
1218 if(filter
->expression
!= NULL
) {
1219 g_free(filter
->expression
);
1220 filter
->expression
= NULL
;
1226 * Destroys the tree and his sub-trees
1227 * @param tree Tree which must be destroyed
1230 lttv_filter_tree_destroy(LttvFilterTree
* tree
) {
1232 if(tree
== NULL
) return;
1234 if(tree
->left
== LTTV_TREE_LEAF
) g_free(tree
->l_child
.leaf
);
1235 else if(tree
->left
== LTTV_TREE_NODE
) lttv_filter_tree_destroy(tree
->l_child
.t
);
1237 if(tree
->right
== LTTV_TREE_LEAF
) g_free(tree
->r_child
.leaf
);
1238 else if(tree
->right
== LTTV_TREE_NODE
) lttv_filter_tree_destroy(tree
->r_child
.t
);
1245 * Global parsing function for the current
1247 * @param tree pointer to the current LttvFilterTree
1248 * @param event current LttEvent, NULL if not used
1249 * @param tracefile current LttTracefile, NULL if not used
1250 * @param trace current LttTrace, NULL if not used
1251 * @param state current LttvProcessState, NULL if not used
1254 lttv_filter_tree_parse(
1257 LttTracefile
* tracefile
,
1259 LttvProcessState
* state
1264 * Each tree is parsed in inorder.
1265 * This way, it's possible to apply the left filter of the
1266 * tree, then decide whether or not the right branch should
1267 * be parsed depending on the linking logical operator
1269 * Each node consists in a
1270 * 1. logical operator
1271 * 2. left child ( node or simple expression )
1272 * 3. right child ( node or simple expression )
1274 * When the child is a simple expression, we must
1275 * before all determine if the expression refers to
1276 * a structure which is whithin observation ( not NULL ).
1277 * -If so, the expression is evaluated.
1278 * -If not, the result is set to TRUE since this particular
1279 * operation does not interfere with the lttv structure
1281 * The result of each simple expression will directly
1282 * affect the next branch. This way, depending on
1283 * the linking logical operator, the parser will decide
1284 * to explore or not the next branch.
1286 * -If result of left branch is 0 / FALSE
1287 * then don't explore right branch and return 0;
1288 * -If result of left branch is 1 / TRUE then explore
1290 * -If result of left branch is 1 / TRUE
1291 * then don't explore right branch and return 1;
1292 * -If result of left branch is 0 / FALSE then explore
1294 * -Result of left branchwill not affect exploration of
1298 gboolean lresult
= FALSE
, rresult
= FALSE
;
1303 if(t
->left
== LTTV_TREE_NODE
) lresult
= lttv_filter_tree_parse(t
->l_child
.t
,event
,tracefile
,trace
,state
);
1304 else if(t
->left
== LTTV_TREE_LEAF
) {
1305 //g_print("%p: left is %i %p %s\n",t,t->l_child.leaf->field,t->l_child.leaf->op,t->l_child.leaf->value);
1307 g_assert(v
= t
->l_child
.leaf
->value
);
1308 switch(t
->l_child
.leaf
->field
) {
1310 case LTTV_FILTER_TRACE_NAME
:
1311 if(trace
== NULL
) lresult
= TRUE
;
1312 else lresult
= t
->l_child
.leaf
->op((gpointer
)ltt_trace_name(trace
),v
);
1314 case LTTV_FILTER_TRACEFILE_NAME
:
1315 if(tracefile
== NULL
) lresult
= TRUE
;
1316 else lresult
= t
->l_child
.leaf
->op((gpointer
)ltt_tracefile_name(tracefile
),v
);
1318 case LTTV_FILTER_STATE_PID
:
1319 if(state
== NULL
) lresult
= TRUE
;
1320 else lresult
= t
->l_child
.leaf
->op((gpointer
)&state
->pid
,v
);
1322 case LTTV_FILTER_STATE_PPID
:
1323 if(state
== NULL
) lresult
= TRUE
;
1324 else lresult
= t
->l_child
.leaf
->op((gpointer
)&state
->ppid
,v
);
1326 case LTTV_FILTER_STATE_CT
:
1327 if(state
== NULL
) lresult
= TRUE
;
1329 double val
= ltt_time_to_double(state
->creation_time
);
1330 lresult
= t
->l_child
.leaf
->op((gpointer
)&val
,v
);
1333 case LTTV_FILTER_STATE_IT
:
1334 if(state
== NULL
) lresult
= TRUE
;
1336 double val
= ltt_time_to_double(state
->insertion_time
);
1337 lresult
= t
->l_child
.leaf
->op((gpointer
)&val
,v
);
1340 case LTTV_FILTER_STATE_P_NAME
:
1342 * FIXME: Yet to be done ( I think ? )
1346 case LTTV_FILTER_STATE_EX_MODE
:
1347 if(state
== NULL
) lresult
= TRUE
;
1348 else lresult
= t
->l_child
.leaf
->op((gpointer
)&state
->state
->t
,v
);
1350 case LTTV_FILTER_STATE_EX_SUBMODE
:
1351 if(state
== NULL
) lresult
= TRUE
;
1352 else lresult
= t
->l_child
.leaf
->op((gpointer
)&state
->state
->n
,v
);
1354 case LTTV_FILTER_STATE_P_STATUS
:
1355 if(state
== NULL
) lresult
= TRUE
;
1356 else lresult
= t
->l_child
.leaf
->op((gpointer
)&state
->state
->s
,v
);
1358 case LTTV_FILTER_STATE_CPU
:
1360 * FIXME: What is the comparison value ?
1364 case LTTV_FILTER_EVENT_NAME
:
1365 if(event
== NULL
) lresult
= TRUE
;
1366 else lresult
= t
->l_child
.leaf
->op((gpointer
)ltt_event_eventtype(event
),v
);
1369 case LTTV_FILTER_EVENT_CATEGORY
:
1371 * FIXME: Not yet implemented
1375 case LTTV_FILTER_EVENT_TIME
:
1376 // if(event == NULL) lresult = TRUE;
1378 // double val = ltt_time_to_double(event->event_time);
1379 // lresult = t->l_child.leaf->op((gpointer)&val,v);
1383 case LTTV_FILTER_EVENT_TSC
:
1384 // if(event == NULL) lresult = TRUE;
1386 // double val = ltt_time_to_double(event->event_time);
1387 // lresult = t->l_child.leaf->op((gpointer)&val,v);
1390 * FIXME: Where is event.tsc
1394 case LTTV_FILTER_EVENT_FIELD
:
1396 * TODO: Use the offset to
1397 * find the dynamic field
1398 * in the event struct
1403 * This case should never be
1404 * parsed, if so, the whole
1405 * filtering is cancelled
1407 g_warning("Error while parsing the filter tree");
1413 * Parse linking operator
1414 * make a cutoff if possible
1416 if((t
->node
& LTTV_LOGICAL_OR
) && lresult
== TRUE
) return TRUE
;
1417 if((t
->node
& LTTV_LOGICAL_AND
) && lresult
== FALSE
) return FALSE
;
1420 * Parse right branch
1422 if(t
->right
== LTTV_TREE_NODE
) rresult
= lttv_filter_tree_parse(t
->r_child
.t
,event
,tracefile
,trace
,state
);
1423 else if(t
->right
== LTTV_TREE_LEAF
) {
1424 //g_print("%p: right is %i %p %s\n",t,t->r_child.leaf->field,t->r_child.leaf->op,t->r_child.leaf->value);
1426 g_assert(v
= t
->r_child
.leaf
->value
);
1427 switch(t
->r_child
.leaf
->field
) {
1429 case LTTV_FILTER_TRACE_NAME
:
1430 if(trace
== NULL
) rresult
= TRUE
;
1431 else rresult
= t
->r_child
.leaf
->op((gpointer
)ltt_trace_name(trace
),v
);
1433 case LTTV_FILTER_TRACEFILE_NAME
:
1434 if(tracefile
== NULL
) rresult
= TRUE
;
1435 else rresult
= t
->r_child
.leaf
->op((gpointer
)ltt_tracefile_name(tracefile
),v
);
1437 case LTTV_FILTER_STATE_PID
:
1438 if(state
== NULL
) rresult
= TRUE
;
1439 else rresult
= t
->r_child
.leaf
->op((gpointer
)&state
->pid
,v
);
1441 case LTTV_FILTER_STATE_PPID
:
1442 if(state
== NULL
) rresult
= TRUE
;
1443 else rresult
= t
->r_child
.leaf
->op((gpointer
)&state
->ppid
,v
);
1445 case LTTV_FILTER_STATE_CT
:
1446 if(state
== NULL
) rresult
= TRUE
;
1448 double val
= ltt_time_to_double(state
->creation_time
);
1449 rresult
= t
->r_child
.leaf
->op((gpointer
)&val
,v
);
1452 case LTTV_FILTER_STATE_IT
:
1453 if(state
== NULL
) rresult
= TRUE
;
1455 double val
= ltt_time_to_double(state
->insertion_time
);
1456 rresult
= t
->r_child
.leaf
->op((gpointer
)&val
,v
);
1459 case LTTV_FILTER_STATE_P_NAME
:
1461 * FIXME: Yet to be done ( I think ? )
1465 case LTTV_FILTER_STATE_EX_MODE
:
1466 if(state
== NULL
) rresult
= TRUE
;
1467 else rresult
= t
->r_child
.leaf
->op((gpointer
)&state
->state
->t
,v
);
1469 case LTTV_FILTER_STATE_EX_SUBMODE
:
1470 if(state
== NULL
) rresult
= TRUE
;
1471 else rresult
= t
->r_child
.leaf
->op((gpointer
)&state
->state
->n
,v
);
1473 case LTTV_FILTER_STATE_P_STATUS
:
1474 if(state
== NULL
) rresult
= TRUE
;
1475 else rresult
= t
->r_child
.leaf
->op((gpointer
)&state
->state
->s
,v
);
1477 case LTTV_FILTER_STATE_CPU
:
1479 * FIXME: What is the comparison value ?
1483 case LTTV_FILTER_EVENT_NAME
:
1484 if(event
== NULL
) rresult
= TRUE
;
1485 else rresult
= t
->r_child
.leaf
->op((gpointer
)ltt_event_eventtype(event
),v
);
1488 case LTTV_FILTER_EVENT_CATEGORY
:
1490 * FIXME: Not yet implemented
1494 case LTTV_FILTER_EVENT_TIME
:
1495 // if(event == NULL) rresult = TRUE;
1497 // double val = ltt_time_to_double(event->event_time);
1498 // rresult = t->r_child.leaf->op((gpointer)&val,v);
1502 case LTTV_FILTER_EVENT_TSC
:
1503 // if(event == NULL) rresult = TRUE;
1505 // double val = ltt_time_to_double(event->event_time);
1506 // rresult = t->r_child.leaf->op((gpointer)&val,v);
1509 * FIXME: Where is event.tsc
1513 case LTTV_FILTER_EVENT_FIELD
:
1515 * TODO: Use the offset to
1516 * find the dynamic field
1517 * in the event struct
1522 * This case should never be
1523 * parsed, if so, this subtree
1526 g_warning("Error while parsing the filter tree");
1532 * Apply and return the
1533 * logical link between the
1537 case LTTV_LOGICAL_OR
: return (lresult
| rresult
);
1538 case LTTV_LOGICAL_AND
: return (lresult
& rresult
);
1539 case LTTV_LOGICAL_NOT
: return (!rresult
);
1540 case LTTV_LOGICAL_XOR
: return (lresult
^ rresult
);
1543 * This case should never be
1544 * parsed, if so, this subtree
1556 lttv_print_tree(LttvFilterTree
* t
) {
1558 g_print("node:%p lchild:%p rchild:%p\n",t
,
1559 (t
->left
==LTTV_TREE_NODE
)?t
->l_child
.t
:NULL
,
1560 (t
->right
==LTTV_TREE_NODE
)?t
->r_child
.t
:NULL
);
1561 g_print("node type: %i / [left] %i / [right] %i\n",t
->node
,t
->left
,t
->right
);
1562 if(t
->left
== LTTV_TREE_NODE
) lttv_print_tree(t
->l_child
.t
);
1563 else if(t
->left
== LTTV_TREE_LEAF
) {
1564 g_assert(t
->l_child
.leaf
->value
!= NULL
);
1565 g_print("%p: left is %i %p %s\n",t
,t
->l_child
.leaf
->field
,t
->l_child
.leaf
->op
,t
->l_child
.leaf
->value
);
1568 if(t
->right
== LTTV_TREE_NODE
) lttv_print_tree(t
->r_child
.t
);
1569 else if(t
->right
== LTTV_TREE_LEAF
) {
1570 g_assert(t
->r_child
.leaf
->value
!= NULL
);
1571 g_print("%p: right is %i %p %s\n",t
,t
->r_child
.leaf
->field
,t
->r_child
.leaf
->op
,t
->r_child
.leaf
->value
);
1578 * Apply the filter to a specific trace
1579 * @param filter the current filter applied
1580 * @param tracefile the trace to apply the filter to
1581 * @return success/failure of operation
1584 lttv_filter_tracefile(LttvFilter
*filter
, LttTracefile
*tracefile
) {
1586 return lttv_filter_tree_parse(filter
->head
,NULL
,tracefile
,NULL
,NULL
);
1591 lttv_filter_tracestate(LttvFilter
*filter
, LttvTraceState
*tracestate
) {
1596 * Apply the filter to a specific event
1597 * @param filter the current filter applied
1598 * @param event the event to apply the filter to
1599 * @return success/failure of operation
1602 lttv_filter_event(LttvFilter
*filter
, LttEvent
*event
) {
1607 * Initializes the filter module and specific values
1609 static void module_init()
1613 * Quarks initialization
1614 * for hardcoded filtering options
1616 * TODO: traceset has no yet been defined
1620 // LTTV_FILTER_EVENT = g_quark_from_string("event");
1621 // LTTV_FILTER_TRACE = g_quark_from_string("trace");
1622 // LTTV_FILTER_TRACESET = g_quark_from_string("traceset");
1623 // LTTV_FILTER_STATE = g_quark_from_string("state");
1624 // LTTV_FILTER_TRACEFILE = g_quark_from_string("tracefile");
1626 /* event.name, tracefile.name, trace.name */
1627 // LTTV_FILTER_NAME = g_quark_from_string("name");
1629 /* event sub fields */
1630 // LTTV_FILTER_CATEGORY = g_quark_from_string("category");
1631 // LTTV_FILTER_TIME = g_quark_from_string("time");
1632 // LTTV_FILTER_TSC = g_quark_from_string("tsc");
1634 /* state sub fields */
1635 // LTTV_FILTER_PID = g_quark_from_string("pid");
1636 // LTTV_FILTER_PPID = g_quark_from_string("ppid");
1637 // LTTV_FILTER_C_TIME = g_quark_from_string("creation_time");
1638 // LTTV_FILTER_I_TIME = g_quark_from_string("insertion_time");
1639 // LTTV_FILTER_P_NAME = g_quark_from_string("process_name");
1640 // LTTV_FILTER_EX_MODE = g_quark_from_string("execution_mode");
1641 // LTTV_FILTER_EX_SUBMODE = g_quark_from_string("execution_submode");
1642 // LTTV_FILTER_P_STATUS = g_quark_from_string("process_status");
1643 // LTTV_FILTER_CPU = g_quark_from_string("cpu");
1648 * Destroys the filter module and specific values
1650 static void module_destroy()
1655 LTTV_MODULE("filter", "Filters traceset and events", \
1656 "Filters traceset and events specifically to user input", \
1657 module_init
, module_destroy
)