# US 10,956,133 B2 · Static optimization of production code for dynamic profiling

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,956,133 B2
- Document ID: US10956133B2
- Status: Granted
- Kind: B2
- Application number: 16/203,330
- Filed: 2018-11-28
- Published: 2020-05-28
- Granted: 2021-03-23
- Earliest claimed: 2018-11-28
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Geza Geleji; Martin A. Ross; Craig Stirling; Christopher J. Poole; Fiona M. Crowther
- Web page: https://patentgrep.com/patent/US10956133B2

## CPC

- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F 8/35: model driven
- G06F 8/36: Software reuse
- G06F 8/443: {Optimisation}
- G06F 8/60: Software deployment
- G06F 9/44505: {Configuring for program initiating, e.g. using registry, configuration files}
- G06F 11/302: {where the computing system component is a software system}
- G06F 11/3409: {for performance assessment}
- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3096: {wherein the means or processing minimize the use of computing system or of computing system component resources, e.g. non-intrusive monitoring which minimizes the probe effect: sniffing, intercepting, indirectly deriving the monitored data from other directly available data}
- G06F 2201/865: Monitoring of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, computer program products, and systems are presented. The methods include, for instance: obtaining a native code having a large number of counters embedded for profiling. Use cases that is serviced by the native code is identified and respective use case profiles representing performance characteristics of a corresponding use case are created. Best predictors identifying one of the use case profiles are determined and variants for a production code is created with only the best predictors instead of the large number of counters. The variants are produced with the use case profiles to to a production environment for performing the use cases.

## Claims

### Claim 1

A computer implemented method comprising:
obtaining, by one or more processor, a native code having a plurality of counters embedded at respective profiling locations in the native code, wherein a number of the counters is a first positive integer N;
selecting, by the one or more processor, a plurality of use cases to be serviced by the obtained native code, wherein each of the use cases is a list of computational actions to be performed toward an end result of each use case, and wherein a number of the use cases is a second positive integer K;
creating, by the one or more processor, K number of use cases profiles respectively corresponding to each use case amongst the selected K number of use cases, wherein each use case profile includes performance characteristics corresponding to respective use cases;
determining, by the one or more processor, a minimal number of counters, referred to as best predictors, amongst the N number of counters embedded in the native code that identifies one of the K number of use case profiles from the creating, wherein the minimal number is a third positive integer B equal to a number of the best predictors;
generating, by the one or more processor, variants respective to the use cases based on the determined best predictors, wherein each of the variants is a unique machine code customized for system requirements respectively corresponding to the use cases; and
producing, by the one or more processor, the generated variants and corresponding use case profiles to one or more production environment to provide respective end results of the use cases for end users by performing the use cases.

### Claim 2 (depends on 1)

The computer implemented method of claim 1, the creating comprising:
running a use case of the use cases for a preconfigured number of times while cumulating values of the counters to thereby represent performance characteristics of the use case; and
recording the cumulated values of the counters representing the performance characteristics of the use case as a use case profile for the use case.

### Claim 3 (depends on 2)

The computer implemented method of claim 2, further comprising:
mapping the use case profile to a point in a N-dimensional space;
analyzing respective dependencies of the counters embedded in the native code on the use case; and
mapping the counters to respective points in the N-dimensional space according to the analyzed respective dependencies on the use case.

### Claim 4 (depends on 2)

The computer implemented method of claim 2, the determining comprising:
identifying K number of points respectively corresponding the K number of use case profiles in the N-dimensional space; and
ascertaining the B number of best predictors that distinguishes one use case profile from another by space partitioning of the N-dimensional space from the identifying the K number of points.

### Claim 5 (depends on 4)

The computer implemented method of claim 4; wherein the space partitioning of the N-dimensional space is by use of Voronoi cells with the K number of points corresponding to the respective use case profiles as respective seeds.

### Claim 6 (depends on 1)

The computer implemented method of claim 1, the generating comprising:
removing, from the native code, counters that are not included in the best predictors from the determining;
compiling the code resulting from the removing into an executable code having the best predictors; and
replicating the executable code K number of times for respective use cases.

### Claim 7 (depends on 1)

The computer implemented method of claim 1, further comprising:
profiling the variants dynamically in the production environment by use of the use case profiles respectively corresponding to each variant, based on values counted from the best predictors embedded in the variants.

### Claim 8

