* | |->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;
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;
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
LTTV_FILTER_EVENT_CATEGORY, /**< FIXME: not implemented */
LTTV_FILTER_EVENT_TIME, /**< event.time (double) */
LTTV_FILTER_EVENT_TSC, /**< event.tsc (double) */
+ LTTV_FILTER_EVENT_TARGET_PID, /**< event.target_pid (guint) */
LTTV_FILTER_EVENT_FIELD, /**< dynamic field, specified in facility */
LTTV_FILTER_UNDEFINED /**< undefined field */
};
/* Child PID */
child_pid = ltt_event_get_unsigned(e, thf->f2);
+ s->parent.target_pid = child_pid;
/* Child TGID */
if(thf->f3) child_tgid = ltt_event_get_unsigned(e, thf->f3);
/* PID */
pid = ltt_event_get_unsigned(e, thf->f1);
+ s->parent.target_pid = pid;
process = lttv_state_find_process(ts, ANY_CPU, pid);
es = &g_array_index(process->execution_stack, LttvExecutionState, 0);
LttvProcessState *process; // = ts->running_process[cpu];
pid = ltt_event_get_unsigned(e, thf->f1);
+ s->parent.target_pid = pid;
// FIXME : Add this test in the "known state" section
// g_assert(process->pid == pid);
/* PID of the process to release */
release_pid = ltt_event_get_unsigned(e, thf->f1);
+ s->parent.target_pid = release_pid;
g_assert(release_pid != 0);
GArray *user_stack; /* User space function call stack */
guint64 current_function;
LttvProcessType type; /* kernel thread or user space ? */
+ guint target_pid; /* target PID of the current event. */
} LttvProcessState;
#define ANY_CPU 0 /* For clarity sake : a call to lttv_state_find_process for
GType lttv_tracefile_state_get_type (void);
+static inline guint lttv_state_get_target_pid(LttvTracefileState *tfs)
+{
+ LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context;
+ guint cpu = tfs->cpu;
+ LttvProcessState *process = ts->running_process[cpu];
+
+ if(tfs->parent.target_pid) return tfs->parent.target_pid;
+ else return process->pid;
+}
+
#endif // STATE_H
tfc->event = lttv_hooks_new();
tfc->event_by_id = lttv_hooks_by_id_new();
tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
+ tfc->target_pid = 0;
}
fac_id = ltt_event_facility_id(e);
ev_id = ltt_event_eventtype_id(e);
id = GET_HOOK_ID(fac_id, ev_id);
+ tfc->target_pid = 0; /* unset target PID */
/* Hooks :
* return values : 0 : continue read, 1 : go to next position and stop read,
* 2 : stay at the current position and stop read */
LttvHooksById *event_by_id;
LttTime timestamp;
LttvAttribute *a;
+ guint target_pid; /* Target PID of the event.
+ Updated by state.c. 0 means unset. */
};
struct _LttvTracefileContextClass {
g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.category"));
g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.time"));
g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.tsc"));
+ g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.target_pid"));
/*
* TODO: Add core.xml fields here !
*/
g_print("event.category (string)\n");
g_print("event.time (double)\n");
g_print("event.tsc (integer)\n");
+ g_print("event.target_pid (integer)\n");
g_print("event.field.facility_name.event_name.field_name.subfield_name (field_type)\n");
g_print("tracefile.name (string)\n");
g_print("trace.name (string)\n");