Patent ID: 11880231
Assignee: MICROSOFT TECHNOLOGY LICENSING, LLC
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 5:
6. A computing device configured with a high-resolution timer, comprising:
at least one processor having a continuously running counter, an instruction cache, and a branch predictor, the processor having a working state and one or more sleep states; and
at least one non-transitory computer-readable storage media having computer-executable instructions stored thereon which, when executed by the least one processor, cause the computing device to perform successive calls to a time function that is instantiated on the computing device including an initial call followed by a subsequent call, wherein the time function retrieves a time value from a counter instantiated as a hardware register in the processor, the counter running continuously at an invariant rate;
in response to the initial call to the time function, cache instructions associated with the time function in the instruction cache;
attempt to optimize execution of the time function instructions by predicting an execution path of the time function instructions using the branch predictor;
in response to the prediction, execute instructions for the time function to initially return the current value of the counter to the time function; and
in response to the subsequent call to the time function, re-execute the time function instructions according to results of the prediction to subsequently return the current value of the counter to the time function, wherein the processor remains in the working state while re-executing the time function instructions.