1syntax = "proto2";
2
3package android.os.statsd.art;
4
5import "frameworks/proto_logging/stats/atoms.proto";
6import "frameworks/proto_logging/stats/atom_field_options.proto";
7
8option java_package = "com.android.os.art";
9option java_multiple_files = true;
10
11extend Atom {
12    optional OdrefreshReported odrefresh_reported = 366 [(module) = "art"];
13    optional OdsignReported odsign_reported = 548 [(module) = "art"];
14}
15
16/*
17 * Logs information about on-device refresh of ART AOT artifacts for boot classpath extensions
18 * and system_server.
19 *
20 * Logged from:
21 *   art/odrefresh/odrefresh.cc
22 */
23 message OdrefreshReported {
24    optional int64 art_apex_version = 1;
25
26    // Keep in sync with the Trigger enum defined in art/odrefresh/odr_metrics.h
27    enum Trigger {
28        // A placeholder for unknown values.
29        TRIGGER_UNKNOWN = 0;
30
31        // ART APEX version has changed since time artifacts were generated.
32        TRIGGER_APEX_VERSION_MISMATCH = 1;
33
34        // Dex files on the boot classpath or system_server classpath have changed.
35        TRIGGER_DEX_FILES_CHANGED = 2;
36
37        // Missing artifacts.
38        TRIGGER_MISSING_ARTIFACTS = 3;
39    }
40
41    optional Trigger trigger = 2;
42
43    // Keep in sync with the Stage enum defined in art/odrefresh/odr_metrics.h
44    enum Stage {
45        // A placeholder for unknown values.
46        STAGE_UNKNOWN = 0;
47
48        // Checking stage.
49        STAGE_CHECK = 10;
50
51        // Preparation for compilation.
52        STAGE_PREPARATION = 20;
53
54        // Compilation of the boot classpath for the primary architecture
55        // ("primary boot classpath").
56        STAGE_PRIMARY_BOOT_CLASSPATH = 30;
57
58        // Compilation of the boot classpath for the secondary architecture
59        // ("secondary boot classpath"), if any.
60        STAGE_SECONDARY_BOOT_CLASSPATH = 40;
61
62        // Compilation of system_server classpath.
63        STAGE_SYSTEM_SERVER_CLASSPATH = 50;
64
65        // All stages completed.
66        STAGE_COMPLETE = 60;
67    }
68
69    optional Stage stage_reached = 3;
70
71    // Keep in sync with the Status enum defined in art/odrefresh/odr_metrics.h
72    enum Status {
73        // A placeholder for unknown values.
74        STATUS_UNKNOWN = 0;
75
76        // OK, no problems encountered.
77        STATUS_OK = 1;
78
79        // Insufficient space.
80        STATUS_NO_SPACE = 2;
81
82        // Storage operation failed.
83        STATUS_IO_ERROR = 3;
84
85        // Dex2oat reported an error.
86        STATUS_DEX2OAT_ERROR = 4;
87
88        reserved 5; // was STATUS_TIME_LIMIT_EXCEEDED
89
90        // Failure creating staging area.
91        STATUS_STAGING_FAILED = 6;
92
93        // Installation of artifacts failed.
94        STATUS_INSTALL_FAILED = 7;
95
96        // Failed to access the dalvik-cache directory due to lack of
97        // permission.
98        STATUS_DALVIK_CACHE_PERMISSION_DENIED = 8;
99    }
100
101    optional Status status = 4;
102
103    // Compilation time of the boot classpath for the primary architecture
104    // ("primary boot classpath"), in seconds.
105    optional int32 primary_bcp_compilation_seconds = 5;
106
107    // Compilation time of the boot classpath for the secondary architecture
108    // ("secondary boot classpath"), if any, in seconds.
109    optional int32 secondary_bcp_compilation_seconds = 6;
110
111    // Compilation time of system_server classpath, in seconds.
112    optional int32 system_server_compilation_seconds = 7;
113
114    // Cache space at start of update.
115    optional int32 cache_space_free_start_mib = 8;
116
117    // Cache space at end of update.
118    optional int32 cache_space_free_end_mib = 9;
119
120    // Compilation time of the boot classpath for the primary architecture
121    // ("primary boot classpath"), in milliseconds.
122    optional int32 primary_bcp_compilation_millis = 10;
123
124    // Compilation time of the boot classpath for the secondary architecture
125    // ("secondary boot classpath"), if any, in milliseconds.
126    optional int32 secondary_bcp_compilation_millis = 11;
127
128    // Compilation time of system_server classpath, in milliseconds.
129    optional int32 system_server_compilation_millis = 12;
130
131    // Keep in sync with the ExecResult enum defined in art/runtime/exec_utils.h
132    enum ExecResultStatus {
133        // Unable to get the status.
134        EXEC_RESULT_STATUS_UNKNOWN = 0;
135        // Process exited normally with an exit code.
136        EXEC_RESULT_STATUS_EXITED = 1;
137        // Process terminated by a signal.
138        EXEC_RESULT_STATUS_SIGNALED = 2;
139        // Process timed out and killed.
140        EXEC_RESULT_STATUS_TIMED_OUT = 3;
141        // Failed to start the process.
142        EXEC_RESULT_STATUS_START_FAILED = 4;
143        // Process was not run.
144        EXEC_RESULT_STATUS_NOT_RUN = 5;
145    }
146
147    // Status for the compilation of the boot
148    // classpath for the primary architecture.
149    optional ExecResultStatus primary_bcp_dex2oat_result_status = 13;
150
151    // Exit code for the compilation of the boot classpath for the
152    // primary architecture if status is EXEC_RESULT_STATUS_EXITED, else -1.
153    optional int32 primary_bcp_dex2oat_result_exit_code = 14;
154
155    // Signal for the compilation of the boot classpath for the
156    // primary architecture if status is EXEC_RESULT_STATUS_SIGNALED, else 0.
157    optional int32 primary_bcp_dex2oat_result_signal = 15;
158
159    // Status for the compilation of the boot
160    // classpath for the secondary architecture.
161    optional ExecResultStatus secondary_bcp_dex2oat_result_status = 16;
162
163    // Exit code for the compilation of the boot classpath for the
164    // secondary architecture if status is EXEC_RESULT_STATUS_EXITED, else -1.
165    optional int32 secondary_bcp_dex2oat_result_exit_code = 17;
166
167    // Signal for the compilation of the boot classpath for the
168    // secondary architecture if status is EXEC_RESULT_STATUS_SIGNALED, else 0.
169    optional int32 secondary_bcp_dex2oat_result_signal = 18;
170
171    // Status for the compilation of the boot classpath for the system_server.
172    optional ExecResultStatus system_server_dex2oat_result_status = 19;
173
174    // Exit code for the compilation of the boot classpath for the
175    // system_server if status is EXEC_RESULT_STATUS_EXITED, else -1.
176    optional int32 system_server_dex2oat_result_exit_code = 20;
177
178    // Signal for the compilation of the boot classpath for the
179    // system_server if status is EXEC_RESULT_STATUS_SIGNALED, else 0.
180    optional int32 system_server_dex2oat_result_signal = 21;
181
182    // Keep in sync with the BcpCompilationType enum defined in art/odrefresh/odr_metrics.h
183    enum BcpCompilationType {
184        BCP_COMPILATION_TYPE_UNKNOWN = 0;
185        // Compiles for both the primary boot image and the mainline extension.
186        BCP_COMPILATION_TYPE_PRIMARY_AND_MAINLINE = 1;
187        // Only compiles for the mainline extension.
188        BCP_COMPILATION_TYPE_MAINLINE = 2;
189    }
190
191    optional BcpCompilationType primary_bcp_compilation_type = 22;
192    optional BcpCompilationType secondary_bcp_compilation_type = 23;
193};
194
195/**
196 * Logs odsign metrics.
197 *
198 * Logged from:
199 *   frameworks/base/services/core/java/com/android/server/pm/dex/OdsignStatsLogger.java
200 */
201 message OdsignReported {
202    enum Status {
203        // Unknown value.
204        STATUS_UNSPECIFIED = 0;
205        // All artifacts are generated and signed.
206        STATUS_ALL_OK = 1;
207        // Some artifacts are generated and signed, but odrefresh failed to generate the rest. See
208        // odrefresh metrics for the odrefresh failure.
209        STATUS_PARTIAL_OK = 2;
210        // Odrefresh failed to generate any artifact. See odrefresh metrics for the odrefresh
211        // failure.
212        STATUS_ODREFRESH_FAILED = 3;
213        // Odsign failed when interacting with Keystore.
214        STATUS_KEYSTORE_FAILED = 4;
215        // Odsign failed when initializing certificate.
216        STATUS_CERT_FAILED = 5;
217        // Odsign failed when cleaning up existing artifacts. Note that odrefresh may also clean up
218        // existing artifacts, and failures about that are logged as `STATUS_ODREFRESH_FAILED`.
219        STATUS_CLEANUP_FAILED = 6;
220        // Odsign failed when signing artifacts.
221        STATUS_SIGNING_FAILED = 7;
222    }
223
224    optional Status status = 1;
225}