[Info-vax] High resolution per-process CPU consumption statistics
Arne Vajhøj
arne at vajhoej.dk
Tue Mar 31 13:27:54 EDT 2020
On 3/31/2020 1:25 PM, Arne Vajhøj wrote:
> On 3/28/2020 6:46 PM, Mark Daniel wrote:
>> On 29/3/20 9:01 am, Mark Daniel wrote:
>>> The actual code keeps a history (array) of up-to 8 code-points (of
>>> which the following output snippet showd two in use). The actual
>>> routine is too complex to post here but here are examples of some of
>>> the numbers coming out.
>
>> Embedded in the WASD server.
>
>>> unsigned __int64 WatchRPCC
>>> (
>>> NETIO_STRUCT *ioptr,
>>> int index,
>>> char *module,
>>> int line
>>> )
>
> After reading this thread I decided to play around a little.
>
> What I ended up with was a bit different.
>
> * include clockstack.h in all relevant files
> * put FUNC_ENTER in start of functions
> * put FUNC_EXIT at end of functions (all ends!)
> * put DUMP_STATS where one want results
> * build with USE_CLOCKSTACK if timing wanted (without it no code gets
> added)
>
> Example:
> output:
> $ cxx clockstack.cpp
> $ cc/define="USE_CLOCKSTACK" test
> $ cxxlink test+clockstack
> $ run test
> Total time:
> f1: 100.0%
> main: 100.0%
> f2: 90.0%
> f3: 70.0%
> f4: 40.0%
> Used time:
> f4: 40.0%
> f3: 30.0%
> f2: 20.0%
> f1: 10.0%
> main: 0.0%
> Done
>
> Not anything special - just a .H file and about 100 lines of code.
Link in case anyone are interested:
https://www.vajhoej.dk/arne/opensource/clockstack/
Arne
More information about the Info-vax
mailing list