Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Process information from GET$JPI seems inconsistent

 
SOLVED
Go to solution
Nick Varley
Occasional Advisor

Process information from GET$JPI seems inconsistent

We build and sell software that retrieves performance data from many operating systems (Windows UNIX Linux z/OS), including VMS systems. We are *not* VMS experts by a long shot, but we have built some software that retrieves useful information from VMS systems. We are however somewhat confused by the results of program that issues repeated GET$JPI calls to obtain details of running processes. We see a couple of odd things.

1. The same process apparently using less CPU in consecutive intervals, e.g. at 10:00 CPU=6957 at 10:15 CPU=4173, at 10:30 CPU=7132. We thought the CPU used values would be "gas meters", i.e. they only get bigger until the process ends. Calculating the CPU time used during an interval by a process results in negative values - and that can't be right.

2. Process IDs are duplicated - that seems odd too. I would have thought that every process in a given system would have a unique PID. We see that a process also has a start date/time and have used that provide a unique key, but even so, processes that we know are running don't appear to be present in every interval in the data we get back from GET$JPI.

Any ideas or pointers as to what is going on would be gratefully received.
15 REPLIES 15
Heinz W Genhart
Honored Contributor

Re: Process information from GET$JPI seems inconsistent

Hi Nick

first of all, welcome to the HP OpenVMS Forum.

Your problem sounds very strange.

PID's are absolutely unique within same cluster.

Also the problem you have with getjpi sounds impossible for me.

Could you supply some example code? Until now I can only assume a coding problem.

Regards

Geni
Nick Varley
Occasional Advisor

Re: Process information from GET$JPI seems inconsistent

Thanks for the reply. I've attached some of the code.
Nick Varley
Occasional Advisor

Re: Process information from GET$JPI seems inconsistent

...and also some output from the routine, for process ISEE$MAD. 3 different processes, all with different start dates and times, all with the same PID.
Highlighted
Volker Halle
Honored Contributor

Re: Process information from GET$JPI seems inconsistent

Nick,

welcome to the OpenVMS ITRC forum.

1. the used CPU time in a process is stored in the process header (PHD$L_CPUTIM) in 10 ms units and can only increment during the life of a process. You can look at the data in memory with:

$ ANAL/SYS
SDA> READ SYSDEF
SDA> SET PROC/IND=
SDA> EXA PHD+PHD$L_CPUTIM
SDA> EXIT

2. Process IDs are guaranteed to be unique within a system and even within a cluster. The fact that you don't get all the process data in each interval, may be caused by issues with the state of the process being queried, as some of the GETJPI calls may need to run in the context of that process and the state of that process may prevent such code to be executed immediately.

Volker.
Heinz W Genhart
Honored Contributor

Re: Process information from GET$JPI seems inconsistent

Hi Nick

for me it seems that this is basic code.
I dont have a basic compiler and I did not use basic the last 25 years.

That means that I can't help you.
But you can search some example code on google. Do a search for + openvms +basic + lib$getjpi and you will find a solution for your problem

Sorry for no better help
Regards

Geni
Nick Varley
Occasional Advisor

Re: Process information from GET$JPI seems inconsistent

Thanks for the ideas so far. It has always been my thought that we're not doing it right, I'm just not sure where to go to find a better way. I have spent quite of lot of time already with my best friend Dr. Google...
Jur van der Burg
Respected Contributor

Re: Process information from GET$JPI seems inconsistent

Your program is buggy. You use sys$getjpi instead of sys$getjpiW which causes your program to continue while getjpi is still working on the data. And you specify an IOSB without bothering to check it....

So, use sys$getjpiw and check the both the return status AND the status in the iosb.

Jur.
Volker Halle
Honored Contributor

Re: Process information from GET$JPI seems inconsistent

Nick,

did you check, wheter a real process exists in the monitored system with a PID of 00153AB8 ? I bet this is some P0 space address in your program and not a real PID ! Just use $ SHOW SYSTEM, it will show you a list of the processes including their PID in column 1.

And note that the 3 different ISEE$MAD processes have only increasing values in their CPUTIM fields...

Volker.

H_Bachner
Regular Advisor

Re: Process information from GET$JPI seems inconsistent

Nick,

without digging deeper into the code (and installing a BASIC compiler) a few things come to mind when looking at your code:

- where do you construct the item list passed to $GETJPI?
- IOSB seems to be undefined/uninitialized
- you are using the asynchronous version of $GETJPI, but don't synchronize with an event flag and/or check the IOSB. You'd better use $GETJPIW in this case (unless you want to issue multiple calls in parallel - in which case I'm not sure how scanning the process list would work out).

This should give you a start to improve the code you posted. If more problems show up, get back here.

Good luck & regards,
Hans.