US11892936B2ActiveUtilityA1

Profiling a program based on a combination of dynamic instrumentation and sampling

46
Assignee: MICROSOFT TECHNOLOGY LICENSING LLCPriority: Apr 11, 2022Filed: Apr 11, 2022Granted: Feb 6, 2024
Est. expiryApr 11, 2042(~15.8 yrs left)· nominal 20-yr term from priority
G06F 11/3612G06F 8/41G06F 11/3644G06F 11/3636G06F 2201/865G06F 11/3476
46
PatentIndex Score
0
Cited by
21
References
17
Claims

Abstract

A computer system is configured to profile a program during an execution of the program. Profiling the program includes obtaining, by a first profiler, a first set of information associated with the execution of the program, and obtaining a second set of information associated with one or more executions of the function. The second set of information includes at least a call count or an execution time of each of the one or more executions of the function. The computer system then identifies a subset of the first set of information that is associated with the one or more executions of the function, and creates aggregate information based on the subset of the first set of information and the second set of information. The aggregated information is then reported.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A computer system comprising:
 one or more processors; and 
 one or more computer-readable hardware storage devices having stored thereon computer-executable instructions that are structured such that, when the computer-executable instructions are executed by the one or more processors, the computer system is configured to:
 during an execution of a program, profile the program by at least:
 obtaining, by a first profiler, a first set of information associated with the execution of the program; and 
 obtaining, by a second profiler, a second set of information associated with one or more executions of a function in the program, the second set of information comprising at least a call count or an execution time of each of the one or more executions of the function; 
 
 identify a subset of the first set of information that is associated with the one or more executions of the function; 
 create aggregate information based on (1) the subset of the first set of information, and (2) the second set of information associated with the one or more executions of the function, including detecting an anomaly based on correlating the first set of information and the second set of information associated with the execution of the function, the anomaly being detected when a number of samples collected during the one or more executions of the function are greater than a first threshold, and a total call count of the function is lower than a second threshold; and 
 report the aggregate information. 
 
 
     
     
       2. The computer system of  claim 1 , wherein the second profiler is configured to dynamically instrument the function, dynamically instrumenting the function including inserting code instructions into the program which:
 during runtime of the program, initialize a counter for the function; 
 each time the function is called, increment the counter by one; and 
 in response to completion of the execution of the program, record a number counted by the counter as the call count of the function. 
 
     
     
       3. The computer system of  claim 2 , wherein dynamically instrumenting the function further includes inserting code instructions into the program which:
 each time the function is called, initialize a timer; and 
 in response to completion of an execution of the function, record an execution time of the function. 
 
     
     
       4. The computer system of  claim 3 , wherein creating aggregate information further includes computing an average execution time of the function based on each execution time of the function. 
     
     
       5. The computer system of  claim 2 , wherein dynamically instrumenting the function includes inserting code instructions into the program which:
 allocate a portion of memory to record the second set of information associated with execution of the function. 
 
     
     
       6. The computer system of  claim 2 , wherein dynamically instrumenting the function includes inserting code instructions into the program which:
 allocate a portion of memory having a particular address to store an integer value that is initially set as zero; and 
 each time the function is called, increment the integer value stored at the particular address by one. 
 
     
     
       7. The computer system of  claim 1 , wherein the computer system is further configured to identify a subset of functions in the program that are each to be dynamically instrumented. 
     
     
       8. The computer system of  claim 1 , wherein the computer system is further configured to flag the function or generate an alert in response to detecting the anomaly. 
     
     
       9. The computer system of  claim 1 , wherein dynamically instrumenting a function in the program comprises (1) inserting code instructions into bytecode of the program prior to compiling the bytecode to native code, or (2) inserting code instructions into native code of the program. 
     
     
       10. The computer system of  claim 1 , wherein the first profiler is a memory allocation profiler, and the first set of information is an associated memory allocation of the program or the function. 
     
     
       11. A method implemented at a computer system for profiling a program based on a combination of multiple profilers, the method comprising:
 during an execution of a program,
 obtaining, by a first profiler, a first set of information associated with the execution of the program; and 
 obtaining, by a second profiler, a second set of information associated with one or more executions of a function in the program, the second set of information comprising at least a call count or an execution time of each of the one or more executions of the function; 
 
 identify a subset of the first set of information that is associated with the one or more executions of the function; 
 create aggregate information based on (1) the subset of the first set of information, and (2) the second set of information associated with the one or more executions of the function, including detecting an anomaly based on correlating the first set of information and the second set of information associated with the execution of the function, the anomaly being detected when a number of samples collected during the one or more executions of the function are greater than a first threshold, and a total call count of the function is lower than a second threshold; and 
 report the aggregate information. 
 
     
     
       12. The method of  claim 11 , wherein dynamically instrumenting the function includes inserting code instructions into the program which:
 during runtime of the program, initialize a counter for the function; 
 each time the function is called, increment the counter by one; and 
 in response to completion of the execution of the program, record a number counted by the counter as the call count of the function. 
 
     
     
       13. The method of  claim 11 , wherein dynamically instrumenting the function further includes inserting code instructions into the program which:
 each time the function is called, initialize a timer; and 
 in response to completion of an execution of the function, record an execution time of the function. 
 
     
     
       14. The method of  claim 13 , wherein creating aggregate information further includes computing an average execution time of the function based on each execution time of the function. 
     
     
       15. The method of  claim 11 , wherein dynamically instrumenting the function includes inserting code instructions into the program which:
 allocate a portion of memory to record the second set of information associated with execution of the function. 
 
     
     
       16. The method of  claim 11 , wherein dynamically instrumenting the function includes inserting code instructions into the program which:
 allocate a portion of memory having a particular address to store an integer value that is initially set as zero; and 
 each time the function is called, increment the integer value stored at the particular address by one. 
 
     
     
       17. A computer program product comprising one or more hardware storage devices having stored thereon computer-executable instructions that are structured such that, when the computer-executable instructions are executed by one or more processors of a computer system, the computer system is configured to:
 during an execution of a program, profile the program by at least:
 obtaining, by a first profiler, a first set of information associated with the execution of the program; and 
 obtaining, by a second profiler, a second set of information associated with one or more executions of a function in the program, the second set of information comprising at least a call count or an execution time of each of the one or more executions of the function; 
 
 identify a subset of the first set of information that is associated with the one or more executions of the function; 
 create aggregate information based on (1) the subset of the first set of information, and (2) the second set of information associated with the one or more executions of the function, including detecting an anomaly based on correlating the first set of information and the second set of information associated with the execution of the function, the anomaly being detected when a number of samples collected during the one or more executions of the function are greater than a first threshold, and a total call count of the function is lower than a second threshold; and 
 report the aggregate information.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.