Patent ID: 8516485

Claim:
A computer program product for executing an EXTRACT CPU TIME machine instruction in a computer system that includes a set of instruction accessible registers and a CPU timer, the computer program product comprising: a non-transitory computer readable storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method comprising: obtaining for execution the EXTRACT CPU TIME machine instruction defined for an architecture, the EXTRACT CPU TIME instruction comprising an opcode field for identifying the instruction, a first base field for identifying a first register, a first displacement field, a second base field for identifying a second register, a second displacement field, and a register field for identifying a third register; and executing, by an emulator executing on a processor of a different architecture than the architecture of the EXTRACT CPU TIME machine instruction, the obtained EXTRACT CPU TIME machine instruction atomically in a non-privileged state to obtain information relating to a task executing within the computing system, a portion of the information used to determine resource time usage of the task, the executing comprising: determining a current value of a CPU timer which decrements as the task executes, the current value of the CPU timer indicating an amount of time that remains in a specified amount of time allocated for execution of the task; adding content of the first register and a value of the first displacement field to form an address of a first operand in storage; based on the formed address of the first operand, fetching the first operand from storage, the first operand representing a value of the CPU timer at a defined time; subtracting the determined current value of the CPU timer from the fetched first operand to produce a first result, the first result indicating elapsed CPU time for the task for a given time period; storing the first result in a fourth register; adding content of the second register and a value of the second displacement field to form an address of a second operand; based on the formed address of the second operand, fetching the second operand from storage, the second operand used to provide a previously used amount of total CPU time for the task; storing the second operand in a fifth register; using contents of the third register fetching a third operand from storage, the third operand used to provide selected information relating to the task; and storing the fetched third operand in the third register.