<div dir="ltr">Hey all,<br><br>I'm following up on some work from this old thread for monitoring CPU time: <a href="https://www.dragonflybsd.org/mailarchive/users/2010-04/msg00056.html">https://www.dragonflybsd.org/mailarchive/users/2010-04/msg00056.html</a><br><br>The code I have is essentially the one shown in the link, but I'm attempting to find the actual number of seconds spent in each state. I'm doing this by dividing each value by clockrate.stathz, e.g.:<br><br><br><font face="monospace">user += cp_t[cpu].cp_user / clockrate.stathz;</font><br><br><br>Relevant code is here: <a href="https://github.com/stuartnelson3/node_exporter/blob/2b5a581942ac31b501438d402274100df1f7d3d6/collector/cpu_dragonfly.go#L50-L98">https://github.com/stuartnelson3/node_exporter/blob/2b5a581942ac31b501438d402274100df1f7d3d6/collector/cpu_dragonfly.go#L50-L98</a><div><br><div>My question is about the units on struct members in kinfo_cputime (the source of <font face="monospace">cp_user</font> et al.). The values I'm getting out seem to be growing at a rate that indicates I'm not looking at seconds, but something smaller.<div></div><div><br></div><div>I'm looking at the rate of change of cpu time on my personal machine running dragonfly vs. a machine running linux. The implementation is the same: get user time, divide by 100Hz to get the value in seconds, and find the rate of change between two collections in fixed time window. The dragonfly rate of change seems to be larger by about 2 orders of magnitude, which is why I'm asking about the units.</div><div><br></div><div>For reference, the dragonfly node I'm looking at is reporting ~200 increase per second in cpu time for user and sys with loadavg ~0.1%, whereas the linux node is reporting values <10 with loadavg ~15%. <br><br>I'm improving dragonfly support for the node_exporter for Prometheus, a metrics and monitoring solution that is used mostly in the linux community. I'm assuming the linux implementation for finding cpu time in seconds is correct, and it's also the implementation used for finding cpu seconds for freebsd. It just struck me as unlikely that my old dell running dragonfly would have a rate of change at a fraction of the load that was so drastically different.</div><div><br></div><div>If there is anything I can clarify don't hesitate to write back!</div><div><br></div><div>Thanks,</div><div>Stuart<br><div><pre style="line-height:normal"><span style="font-family:sans-serif"><br></span></pre></div></div></div></div></div>