This version's first appearance coincides with a patch which makes schedstat a config options for the kernel. It should go without saying that if you choose to turn off that config option, /proc/schedstat never even appears. Also, some fields will be zero unless other config options have been utilized. These are noted below.
If you have scripts for version 2, note that the only difference with version 3 is that a new field was inserted before field 7. (Yes, inserted, not appended.) Porting, then, for scripts or programs reading this, will consist of mapping every reference of (old) fields 7-20 to (new) fields 8-21, and of course any handling of the new meaning for field 7.
The new field was inserted rather than appended only because schedstat is not widely in use yet so the number of tools affected should be small, and this allowed all the schedule() statistics to be kept together organizationally.
Format for version 3 of schedstat:
tag 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21tag is cpuN or totals.
NOTE: | In the sched_yield() statistics, the active queue is considered empty if it has only one process in it, since obviously the process calling sched_yield() is that process. |
First four are sched_yield() statistics:
Next four are schedule() statistics:
Next seven are statistics dealing with load_balance() (requires CONFIG_SMP):
Next four are statistics dealing with pull_task() (requires CONFIG_SMP):
Last two are statistics dealing with balance_node() (requires CONFIG_SMP and CONFIG_NUMA):