GQuark
LTT_FACILITY_KERNEL,
- LTT_FACILITY_PROCESS;
+ LTT_FACILITY_PROCESS,
+ LTT_FACILITY_FS;
/* Events Quarks */
LTT_EVENT_SCHEDCHANGE,
LTT_EVENT_FORK,
LTT_EVENT_EXIT,
- LTT_EVENT_FREE;
+ LTT_EVENT_FREE,
+ LTT_EVENT_EXEC;
/* Fields Quarks */
LTT_FIELD_OUT_STATE,
LTT_FIELD_PARENT_PID,
LTT_FIELD_CHILD_PID,
- LTT_FIELD_PID;
+ LTT_FIELD_PID,
+ LTT_FIELD_FILENAME;
LttvExecutionMode
LTTV_STATE_MODE_UNKNOWN,
return FALSE;
}
+
+static gboolean process_exec(void *hook_data, void *call_data)
+{
+ LttvTracefileState *s = (LttvTracefileState *)call_data;
+ LttvTraceState *ts = (LttvTraceState*)s->parent.t_context;
+ LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
+ LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
+ gchar *name;
+ guint cpu = ltt_tracefile_num(s->parent.tf);
+ LttvProcessState *process = ts->running_process[cpu];
+
+ /* PID of the process to release */
+ name = ltt_event_get_string(e, thf->f1);
+
+ process->name = g_quark_from_string(name);
+
+ return FALSE;
+}
+
+
+
+
gint lttv_state_hook_add_event_hooks(void *hook_data, void *call_data)
{
LttvTracesetState *tss = (LttvTracesetState*)(call_data);
/* Find the eventtype id for the following events and register the
associated by id hooks. */
- hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 10);
- hooks = g_array_set_size(hooks, 10);
+ hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 11);
+ hooks = g_array_set_size(hooks, 11);
ret = lttv_trace_find_hook(ts->parent.t,
LTT_FACILITY_KERNEL, LTT_EVENT_SYSCALL_ENTRY,
process_free, NULL, &g_array_index(hooks, LttvTraceHook, 9));
g_assert(!ret);
+ ret = lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_FS, LTT_EVENT_EXEC,
+ LTT_FIELD_FILENAME, 0, 0,
+ process_exec, NULL, &g_array_index(hooks, LttvTraceHook, 10));
+ g_assert(!ret);
+
+
/* Add these hooks to each event_by_id hooks list */
LTT_FACILITY_KERNEL = g_quark_from_string("kernel");
LTT_FACILITY_PROCESS = g_quark_from_string("process");
+ LTT_FACILITY_FS = g_quark_from_string("fs");
LTT_EVENT_SYSCALL_ENTRY = g_quark_from_string("syscall_entry");
LTT_EVENT_FORK = g_quark_from_string("fork");
LTT_EVENT_EXIT = g_quark_from_string("exit");
LTT_EVENT_FREE = g_quark_from_string("free");
+ LTT_EVENT_EXEC = g_quark_from_string("exec");
LTT_FIELD_SYSCALL_ID = g_quark_from_string("syscall_id");
LTT_FIELD_PARENT_PID = g_quark_from_string("parent_pid");
LTT_FIELD_CHILD_PID = g_quark_from_string("child_pid");
LTT_FIELD_PID = g_quark_from_string("pid");
+ LTT_FIELD_FILENAME = g_quark_from_string("filename");
}
extern GQuark
LTT_FACILITY_KERNEL,
- LTT_FACILITY_PROCESS;
+ LTT_FACILITY_PROCESS,
+ LTT_FACILITY_FS;
/* Events Quarks */
LTT_EVENT_SCHEDCHANGE,
LTT_EVENT_FORK,
LTT_EVENT_EXIT,
- LTT_EVENT_FREE;
+ LTT_EVENT_FREE,
+ LTT_EVENT_EXEC;
/* Fields Quarks */
LTT_FIELD_OUT_STATE,
LTT_FIELD_PARENT_PID,
LTT_FIELD_CHILD_PID,
- LTT_FIELD_PID;
+ LTT_FIELD_PID,
+ LTT_FIELD_NAME;
extern GQuark LTT_EVENT_SYSCALL_ENTRY;
fac_id = g_array_index(facilities, guint, i);
f = ltt_trace_get_facility_by_num(t, fac_id);
- et = ltt_facility_eventtype_get_by_name(f, ltt_eventtype_name(et));
+ et = ltt_facility_eventtype_get_by_name(f, event);
if(unlikely(et == NULL)) goto event_error;
thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id);
type_error:
goto free;
event_error:
- g_error("Event type %s does not exist",
- g_quark_to_string(ltt_eventtype_name(et)));
+ g_error("Event type does not exist for event %s",
+ g_quark_to_string(event));
goto free;
facility_error:
g_error("No %s facility", g_quark_to_string(facility));
associated by id hooks. */
hooks = g_array_new(FALSE, FALSE, sizeof(LttvTraceHook));
- hooks = g_array_set_size(hooks, 12);
+ hooks = g_array_set_size(hooks, 13);
/* before hooks */
&g_array_index(hooks, LttvTraceHook, 11));
g_assert(!ret);
+ ret = lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_FS, LTT_EVENT_EXEC,
+ 0, 0, 0,
+ after_fs_exec_hook,
+ events_request,
+ &g_array_index(hooks, LttvTraceHook, 12));
+ g_assert(!ret);
+
#if 0
}
/* add after */
- for(k = 9 ; k < 12 ; k++) {
+ for(k = 9 ; k < 13 ; k++) {
hook = &g_array_index(hooks, LttvTraceHook, k);
for(l=0;l<hook->fac_list->len;l++) {
thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
if(hashed_process_data == NULL)
{
g_assert(pid_out == 0 || pid_out != process->ppid);
- const gchar *name = g_quark_to_string(process->name);
/* Process not present */
ProcessInfo *process_info;
Drawing_t *drawing = control_flow_data->drawing;
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
if(hashed_process_data == NULL)
{
g_assert(pid_in == 0 || pid_in != process->ppid);
- const gchar *name = g_quark_to_string(process->name);
/* Process not present */
ProcessInfo *process_info;
Drawing_t *drawing = control_flow_data->drawing;
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
if(hashed_process_data_in == NULL)
{
g_assert(pid_in == 0 || pid_in != process_in->ppid);
- const gchar *name = g_quark_to_string(process_in->name);
ProcessInfo *process_info;
Drawing_t *drawing = control_flow_data->drawing;
/* Process not present */
process_in->ppid,
&birth,
tfc->t_context->index,
- name,
+ process_in->name,
&pl_height,
&process_info,
&hashed_process_data_in);
ProcessInfo *process_info;
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process->name);
processlist_add(process_list,
drawing,
pid,
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
g_assert(pid == 0 || pid != process->ppid);
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process->name);
ProcessInfo *process_info;
processlist_add(process_list,
drawing,
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
g_assert(pid == 0 || pid != process->ppid);
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process->name);
ProcessInfo *process_info;
processlist_add(process_list,
drawing,
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
g_assert(pid == 0 || pid != process->ppid);
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process->name);
ProcessInfo *process_info;
processlist_add(process_list,
drawing,
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
g_assert(child_pid == 0 || child_pid != process_child->ppid);
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process_child->name);
ProcessInfo *process_info;
processlist_add(process_list,
drawing,
process_child->ppid,
&birth,
tfc->t_context->index,
- name,
+ process_child->name,
&pl_height,
&process_info,
&hashed_process_data_child);
g_assert(pid == 0 || pid != process->ppid);
/* Process not present */
Drawing_t *drawing = control_flow_data->drawing;
- const gchar *name = g_quark_to_string(process->name);
ProcessInfo *process_info;
processlist_add(process_list,
drawing,
process->ppid,
&birth,
tfc->t_context->index,
- name,
+ process->name,
&pl_height,
&process_info,
&hashed_process_data);
}
#endif //0
+/* Get the filename of the process to print */
+int after_fs_exec_hook(void *hook_data, void *call_data)
+{
+ LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ ControlFlowData *control_flow_data = events_request->viewer_data;
+
+ LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
+
+ LttvTracefileState *tfs = (LttvTracefileState *)call_data;
+
+ LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
+
+ guint cpu = ltt_tracefile_num(tfc->tf);
+ LttvProcessState *process = ts->running_process[cpu];
+ g_assert(process != NULL);
+
+ guint pid = process->pid;
+
+ /* Well, the process_out existed : we must get it in the process hash
+ * or add it, and draw its items.
+ */
+ /* Add process to process list (if not present) */
+ guint pl_height = 0;
+ HashedProcessData *hashed_process_data = NULL;
+ ProcessList *process_list = control_flow_data->process_list;
+ LttTime birth = process->creation_time;
+
+ if(likely(process_list->current_hash_data[cpu] != NULL)) {
+ hashed_process_data = process_list->current_hash_data[cpu];
+ } else {
+ hashed_process_data = processlist_get_process_data(process_list,
+ pid,
+ process->cpu,
+ &birth,
+ tfc->t_context->index);
+ if(unlikely(hashed_process_data == NULL))
+ {
+ g_assert(pid == 0 || pid != process->ppid);
+ ProcessInfo *process_info;
+ /* Process not present */
+ Drawing_t *drawing = control_flow_data->drawing;
+ processlist_add(process_list,
+ drawing,
+ pid,
+ process->cpu,
+ process->ppid,
+ &birth,
+ tfc->t_context->index,
+ process->name,
+ &pl_height,
+ &process_info,
+ &hashed_process_data);
+ gtk_widget_set_size_request(drawing->drawing_area,
+ -1,
+ pl_height);
+ gtk_widget_queue_draw(drawing->drawing_area);
+ }
+ /* Set the current process */
+ process_list->current_hash_data[process->cpu] =
+ hashed_process_data;
+ }
+
+ processlist_set_name(process_list, process->name, hashed_process_data);
+
+ return 0;
+
+}
+
+
+
+
gint update_time_window_hook(void *hook_data, void *call_data)
{
ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
int before_process_release_hook(void *hook_data, void *call_data);
int after_process_exit_hook(void *hook_data, void *call_data);
int after_process_fork_hook(void *hook_data, void *call_data);
+int after_fs_exec_hook(void *hook_data, void *call_data);
#if 0
g_free(data);
}
+
+void processlist_set_name(ProcessList *process_list,
+ GQuark name,
+ HashedProcessData *hashed_process_data)
+{
+ gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
+ PROCESS_COLUMN, g_quark_to_string(name),
+ -1);
+}
+
int processlist_add( ProcessList *process_list,
Drawing_t *drawing,
guint pid,
guint ppid,
LttTime *birth,
guint trace_num,
- const gchar *name,
+ GQuark name,
guint *height,
ProcessInfo **pm_process_info,
HashedProcessData **pm_hashed_process_data)
&hashed_process_data->y_iter);
gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
- PROCESS_COLUMN, name,
+ PROCESS_COLUMN, g_quark_to_string(name),
PID_COLUMN, pid,
PPID_COLUMN, ppid,
CPU_COLUMN, cpu,
/* CPU num is only used for PID 0 */
int processlist_add(ProcessList *process_list, Drawing_t * drawing,
guint pid, guint cpu, guint ppid,
- LttTime *birth, guint trace_num, const gchar *name, guint *height,
+ LttTime *birth, guint trace_num, GQuark name, guint *height,
ProcessInfo **process_info,
HashedProcessData **hashed_process_data);
// out : success (0) and height
int processlist_remove(ProcessList *process_list, guint pid, guint cpu,
LttTime *birth, guint trace_num);
+/* Set the name of a process */
+void processlist_set_name(ProcessList *process_list,
+ GQuark name,
+ HashedProcessData *hashed_process_data);
+
/* Synchronize the list at the left and the drawing */
void update_index_to_pixmap(ProcessList *process_list);
lttv_process_traceset_middle(tsc,
events_request->start_time,
G_MAXUINT, NULL);
- // g_assert(seek_count < 50000);
+#ifdef DEBUG
+ g_assert(seek_count < LTTV_STATE_SAVE_INTERVAL);
+#endif //DEBUG
} else {