# US 8,789,028 B2 · Memory access monitoring

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

- Number: US 8,789,028 B2
- Document ID: US8789028B2
- Status: Granted
- Kind: B2
- Application number: 11/478,743
- Filed: 2006-06-30
- Published: 2008-02-07
- Granted: 2014-07-22
- Earliest claimed: 2006-06-30
- Assignees: International Business Machines Corporation
- Applicants: Xiaowei Shen; Peter F. Sweeney
- Inventors: Xiaowei Shen; Peter F. Sweeney
- Web page: https://patentgrep.com/patent/US8789028B2

## CPC

- G06F 11/3471: {Address tracing}
- G06F 8/443: {Optimisation}
- G06F 2201/88: Monitoring involving counting
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method for memory access monitoring, implemented by a managed runtime environment computer system including a controller that monitors application behavior and determines actions to be taken to change a behavior of an application, and a runtime, dynamic compiler that analyzes the application and generates code sequences to access a memory access monitoring (MAM) mechanism, includes determining monitor information of a plurality of fields of a memory block to drive an optimization of the application.

## Claims

### Claim 1

A non-transitory computer readable storage medium embodying instructions executable by a processor to perform a computer-implemented method of memory access monitoring (MAM), the method comprising the steps of:
constructing a MAM table comprising a plurality of table entries, wherein each table entry comprises an address register (AR), a control register (CR), and a monitor register (MR);
identifying a memory block to be monitored, wherein an address of the memory block is specified by setting the AR and a location of the memory block in a memory hierarchy is specified by setting the CR, wherein
the location is a memory component among a plurality of memory components having different latencies;
storing, in the MR, monitor information specifying which sub-blocks of the memory block have been accessed and how many times each sub-block has been accessed;
determining respective latencies for each memory component;
using one or more hardware performance monitors by counting a number of accesses for each memory component and multiplying the counted number of accesses by a time to access a piece of information, wherein memory latency is calculated in this manner for particular addresses within each memory component;
reducing the respective latency of the memory block by optimizing the memory block wherein
an optimization includes field reordering and object splitting each applied according to a size of the memory block,
wherein applying the optimization comprises: recompiling all code that is affected by the optimization; and reordering objects whose type has been optimized.

### Claim 2

A computer-implemented method for memory access monitoring, implemented by a managed runtime environment computer system comprising
a controller that monitors application behavior and
determines an action to be taken to change a behavior of an application, and
a runtime, dynamic compiler that analyzes the application and generates code sequences to access a memory access monitoring (MAM) mechanism, the computer-implemented method comprises
determining monitor information of a plurality of fields of a memory block and a location of the memory block in a multi-level memory hierarchy to drive an optimization of the application, wherein
the monitor information specifies which sub-blocks of the memory block have been accessed and how many times each sub-block has been accessed and
the location is a memory component among a plurality of memory components having different latencies, and wherein
the optimization reduces a respective latency of the memory block; and wherein
respective latencies for each memory component are determined using one or more hardware performance monitors by counting a number of accesses for each memory component and multiplying the counted number of accesses by a time to access a piece of information, wherein memory latency is calculated in this manner for particular addresses within each memory component; and
wherein applying the optimization comprises: recompiling all code that is affected by the optimization; and reordering objects whose type has been optimized.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein determining the monitor information comprises at least one of:
determining an address of a sub-block in the monitored memory block that has been read;
determining an address of a sub-block in the monitored memory block that has been modified;
determining an address of a sub-block in the monitored memory block that has been accessed;
determining a number of times a sub-block in the monitored memory block has been read;
determining a number of times a sub-block in the monitored memory block has been modified;
determining a number of times a sub-block in the monitored memory block has been accessed;
determining an address of a sub-block in the monitored memory block that is read first;
determining an address of a sub-block in the monitored memory block that is modified first;
determining an address of a sub-block in the monitored memory block that is accessed first;
determining an order in which sub-blocks in the monitored memory block are read;
determining an order in which sub-blocks in the monitored memory block are modified; and
determining an order in which sub-blocks in the monitored memory block are accessed.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, wherein the optimization includes at least one of field reordering and object splitting.

### Claim 5

A non-transitory computer readable storage medium embodying instructions executable by a processor to perform a computer-implemented method of memory access monitoring (MAM), the method comprising the steps of:
collecting monitor information including a monitored address in a component and a location of the component in a multi-level memory hierarchy; wherein
the multi-level memory hierarchy comprises different components, including the component, wherein
the different components have different latencies wherein
respective latencies for each memory component are determined using one or more hardware performance monitors by counting a number of accesses for each memory component and multiplying the counted number of accesses by a time to access a piece of information, wherein memory latency is calculated in this manner for particular addresses within each memory component; and
recording the monitor information for the monitored address, when at least one of, a sub-block of the monitored address is read, a sub-block of the monitored address is modified, and a sub-block of the monitored address is accessed, wherein
the monitor information for the monitored address in the component in the memory hierarchy is used to drive an optimization reducing a respective latency of the component;
wherein applying the optimization comprises: recompiling all code that is affected by the optimization; and reordering objects whose type has been optimized.

### Claim 6 (depends on 5)

The computer readable storage medium of claim 5, wherein the optimization includes at least one of field reordering and object splitting, wherein the field reordering and the object splitting are applied according to a memory block size of the component.

### Claim 7 (depends on 6)

The computer readable storage medium of claim 6, wherein driving the optimization comprises:
detecting a candidate program point to collect monitor information;
collecting MAM information for the candidate program point;
analyzing the MAM information;
applying the optimization; and
validating the optimization.

### Claim 8 (depends on 7)

The computer readable storage medium of claim 7, wherein detecting the candidate program point comprises:
counting accesses to the component in the multi-level memory hierarchy;
determining that the component has an affect on the application's performance from counted accesses; and
sampling accesses to the component in the multi-level memory hierarchy; and
identifying from sampled accesses at a candidate program point.

### Claim 9 (depends on 7)

The computer readable storage medium of claim 7, wherein collecting the MAM information comprises:
identifying a program point to program a MAM mechanism;
programming the MAM mechanism at the program point with the MAM information that comprises the monitored address, an action, and the component in the memory hierarchy; and
collecting the MAM information upon the action occurring on the monitored memory block in the component.

### Claim 10 (depends on 7)

The computer readable storage medium of claim 7, wherein analyzing the MAM information comprises determining if the optimization will reduce latency for the candidate.

### Claim 11 (depends on 7)

The computer readable storage medium of claim 7, wherein validating the optimization comprises:
counting access to the component in the multi-level memory hierarchy; and
determine that the component's latency has decreased.
