IP Library Granted Patent US 9,342,429
Granted Patent B1
US 9,342,429 · App. 14/711,917 · Granted May 17, 2016

Counting events using hardware performance counters and annotated instructions

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,342,429
App. No.
14/711,917
Granted
May 17, 2016
Kind
B1
Abstract

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for receiving a plurality of instructions, where the plurality of instructions comprise one or more first instructions from an application and one or more second instructions from a profiler that instruments the application with the one or more second instructions; identifying, for each of one or more instructions in the plurality of instructions, a respective prefix from one or more prefixes based on a category of the respective instruction; annotating each of the one or more instructions with the respective prefix; and for at least one of one or more hardware performance counters, configuring the respective hardware performance counter to count each instruction in the plurality of instructions that is annotated by one or more of the respective prefixes.

Claims (31)

1. A method performed by data processing apparatus, the method comprising:

receiving a plurality of instructions of an instrumented application, where the plurality of instructions comprise first instructions from an application and second instructions from a profiler that instruments the application with the second instructions to generate the instrumented application, the instrumented application being a functionally-equivalent version of the application;

identifying, for each of the instructions in the plurality of instructions, a respective prefix from prefixes based on a category of the respective instruction, wherein at least the second instructions have a respective prefix that is different from each of the respective prefixes of the first instructions, and wherein the respective prefixes of the first instructions include at least two or more prefixes that are different from each other, and each respective prefix of the first instructions has a corresponding hardware performance counter configured to count only first instructions annotated by the respective prefix to which the hardware performance counter corresponds;

annotating each of the instructions with the respective prefix for the instruction; and

counting, by each corresponding hardware performance counter, only first instructions in the plurality of instructions annotated by the respective prefix to which the corresponding hardware performance counter corresponds.

2. The method of claim 1 , where annotating each of the instructions comprises adding the respective prefix to each of the instructions.

3. The method of claim 1 , where each prefix comprises data defined by standard x86 instruction encoding.

4. The method of claim 1 , where the category indicates whether the respective instruction is from the application.

5. The method of claim 1 , where the prefixes comprise one or more of the following: a Repeat String Operation (REP) prefix, Repeat String if not zero (REPZ), or one or more segment prefixes.

6. The method of claim 5 , where the one or more segment prefixes comprises one or more of the following: a code segment (CS), a data segment (DS), a stack segment (SS), a general purpose segment (FS or GS), or an extra segment (ES).

7. The method of claim 1 , where each instruction has a variable-sized length.

8. The method of claim 1 , where each instruction conforms to an x86 architecture.

9. A system comprising:

a processor; and

computer-readable medium coupled to the processor and having instructions stored thereon, which, when executed by the processor, cause the processor to perform operations comprising:

receiving a plurality of instructions of an instrumented application, where the plurality of instructions comprise first instructions from an application and second instructions from a profiler that instruments the application with the second instructions to generate the instrumented application, the instrumented application being a functionally-equivalent version of the application;

identifying, for each of the instructions in the plurality of instructions, a respective prefix from prefixes based on a category of the respective instruction, wherein at least the second instructions have a respective prefix that is different from each of the respective prefixes of the first instructions, and wherein the respective prefixes of the first instructions include at least two or more prefixes that are different from each other, and each respective prefix of the first instructions has a corresponding hardware performance counter configured to count only first instructions annotated by the respective prefix to which the hardware performance counter corresponds;

annotating each of the instructions with the respective prefix for the instruction; and

counting, by each corresponding hardware performance counter, only first instructions in the plurality of instructions annotated by the respective prefix to which the corresponding hardware performance counter corresponds.

10. The system of claim 9 , where annotating each of the instructions comprises adding the respective prefix to each of the instructions.

11. The system of claim 9 , where each prefix comprises data defined by standard x86 instruction encoding.

12. The system of claim 9 , where the category indicates whether the respective instruction is from the application.

13. The system of claim 9 , where the prefixes comprise one or more of the following: a Repeat String Operation (REP) prefix, Repeat String if not zero (REPZ), or one or more segment prefixes.

14. The system of claim 13 , where the one or more segment prefixes comprises one or more of the following: a code segment (CS), a data segment (DS), a stack segment (SS), a general purpose segment (FS or GS), or an extra segment (ES).

15. The system of claim 9 , where each instruction has a variable-sized length.

16. The system of claim 9 , where each instruction conforms to an x86 architecture.

17. A non-transitory computer-readable medium having instructions stored thereon, which, when executed by a processor, cause the processor to perform operations comprising:

receiving a plurality of instructions of an instrumented application, where the plurality of instructions comprise first instructions from an application and second instructions from a profiler that instruments the application with the second instructions to generate the instrumented application, the instrumented application being a functionally-equivalent version of the application;

identifying, for each of the instructions in the plurality of instructions, a respective prefix from prefixes based on a category of the respective instruction, wherein at least the second instructions have a respective prefix that is different from each of the respective prefixes of the first instructions, and wherein the respective prefixes of the first instructions include at least two or more prefixes that are different from each other, and each respective prefix of the first instructions has a corresponding hardware performance counter configured to count only first instructions annotated by the respective prefix to which the hardware performance counter corresponds;

annotating each of the instructions with the respective prefix for the instruction; and

counting, by each corresponding hardware performance counter, only first instructions in the plurality of instructions annotated by the respective prefix to which the corresponding hardware performance counter corresponds.

Assignments (2)
CHANGE OF NAME Recorded Oct 2, 2017
From: GOOGLE INC.
To: GOOGLE LLC
Reel/Frame 044566/0657 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 15, 2015
From: SEREBRIN, BENJAMIN C.; HAZELWOOD, KIM
To: GOOGLE INC.
Reel/Frame 036096/0240 →