* | |->category (String, not yet implemented)
* | |->time (LttTime)
* | |->tsc (LttCycleCount --> uint64)
+ * | |->target_pid (target PID of the event)
* | |->fields
* | |->"facility_name
* | |->"event name"
* event.category
* event.time
* event.tsc
+ * event.target_pid
* event.field
*/
g_string_free(f,TRUE);
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);
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;
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;
g_string_free(v,TRUE);
se->value.v_ltttime = t;
- //g_error("Filter TEST ltttime : %u, %u.", t.tv_sec, t.tv_nsec);
g_free(value);
break;
default:
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;
i++;
}
break;
- case '\"':
+ case '\"':
nest_quotes = 0;
- i++;
+ i++;
break;
}
if(a_string_spaces->len != 0) {
a_field_component = g_string_append(
a_field_component, a_string_spaces->str);
- a_string_spaces = g_string_set_size(a_string_spaces, 0);
+ a_string_spaces = g_string_set_size(a_string_spaces, 0);
}
a_field_component = g_string_append_c(a_field_component,
filter->expression[i]);
a_field_component = g_string_new("");
g_string_free(a_string_spaces, TRUE);
a_string_spaces = g_string_new("");
+ } else {
+ /* Operator found, we are in the value field */
+ g_string_append_c(a_field_component, filter->expression[i]);
}
break;
case ' ': /* keep spaces that are within a field component */
- if(a_field_component->len == 0) break; /* ignore */
+ if(a_field_component->len == 0) break; /* ignore */
else
a_string_spaces = g_string_append_c(a_string_spaces,
filter->expression[i]);
break;
default: /* concatening current string */
if(a_string_spaces->len != 0) {
- a_field_component = g_string_append(
+ a_field_component = g_string_append(
a_field_component, a_string_spaces->str);
- a_string_spaces = g_string_set_size(a_string_spaces, 0);
+ a_string_spaces = g_string_set_size(a_string_spaces, 0);
}
a_field_component = g_string_append_c(a_field_component,
filter->expression[i]);
const LttEvent* event,
const LttTracefile* tracefile,
const LttTrace* trace,
- const LttvTracefileContext* context
+ const LttvTracefileContext* context,
+ const LttvProcessState* state,
+ const LttvTraceContext* tc
/*,...*/)
{
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);
* 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);
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;
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:
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