[Info-vax] How to obtain percentage of a given CPU consumed by a process

johnwallace4 at yahoo.co.uk johnwallace4 at yahoo.co.uk
Mon Jun 6 07:23:49 EDT 2016


On Monday, 6 June 2016 08:46:37 UTC+1, lawren... at gmail.com  wrote:
> On Sunday, June 5, 2016 at 8:56:35 PM UTC+12, johnwa... at yahoo.co.uk wrote:
> > I can't remember whether the approach I'd use can be done just with
> > non-priv code...
> 
> It was non-privileged code, that much I can remember. :)
> 
> It had to do with the fact that CPU accumulation was done in a 100Hz interrupt routine that simply incremented a counter in the PCB of the current process. My code was running for just short of 10ms each time, before doing something that triggered a reschedule (might have been a $QIOW or a $HIBER, I can’t remember now). Only that “something” completed very quickly, putting my process back to being runnable again.
> 
> I think I was actually consuming about 75% of the CPU on that VAX-11/750, without it showing up.
> 
> I never tried the same trick again, so I have no idea if it would still work on later hardware or versions of VMS...

That's basically the trick I was thinking of.

Lots of OSes (not just VMS) calculate their performance/accounting
data based on periodic sampling of which processes are 'current'.
The current processes are then 'charged' for the whole interval.
Most of the time this approach is plenty good enough. However...

A process which somehow arranges to not be 'current' when the
sampling is done, but eats CPU the rest of the time, can give a
devloper, sysadmin, etc, a bit of a headache.

Not specific to VAX, not specific to VMS.

Don't tell anyone :)



More information about the Info-vax mailing list