> > if (Kernel + User > 100) { > User = 100 - Kernel; > } > Idle = 100 - Kernel - User; > > If you want to be smart, you might want to round small > numbers up, and large numbers down (e.g. perhaps any > non-zero amount should always show as at least 1%?)
I am working now to manual add something like above in my original cpurec062 version using cpu_stat. > > As to why they don't already add up, I had a quick > look at the kstat code, but didn't find the specifics. > However, it should be noted that one has to choose to update > kstats atomically, and if one does not, it's possible to > sample more than one set of values with one read. It's a > trade off between performance and accuracy. But, as I said, > I don't actually know what we do in this case. Could be that for really accurate numbers a C version should be used !? Another solution here: to have mpstat output its data using a timestamp, seconds since epoch, followed by all data separated by a ',' or ':' - this could help sysadmins to inject each sample into RRD (see my purpose here of writing cpurec) mpstat -option -> 1233154062:0:0:418:223:1550:209:0:0:10024:15:5:80 1233154063:0:0:380:178:318:19:0:0:1069:7:5:88 1233154064:0:0:460:260:308:15:0:0:548:8:2:90 1233154065:0:0:454:254:327:41:0:0:603:2:1:97 1233154066:0:0:770:570:572:50:0:0:677:1:0:99 stefan _______________________________________________ perf-discuss mailing list perf-discuss@opensolaris.org