1. A device for providing hardware support for multiplexing of performance counters, comprising: a plurality of performance counters operable to collect one or more counts of one or more selected activities; a plurality of registers operable to store a set of performance counter configurations; and a state machine operable to automatically select a register from the plurality of registers for reconfiguring the one or more performance counters in response to receiving a first signal, the state machine further operable to reconfigure the one or more performance counters based on a configuration specified in the selected register, the state machine further operable to copy data in selected one or more of the plurality of performance counters to a memory location, or from the memory locations to the counters, or both, in response to receiving a second signal, wherein the state machine is further operable to detect context switch of a thread, and in response cause the plurality of performance counters and state machine configuration parameters to be copied to the memory location, or to copy information from the memory location to the counters and state machine configuration registers, or both.