Patent ID: 8117614
Filing Date: 2012-02-14
Classification: G06F

Abstract:
1. A method for executing an EXTRACT CPU TIME machine instruction in a computer system that includes a set of 16 instruction accessible registers and a CPU timer, the method comprising: switching to a non-privileged state for executing non-privileged instructions; obtaining for execution the EXTRACT CPU TIME machine instruction defined for an architecture, the EXTRACT CPU TIME instruction comprising an opcode field identifying the instruction, a first base field (B executing the obtained EXTRACT CPU TIME machine instruction atomically in the 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, wherein total CPU time used thus far by the task can be determined by adding the result stored in the fourth register to the previously used amount of total CPU time stored in the fifth register.