A computer program product comprising:
a computer readable storage medium readable by one or more processor and storing instructions for execution by the one or more processor for performing a method comprising:
obtaining a native code having a plurality of counters embedded at respective profiling locations in the native code, a number of the counters being referred to as a first positive integer N;
selecting a plurality of use cases to be serviced by the obtained native code, each of the plurality of the use cases is a list of computational actions to be performed toward an end result respectively corresponding to the use cases, and wherein a number of the use cases is a second positive integer K;
creating K number of use cases profiles respectively corresponding to each use case amongst the selected K number of use cases, wherein each use case profile includes performance characteristics corresponding to respective use cases;
determining a minimal number of counters, referred to as best predictors, amongst the N number of counters embedded in the native code that identify one of the K number of use case profiles from the creating, wherein the minimal number is a third positive integer B equal to a number of the best predictors;
generating variants respective to the use cases based on the determined best predictors, wherein each of the variants is a unique machine code customized for system requirements respectively corresponding to the use cases; and
producing the generated variants and corresponding use case profiles to one or more production environment to provide respective end results of the use cases for end users by performing the use cases.

### Claim 9 (depends on 8)

The computer program product of claim 8, the creating comprising:
running a use case of the use cases for a preconfigured number of times while cumulating values of the counters to thereby represent performance characteristics of the use case; and
recording the cumulated values of the counters representing the performance characteristics of the use case as a use case profile for the use case.

### Claim 10 (depends on 9)

The computer program product of claim 9, further comprising:
mapping the use case profile to a point in a N-dimensional space;
analyzing respective dependencies of the counters embedded in the native code on the use case; and
mapping the counters to respective points in the N-dimensional space according to the analyzed respective dependencies on the use case.

### Claim 11 (depends on 9)

The computer program product of claim 9, the determining comprising:
identifying K number of points respectively corresponding the K number of use case profiles in the N-dimensional space; and
ascertaining the B number of best predictors that distinguishes one use case profile from another by space partitioning of the N-dimensional space from the identifying the K number of points.

### Claim 12 (depends on 11)

The computer program product of claim 11; wherein the space partitioning of the N-dimensional space is by use of Voronoi cells with the K number of points corresponding to the respective use case profiles as respective seeds.

### Claim 13 (depends on 8)

The computer program product of claim 8, the generating comprising:
removing, from the native code, counters that are not included in the best predictors from the determining;
compiling the code resulting from the removing into an executable code having the best predictors; and
replicating the executable code K number of times for respective use cases.

### Claim 14 (depends on 8)

The computer program product of claim 8, further comprising:
profiling the variants dynamically in the production environment by use of the use case profiles respectively corresponding to each variant, based on values counted from the best predictors embedded in the variants.

### Claim 15

A system comprising:
a memory;
one or more processor in communication with memory; and
program instructions executable by the one or more processor via the memory to perform a method comprising:
obtaining a native code having a plurality of counters embedded at respective profiling locations in the native code, a number of the counters being referred to as a first positive integer N;
selecting a plurality of use cases to be serviced by the obtained native code, each of the plurality of the use cases is a list of computational actions to be performed toward an end result respectively corresponding to the use cases, and wherein a number of the use cases is a second positive integer K;
creating K number of use cases profiles respectively corresponding to each use case amongst the selected K number of use cases, wherein each use case profile includes performance characteristics corresponding to respective use cases;
determining a minimal number of counters referred to as best predictors amongst the N number of counters embedded in the native code that identify one of the K number of use case profiles from the creating, wherein the minimal number is a third positive integer B;
generating variants respective to the use cases based on the determined B number of best predictors, wherein each of the variants is a unique machine code customized for system requirements respectively corresponding to the use cases; and
producing the generated variants and corresponding use case profiles to one or more production environment to thereby provide respective end results of the use cases for end users by performing the use cases.

### Claim 16 (depends on 15)

The system of claim 15, the creating comprising:
running a use case of the use cases for a preconfigured number of times while cumulating values of the counters to thereby represent performance characteristics of the use case; and
recording the cumulated values of the counters representing the performance characteristics of the use case as a use case profile for the use case.

### Claim 17 (depends on 16)

The system of claim 16, further comprising:
mapping the use case profile to a point in a N-dimensional space;
analyzing respective dependencies of the counters embedded in the native code on the use case; and
mapping the counters to respective points in the N-dimensional space according to the analyzed respective dependencies on the use case.

### Claim 18 (depends on 16)

The system of claim 16, the determining comprising:
identifying K number of points respectively corresponding the K number of use case profiles in the N-dimensional space; and
ascertaining the B number of best predictors that distinguishes one use case profile from another by space partitioning of the N-dimensional space from the identifying the K number of points.

### Claim 19 (depends on 15)

The system of claim 15, the generating comprising:
removing, from the native code, counters that are not included in the best predictors from the determining;
compiling the code resulting from the removing into an executable code having the best predictors; and
replicating the executable code K number of times for respective use cases.

### Claim 20 (depends on 15)

The system of claim 15, further comprising:
profiling the variants dynamically in the production environment by use of the use case profiles respectively corresponding to each variant, based on values counted from the best predictors embedded in the variants.
