Store process name from sched_switch
authorYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 13 Jul 2012 15:47:59 +0000 (11:47 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 13 Jul 2012 15:47:59 +0000 (11:47 -0400)
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
lttv/lttv/state.c

index 7e9ce546eb2f636165af2c5805e76054debaf1ec..ac1788747ca6f5f7c8ba80a4f1fd75b69fa0b921 100644 (file)
@@ -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)
This page took 0.025632 seconds and 4 git commands to generate.