iSeries : API QUSRJOBI format JOBI1000

Aneak Dongre
Aneak Dongre used Ask the Experts™
on
I'm using QUSLJOB API to get the list of all jobs on the system. I'm then passing this job list to API QUSRJOBI format JOBI200 for getting various other information for each job. My problem is to have CPU% for each job. JOBI200 doesn't have any field that return CPU%. I know that the API JOB1000 gives the elapsed time CPU%, but couldn't find any example of it. If anyone can help me with the example of format JOB1000 then I will be grateful.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VP Technology / Senior Consultant
Commented:
Offset 96 is JOB1000 (Processing unit time used, if less than 2,147,483,647 milliseconds) is CPU time in milliseconds used in JOB1000 is the cumulative amount of CPU time an individual job has used.  To approximate CPU %, you would use this formula:

(CPU Time / Total job runtime) / number of processors in system (or virtual processors in LPAR).

So a job that consumed 10 (10,000ms) seconds of CPU time over 100 seconds of rumtime occupied one CPU for 10% of the time it was running.  If there are 10 CPUs, that means the job consumed 1% of total system CPU during that time.  If there were 4 CPUs, it would be 2.5%.
Aneak DongreAdministrator

Author

Commented:
Thank you Gary for your advise. I will implement this in my program.
Theo KouwenhovenApplication Consultant
Commented:
You also can use SQL for this:

SELECT JOB_NAME  from table(QSYS2.ACTIVE_JOB_INFO()) AS info
Aneak DongreAdministrator

Author

Commented:
Thank you Gary and Murphey for your advise on the problem.
I've also found that the offset 104 of JOBI1000 format gives the CPU in percent. I've implemented this in my program and it gives the correct results. Thank you all for your help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial