1. A method comprising: executing a predefined code segment of an application, the executing on a processor and including executing an instrumented thread included in the predefined code segment; performing at least a first action associated with executing the instrumented thread in the predefined code segment, the performing the at least first action responsive to enabling a performance counter and registering the instrumented thread with a performance counter library; starting the performance counter associated with the predefined code segment, the starting responsive to executing the instrumented thread; pausing the execution of the predefined code segment; pausing the performance counter responsive to pausing the executing of the predefined code segment; performing at least a second action associated with pausing the executing of the predefined code segment, the performing the at least second action responsive to enabling the performance counter and registering the instrumented thread; resuming the executing of the predefined code segment; resuming the performance counter responsive to resuming the executing of the predefined code segment; and performing at least a third action associated with resuming the executing of the predefined code segment, the performing the at least third action responsive to enabling the performance counter and registering the instrumented thread.