X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ffilter.c;h=f62755868f27f8958e4b13989556d2ef6effd5d1;hb=d34141ca6fc6dd872a922134b22095bd74ec013d;hp=efe6bd64a0876939949f87e9a78a6108a58f86d9;hpb=2db179215183cb958f4ced4d4cdd3a30c856ae07;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index efe6bd64..f6275586 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -35,6 +35,7 @@ * | |->category (String, not yet implemented) * | |->time (LttTime) * | |->tsc (LttCycleCount --> uint64) + * | |->target_pid (target PID of the event) * | |->fields * | |->"facility_name * | |->"event name" @@ -79,8 +80,6 @@ #include #include #include -#include -#include #include #include @@ -210,6 +209,7 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) { * event.category * event.time * event.tsc + * event.target_pid * event.field */ g_string_free(f,TRUE); @@ -217,9 +217,6 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) { if(!g_strcasecmp(f->str,"name") ) { se->field = LTTV_FILTER_EVENT_NAME; } - else if(!g_strcasecmp(f->str,"facility") ) { - se->field = LTTV_FILTER_EVENT_FACILITY; - } else if(!g_strcasecmp(f->str,"category") ) { /* * FIXME: Category not yet functional in lttv @@ -232,6 +229,9 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) { else if(!g_strcasecmp(f->str,"tsc") ) { se->field = LTTV_FILTER_EVENT_TSC; } + else if(!g_strcasecmp(f->str,"target_pid") ) { + se->field = LTTV_FILTER_EVENT_TARGET_PID; + } else if(!g_strcasecmp(f->str,"field") ) { se->field = LTTV_FILTER_EVENT_FIELD; g_string_free(f,TRUE); @@ -283,7 +283,6 @@ lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionO case LTTV_FILTER_STATE_P_NAME: case LTTV_FILTER_STATE_T_BRAND: case LTTV_FILTER_EVENT_NAME: - case LTTV_FILTER_EVENT_FACILITY: case LTTV_FILTER_STATE_EX_MODE: case LTTV_FILTER_STATE_EX_SUBMODE: case LTTV_FILTER_STATE_P_STATUS: @@ -333,6 +332,7 @@ lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionO case LTTV_FILTER_STATE_CPU: case LTTV_FILTER_STATE_PID: case LTTV_FILTER_STATE_PPID: + case LTTV_FILTER_EVENT_TARGET_PID: switch(op) { case LTTV_FIELD_EQ: se->op = lttv_apply_op_eq_uint; @@ -445,7 +445,6 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) { case LTTV_FILTER_STATE_P_NAME: case LTTV_FILTER_STATE_T_BRAND: case LTTV_FILTER_EVENT_NAME: - case LTTV_FILTER_EVENT_FACILITY: case LTTV_FILTER_STATE_EX_MODE: case LTTV_FILTER_STATE_EX_SUBMODE: case LTTV_FILTER_STATE_P_STATUS: @@ -466,6 +465,7 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) { case LTTV_FILTER_STATE_PID: case LTTV_FILTER_STATE_PPID: case LTTV_FILTER_STATE_CPU: + case LTTV_FILTER_EVENT_TARGET_PID: se->value.v_uint = atoi(value); g_free(value); break; @@ -568,10 +568,10 @@ lttv_struct_type(gint ft) { return LTTV_FILTER_STATE; break; case LTTV_FILTER_EVENT_NAME: - case LTTV_FILTER_EVENT_FACILITY: case LTTV_FILTER_EVENT_CATEGORY: case LTTV_FILTER_EVENT_TIME: case LTTV_FILTER_EVENT_TSC: + case LTTV_FILTER_EVENT_TARGET_PID: case LTTV_FILTER_EVENT_FIELD: return LTTV_FILTER_EVENT; break; @@ -1825,7 +1825,9 @@ lttv_filter_tree_parse( const LttEvent* event, const LttTracefile* tracefile, const LttTrace* trace, - const LttvTracefileContext* context + const LttvTracefileContext* context, + const LttvProcessState* state, + const LttvTraceContext* tc /*,...*/) { @@ -1866,18 +1868,24 @@ lttv_filter_tree_parse( gboolean lresult = FALSE, rresult = FALSE; - LttvProcessState* state; - - LttvTraceState *ts = (LttvTraceState*)context->t_context; + LttvTraceState *ts; LttvTracefileState *tfs = (LttvTracefileState*)context; - guint cpu = tfs->cpu; - state = ts->running_process[cpu]; + if(tc) + ts = (LttvTraceState*)tc; + else if(context) + ts = (LttvTraceState*)context->t_context; + + if(tfs) { + guint cpu = tfs->cpu; + if(ts) + state = ts->running_process[cpu]; + } /* * Parse left branch */ if(t->left == LTTV_TREE_NODE) { - lresult = lttv_filter_tree_parse(t->l_child.t,event,tracefile,trace,context); + lresult = lttv_filter_tree_parse(t->l_child.t,event,tracefile,trace,context,NULL,NULL); } else if(t->left == LTTV_TREE_LEAF) { lresult = lttv_filter_tree_parse_branch(t->l_child.leaf,event,tracefile,trace,state,context); @@ -1894,7 +1902,7 @@ lttv_filter_tree_parse( * Parse right branch */ if(t->right == LTTV_TREE_NODE) { - rresult = lttv_filter_tree_parse(t->r_child.t,event,tracefile,trace,context); + rresult = lttv_filter_tree_parse(t->r_child.t,event,tracefile,trace,context,NULL,NULL); } else if(t->right == LTTV_TREE_LEAF) { rresult = lttv_filter_tree_parse_branch(t->r_child.leaf,event,tracefile,trace,state,context); @@ -1987,7 +1995,7 @@ lttv_filter_tree_parse_branch( return se->op((gpointer)&quark,v); } break; - case LTTV_FILTER_STATE_T_BRAND: + case LTTV_FILTER_STATE_T_BRAND: if(state == NULL) return TRUE; else { GQuark quark = state->brand; @@ -2007,27 +2015,18 @@ lttv_filter_tree_parse_branch( else return se->op((gpointer)&state->state->s,v); break; case LTTV_FILTER_STATE_CPU: - if(context == NULL) return TRUE; + if(state == NULL) return TRUE; else { - if(state == NULL) return TRUE; - else return se->op((gpointer)&state->cpu,v); + return se->op((gpointer)&state->cpu,v); } break; case LTTV_FILTER_EVENT_NAME: if(event == NULL) return TRUE; else { - LttEventType* et; - et = ltt_event_eventtype(event); - GQuark quark = ltt_eventtype_name(et); - return se->op((gpointer)&quark,v); - } - break; - case LTTV_FILTER_EVENT_FACILITY: - if(event == NULL) return TRUE; - else { - LttFacility* fac; - fac = ltt_event_facility(event); - GQuark quark = ltt_facility_name(fac); + struct marker_info *info; + info = marker_get_info_from_id((LttTrace *)trace, event->event_id); + g_assert(info != NULL); + GQuark quark = info->name; return se->op((gpointer)&quark,v); } break; @@ -2051,6 +2050,14 @@ lttv_filter_tree_parse_branch( return se->op((gpointer)&count,v); } break; + case LTTV_FILTER_EVENT_TARGET_PID: + if(context == NULL) return TRUE; + else { + guint target_pid = + lttv_state_get_target_pid((LttvTracefileState*)context); + return se->op((gpointer)&target_pid,v); + } + break; case LTTV_FILTER_EVENT_FIELD: /* * TODO: Use the offset to