You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference-manual/native-image/PGO-IprofFileFormat.md
+34-8Lines changed: 34 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,33 +17,34 @@ This document outlines the structure and semantics of the _iprof_ file format.
17
17
18
18
## Structure
19
19
20
-
The full schema of the JSON format used for _iprof_ files can be found in the [iprof-v1.0.0.schema.json](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/iprof-v1.0.0.schema.json) document.
20
+
The full schema of the JSON format used for _iprof_ files can be found in the [iprof-v1.1.0.schema.json](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/iprof-v1.1.0.schema.json) document.
21
21
This JSON schema fully defines the _iprof_ file format and can be used to validate the structure of an arbitrary _iprof_ file.
22
22
23
23
A minimal valid _iprof_ file consists of a JSON object containing 3 fields: `types`, `methods` and `version`.
24
-
The following is a minimal valid _iprof_ file for the current version (`1.0.0`).
24
+
The following is a minimal valid _iprof_ file for the current version (`1.1.0`).
25
25
26
26
```json
27
27
{
28
-
"version": "1.0.0",
28
+
"version": "1.1.0",
29
29
"types": [],
30
30
"methods": []
31
31
}
32
32
```
33
33
34
34
In addition to these fields, the _iprof_ file may optionally contain others that provide information on various run-time profiles.
35
-
The following is an example of a fully populated _iprof_ file (version `1.0.0`) with the actual content of each of the fields replaced with `...`.
35
+
The following is an example of a fully populated _iprof_ file (version `1.1.0`) with the actual content of each of the fields replaced with `...`.
36
36
37
37
```json
38
38
{
39
-
"version": "1.0.0",
39
+
"version": "1.1.0",
40
40
"types": [...],
41
41
"methods": [...],
42
42
"monitorProfiles": [...],
43
43
"virtualInvokeProfiles": [...],
44
44
"callCountProfiles": [...],
45
45
"conditionalProfiles": [...],
46
-
"samplingProfiles": [...]
46
+
"samplingProfiles": [...],
47
+
"instanceofProfiles": [...],
47
48
}
48
49
```
49
50
@@ -115,11 +116,11 @@ The _iprof_ format uses a semantic versioning scheme (ie. `major.minor.patch`) t
115
116
The major version is updated for breaking changes (for example, a new way of encoding the information),
116
117
minor for non-breaking ones (for example, adding a new optional field in the top-level JSON object),
117
118
and the patch version is updated for minor fixes that should not impact any client.
118
-
The current version of the _iprof_ file format is `1.0.0`, which can be seen in the _iprof_ file from the example application.
119
+
The current version of the _iprof_ file format is `1.1.0`, which can be seen in the _iprof_ file from the example application.
119
120
120
121
```json
121
122
...
122
-
"version": "1.0.0",
123
+
"version": "1.1.0",
123
124
...
124
125
```
125
126
@@ -713,6 +714,31 @@ In this case, it means that the context described in the previous paragraph was
713
714
The other object in the sampling profiles array contains a different context and this sample was seen only once.
714
715
Understanding the nature of this sample is left as an exercise to the reader.
715
716
717
+
## Instance-of Profiles
718
+
719
+
> Note: Instance-of profiles were added in the _iprof_ file format version 1.1.0. They are not present in version 1.0.0.
720
+
721
+
Instance-of profiles contain information on the run-time types of values that are checked at `instanceof` operators.
722
+
Specifically, they record how many times a particular run-time type was encountered at a given `instanceof` operation.
723
+
Thus, instance-of profiling information can be stored in the same format as [Virtual Invoke Profiles](#virtual-invoke-profiles).
724
+
The only difference is that the resulting type histogram in the `records` part describes the types seen at `instanceof` checks, rather than the receiver types of virtual method calls.
725
+
Consider the following Java code:
726
+
727
+
```java
728
+
publicclassA {}
729
+
publicclassBextendsA {}
730
+
731
+
publicstaticvoid doForA(Object obj) {
732
+
if(obj instanceofA) {
733
+
doSomething(obj);
734
+
}
735
+
}
736
+
```
737
+
738
+
The `records` section of the profile will include all types (e.g., `A`, `B`, `Object`, `String`) encountered at run time for the `obj` variable, together with their occurrence counts.
739
+
Thus, the length of the `records` array for instance-of profiles is always a multiple of 2,
740
+
since the values represent a type ID and count pair.
741
+
716
742
## Related Documentation
717
743
-[PGO](PGO.md)
718
744
-[Optimize a Native Executable with Profile-Guided Optimization](guides/optimize-native-executable-with-pgo.md)
0 commit comments