I'm using z/OS to test a program that will eventually run on Linux. The purpose
of the program is to return the total CPU time (in seconds with micro-second
precision) consumed by the current process, so far.
If I were coding this in HLASM it would be:
timeused storadr=cpu_time_binary_w, get cpu time x
linkage=SYSTEM, in microseconds x
cpu=MIC (SSSSS.thmiju)
I'm coding this in COBOL, for reasons, using the cool fact that you can make
calls to the C library. If I make a call to getrusage() then I get back some
time, but it is much less than the actual time. For example, if I run it at the
end of a step that uses about 11.5 CPU seconds, I get:
Assembler CPU seconds: 11.513959
Linux CPU seconds: .019033
I see of our site's job resource usage displays that it appears that when I do
the getrusage() call, it is running in the OMVS side. So I think the
getrusage() is only reporting the CPU time used by that side, not anything
going on in MVS.
But if I make a call to times(), which returns a tms structure:
05 tms_w.
10 tms_utime pic s9(9) comp-5. *> user
10 tms_stime pic s9(9) comp-5. *> system
10 tms_cutime pic s9(9) comp-5. *> child user
10 tms_cstime pic s9(9) comp-5. *> child system
I always get zeros.
I get zeros even if I make a call to getrusage(), then the times() call, then
getrusage(), and then times():
getrusage cpu seconds: .001980
User ticks = 0000000000
System = 0000000000
User ticks = 0000000000
System = 0000000000
getrusage cpu seconds: .002111
User ticks = 0000000000
System = 0000000000
User ticks = 0000000000
System = 0000000000
The fact the getrusage result is increasing implies that the OMVS process was
still running, and it is the. So I'd think the second times() call would return
SOMETHING.
This is on z/OS 2.5. times() is documented at
https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-times-get-process-child-process-times
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN