Hardware enabled performance counters with support for operating system context switching
AssigneeInternational Business Machines Corporation
InventorsValentina Salapura, Robert W. Wisniewski
Life of this patent
Estimating the term…
Abstract
A device for supporting hardware enabled performance counters with support for context switching include a plurality of performance counters operable to collect information associated with one or more computer system related activities, a first register operable to store a memory address, a second register operable to store a mode indication, and a state machine operable to read the second register and cause the plurality of performance counters to copy the information to memory area indicated by the memory address based on the mode indication.
Claims20
A device for supporting hardware enabled performance counters with support for context switching, comprising:
- a plurality of performance counters operable to collect information associated with one or more computer system related activities;
- a first register associated with a performance counter unit that implements the performance counters, the first register operable to store a memory address;
- a second register operable to store a mode indication, the mode indication comprising at least whether to switch out contents of the performance counters, whether to switch in contents of the performance counter, or both, the operating system writing the mode indication to initiate a copy;
- and
- a hardware state machine operable to read the second register and cause the plurality of performance counters to copy the information to memory area indicated by the memory address written into the first register by an operating system, based on the mode indication,
- wherein the hardware state machine automatically saves and restores data associated with all of the performance counters implemented by the performance counter unit, while the operating system performs other tasks associated with the context switching.
A method for hardware enabled performance counters with support for context switching, comprising:
- writing a memory address into memory by an operating system;
- setting a context switch register by the operating system to indicate that information in a plurality of performance counters implemented in a performance counter unit should be copied to memory area specified by the memory address;
- copying, by hardware, information of the plurality of performance counters to the memory area based on the setting of the context switch register;
- and
- resetting the context switch register to indicate completion of the copying by the hardware,
- wherein the hardware automatically saves and restores data associated with all of the performance counters implemented by the performance counter unit, while the operating system performs other tasks associated with the context switching.
A non-transitory computer readable storage medium storing a program of instructions executable by a machine to perform a method for hardware enabled performance counters with support for context switching, the method comprising:
- writing a memory address into memory associated with a plurality of performance counters implemented in a performance counter unit, by an operating system;
- setting a context switch register by the operating system to indicate that information in the plurality of performance counters should be copied to memory area specified by the memory address;
- copying, by hardware, information of the plurality of performance counters to the memory area based on the setting of the context switch register;
- and
- resetting the context switch register to indicate completion of the copying by the hardware,
- wherein the hardware automatically saves and restores data associated with all of the performance counters implemented by the performance counter unit, while the operating system performs other tasks associated with the context switching.
Dependencies are inferred from the claim text.