fix race on startup and support for cpu hotplug
[lttngtop.git] / src / cputop.c
index eb7afb3e76a799f758b3d2b99ad00dceccf162a7..3615085852ecad469a9cbde83c39911dbf781439 100644 (file)
@@ -33,7 +33,8 @@ void update_cputop_data(unsigned long timestamp, int64_t cpu, int prev_pid,
                elapsed = timestamp - tmpcpu->task_start;
                tmpcpu->current_task->totalcpunsec += elapsed;
                tmpcpu->current_task->threadstotalcpunsec += elapsed;
-               if (tmpcpu->current_task->pid != tmpcpu->current_task->tid)
+               if (tmpcpu->current_task->threadparent &&
+                               tmpcpu->current_task->pid != tmpcpu->current_task->tid)
                        tmpcpu->current_task->threadparent->threadstotalcpunsec += elapsed;
        }
 
This page took 0.050023 seconds and 4 git commands to generate.