This post summarizes the progress in the eighth week of the coding period.
pcp-mpstat has been started.
Hastily copying from the man-pages
The mpstat command writes to standard output activities for each available processor, processor 0 being the first one.
mpstat basically provides cpu utilization information if no option specified. If provided
-P option we can specify all/online or which processors usage to show.
-I option can be used to report total or percpu interrupt usage.
-A options reports everything similar to
-P ALL -I ALL.
Reading the source of
mpstat, it should be noted that it uses:
/proc/stat- For total cpu and interrupt usage
/proc/interrupts- For Hard interrupts
/proc/softirqs- For Soft interrupts
The repository for
pcp-mpstat is here.
This repo will contain the basic
pcp-mpstat code till it gets merged into
The experience with
pcp-pidstat will definitely be useful for writing this one. Hope to make less mistakes.
Before starting with the basic
pcp-mpstat output we realised that the interrupts that are reported by
pcp-mpstat are platform dependant and dynamic. So we’d first need to identify what interrupts are available for a machine and then fetch values for those interrupts as pcp metrics.
pcp has an hierarchical naming system for the metrics. Getting child metrics is easy if we know the root/parent metric. And to get that
pmTraversePMNS is the function to be called. Just pass the parent metric name to this and it would simply return the list of the child metrics available. So in our case
kernel.percpu.interrupts was the parent metric.
pcp-mpstat, writing Tests
Once we got the list of metrics to be fetched, further part was easier as we have had experience of
pcp-pidstat. I quickly (at the price of many small mistakes which were found out later by Ryan) wrote the basic code which has
But yeah we are heading in the right direction and we even decided to add
pcp-mpstat to next release of
pcp on 1st of August.
Meanwhile I bought my first bike. Honda Hornet 160R to be specific. Had a great week.
That’s all folks.