[Info-vax] High resolution per-process CPU consumption statistics

Mark Daniel mark.daniel at wasd.vsm.com.au
Tue Mar 24 17:36:16 EDT 2020


On 25/3/20 6:51 am, VAXman- at SendSpamHere.ORG wrote:
> In article <m5reG.280253$YY1.29280 at fx08.iad>, Mark Daniel <mark.daniel at wasd.vsm.com.au> writes:
>> On 24/3/20 9:24 pm, johnwallace4 at yahoo.co.uk wrote:
>>> On Tuesday, 24 March 2020 00:02:22 UTC, Mark Daniel  wrote:
>>>> Would like to be able to measure process CPU consumed during specified
>>>> continuous sections of processing.  Only interested in CPU-intensive
>>>> sections so USER mode consumed relevant.  Imagine inserting calls at the
>>>> beginning and ending of those sections with a magic number representing
>>>> CPU consumption/delta/whatever made available.
>>>>
>>>> As some of these CPU-intensive code sections are short duration the
>>>> granularity needs to be quite fine.  The likes of JPI$_CPUTIM and
>>>> LIB$STAT_TIMER (10mS) seem unsuitable.
>>>>
>>>> Prepared for non- USER mode code.  This is only for ad hoc developmental
>>>> insight and not general use.  Needs to accommodate Alpha and/or Itanium
>>>> (and/or x86-64 :-)
>>>>
>>>> And, of course, any other suggestion.
>>>>
>>>> As always, TIA.
>>>
>>> Is it safe to assume that the code in question is single-threaded?
>>
>> Yes.
>>
>>> Is it safe to assume that the code in question is running on a
>>> single-processor system?
>>
>> Yes.
>>
>>> Is an Alpha-only solution better than nothing at all?
>>
>> Sure.
>>
>>> Have a look at RPCC (Read Process Cycle Counter) in the Alpha/VMS
>>> PALcode and see if it might help.
>>>
>>> See e.g. the Alpha Architecture Reference Manual documentation e.g.
>>> http://www.bitsavers.org/pdf/dec/alpha/Sites_AlphaArchitectureReferenceManual_1992.pdf
>>> (there's probably more useful RPCC-related stuff available too).
>>
>> Before posting here, a fair effort with an unnamed but common search
>> engine and my chosen query strings consistently returned references to
>> that document and section.
>>
>> My fevered imagination (but internals hacking very-much limited to
>> monkey-see-monkey-do) has something of the ilk:
>>
>>     unsigned __int64  start_count,
>>                       end_count;
>>
>>     void get_cpu_count (unsigned __int64 *here)
>>     {
>>        *here = EXE$GL_CURRENT_CPU_COUNT;
>>        return SS$_NORMAL;
>>     }
>>
>>     sys$cmkrnl (&get_cpu_count, &start_count);
>>     ...
>>     sys$cmkrnl (&get_cpu_count, &end_count);
>>
>> Some similar code would be used to obtain the RPCC.
> 
> SYS$RPCC_64.  No need to add jackets and or jump into inner mode.
> 
> No arguments.  It returns the RPCC value in R0, the function return.

Exactly the person who was inhabiting that fevered imagination.

And bless me, it's a documented system call:

> https://www.vmssoftware.com/docs/VSI_OpenVMS_BaseOS/VSI_SYSTEM_SERVICES_REF_VOLII_29-MAR-2019.pdf

Seems so obvious when pointed out.  Will have a play and report back.

Thanks Brian.



More information about the Info-vax mailing list