On 11/28/13, 5:48 PM, Namhyung Kim wrote:
Do we really need to look up the callchain to find out an idle thread?

   $ perf sched script | grep swapper | head
          swapper     0 [001] 4294177.326996: sched:sched_switch: 
prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Xorg 
next_pid=1094 next_prio=120
          swapper     0 [010] 4294177.327019: sched:sched_switch: 
prev_comm=swapper/10 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf 
next_pid=13902 next_prio=120
             perf 13901 [002] 4294177.327074: sched:sched_switch: prev_comm=perf 
prev_pid=13901 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 
next_prio=120
          swapper     0 [004] 4294177.327096: sched:sched_switch: 
prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=R ==> 
next_comm=synergys next_pid=1521 next_prio=120
          swapper     0 [000] 4294177.327102: sched:sched_switch: 
prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> 
next_comm=gnome-terminal next_pid=2392 next_prio=120
             Xorg  1094 [001] 4294177.327112: sched:sched_switch: prev_comm=Xorg 
prev_pid=1094 prev_prio=120 prev_state=S ==> next_comm=swapper/1 next_pid=0 
next_prio=120
          swapper     0 [007] 4294177.327122: sched:sched_switch: 
prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf 
next_pid=13902 next_prio=120
     migration/10    58 [010] 4294177.327124: sched:sched_switch: 
prev_comm=migration/10 prev_pid=58 prev_prio=0 prev_state=S ==> 
next_comm=swapper/10 next_pid=0 next_prio=120
         synergys  1521 [004] 4294177.327144: sched:sched_switch: 
prev_comm=synergys prev_pid=1521 prev_prio=120 prev_state=S ==> 
next_comm=swapper/4 next_pid=0 next_prio=120
   gnome-terminal  2392 [000] 4294177.327286: sched:sched_switch: 
prev_comm=gnome-terminal prev_pid=2392 prev_prio=120 prev_state=S ==> 
next_comm=swapper/0 next_pid=0 next_prio=120

It seems every idle/swapper thread for each cpu has a pid of 0.

The command was developed using context-switch events. Try the next patch and use:

perf record -e cs -c 1 -ag
perf sched timehist

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to