From: Yannick Brosseau Date: Fri, 13 Jul 2012 15:47:59 +0000 (-0400) Subject: Store process name from sched_switch X-Git-Tag: v1.5-beta1~55 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d7f9f37b761f6ca589500782db34b02ea3a96626;p=lttv.git Store process name from sched_switch Signed-off-by: Yannick Brosseau --- diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c index 7e9ce546..ac178874 100644 --- a/lttv/lttv/state.c +++ b/lttv/lttv/state.c @@ -2782,6 +2782,8 @@ static gboolean schedchange(void *hook_data, void *call_data) guint pid_in, pid_out; gint64 state_out; + //TODO ybrosseau 2012-07-13: manage this 20 in a constact or dynamically + char next_comm[20]; LttTime timestamp; event = (LttvEvent *) call_data; if (strcmp(lttv_traceset_get_name_from_event(event), @@ -2795,6 +2797,9 @@ static gboolean schedchange(void *hook_data, void *call_data) pid_in = lttv_event_get_long_unsigned(event, "next_tid"); state_out = lttv_event_get_long(event, "prev_state"); + strncpy(next_comm, lttv_event_get_string(event, "next_comm"), 20); + next_comm[20-1] = '\0'; + timestamp = lttv_event_get_timestamp(event); if(likely(process != NULL)) { @@ -2852,6 +2857,7 @@ static gboolean schedchange(void *hook_data, void *call_data) process->cpu = cpu; // process->last_cpu_index = ltt_tracefile_num(((LttvTracefileContext*)s)->tf); process->state->change = timestamp; + process->name = g_quark_from_string(next_comm); /* update cpu status */ if(pid_in == 0)