Re: Measuring CPU time under USS in a C program

2005-07-20 Thread Gil Peleg
Hi Scott,
When you issue spawn() a new process is created.
 There is a C USS service named w_getpsent() you can use to get a lot of 
information about a process including the user CPU time of the process.
 Gil.

 On 7/19/05, Jackson, Scott [EMAIL PROTECTED] wrote: 
 
 All,
 
 (Cross posted to MVS-OE listserv)
 
 I'm looking for the most accurate method of tracking CPU usage in a
 specific task using C/C++ under z/OS UNIX System Services.
 
 Example:
 
 TASK A spawns TASK B. I want to measure the CPU usage for TASK B and all
 it's children. I'm currently using the times() function but according to
 the manual the results may not reflect usage correctly for z/OS USS.


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Measuring CPU time under USS in a C program

2005-07-19 Thread Jackson, Scott
All, 

(Cross posted to MVS-OE listserv)

I'm looking for the most accurate method of tracking CPU usage in a
specific task using C/C++ under z/OS UNIX System Services. 

Example:

TASK A spawns TASK B. I want to measure the CPU usage for TASK B and all
it's children. I'm currently using the times() function but according to
the manual the results may not reflect usage correctly for z/OS USS.

From the C/C++ reference:

clock_t tms_utime 
Amount of processor time used by instructions in the
calling process. 
Under z/OS UNIX services, this does not include
processor time spent running in the kernel. It does include any
processor time accumulated for the address space before it became an
z/OS UNIX services process. 
clock_t tms_stime 
Amount of processor time used by the system. 
Under z/OS UNIX services, this value represents kernel
busy time running on behalf of the calling process. It does not include
processor time performing other MVS system functions on behalf of the
process. 

In the spawned TASK B I'm doing something similar to:

main()
{

GetTimesStart(); // issue times() start data (parent and child)

DoAllProcessing; //spawn other threads, and process data. This is the
process that requires measuring.

GetTimesEnd(); // issue times() end data (parent and child)

PutReport(); // endTimes-startTimes=cpuTime;

}

Does anyone know any other techniques that I can use or is this the best
it gets? What about inspecting the TCB times? How valid is that for USS?

Thanks!

- 
Scott Wm. Jackson
Principle Software Engineer
Email:  [EMAIL PROTECTED]
Cell:  512.963.0364
Direct:  512.795.6940 FAX: 512.795.6999 
Informatica Corporation
Turning integration into insight. (TM)  
10459 Morado Circle
Building II, Suite 300
Austin, Texas  78621 
Main: 512.795-6900  |  www.informatica.com 
- 
Coming soon... PowerCenter For Z/OS


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html