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";
7import "frameworks/proto_logging/stats/enums/app/job/job_enums.proto";
8
9option java_package = "com.android.os.art";
10option java_multiple_files = true;
11
12extend Atom {
13    optional BackgroundDexoptJobEnded background_dexopt_job_ended = 467 [(module) = "art"];
14    optional PreRebootDexoptJobEnded prereboot_dexopt_job_ended = 883 [(module) = "art"];
15}
16
17/**
18 * Logs when a background dexopt job is ended.
19 *
20 * Logged from:
21 *   frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
22 *   art/libartservice/service/java/com/android/server/art/BackgroundDexoptJobStatsReporter.java
23 */
24 message BackgroundDexoptJobEnded {
25    // Corresponds to `BackgroundDexOptService.Status`, except for
26    // `STATUS_JOB_FINISHED`.
27    enum Status {
28        STATUS_UNKNOWN = 0;
29
30        // The job has finished. This value is used even if some packages have
31        // failed compilation during the job. (Corresponds to either
32        // `BackgroundDexOptService.Status.STATUS_OK` or
33        // `BackgroundDexOptService.Status.STATUS_DEX_OPT_FAILED`.)
34        STATUS_JOB_FINISHED = 1;
35
36        // The job is aborted by the job scheduler. The reason is logged in
37        // `cancellation_reason`.
38        STATUS_ABORT_BY_CANCELLATION = 2;
39
40        // The job is aborted by itself because there is no space left. Note
41        // that this does NOT include cases where the job is aborted by the job
42        // scheduler due to no space left, which are logged as
43        // `STATUS_ABORT_BY_CANCELLATION` with `cancellation_reason` being
44        // `STOP_REASON_CONSTRAINT_STORAGE_NOT_LOW`.
45        STATUS_ABORT_NO_SPACE_LEFT = 3;
46
47        // The job is aborted by itself because of thermal issues. Note that
48        // this does NOT include cases where the job is aborted by the job
49        // scheduler due to thermal issues, which are logged as
50        // `STATUS_ABORT_BY_CANCELLATION` with `cancellation_reason` being
51        // `STOP_REASON_DEVICE_STATE`.
52        //
53        // Only applies to the legacy dexopt job.
54        STATUS_ABORT_THERMAL = 4;
55
56        // The job is aborted by itself because of unsatisfied battery level.
57        // Note that this does NOT include cases where the job is aborted by the
58        // job scheduler due to unsatisfied battery level, which are logged as
59        // `STATUS_ABORT_BY_CANCELLATION` with `cancellation_reason` being
60        // `STOP_REASON_CONSTRAINT_BATTERY_NOT_LOW`.
61        //
62        // Only applies to the legacy dexopt job.
63        STATUS_ABORT_BATTERY = 5;
64
65        // The job is aborted by the API
66        // `ArtManagerLocal.cancelBackgroundDexoptJob`.
67        //
68        // Only applies to the background dexopt job in ART Service.
69        STATUS_ABORT_BY_API = 6;
70
71        // The job encountered a fatal error, such as a runtime exception. Note
72        // that this does NOT include cases where the job finishes normally with
73        // some dexopt failures on some apps, which are expected and logged as
74        // `STATUS_JOB_FINISHED`.
75        STATUS_FATAL_ERROR = 7;
76    }
77
78    optional Status status = 1;
79
80    // If `status` is `STATUS_ABORT_BY_CANCELLATION`, the reason of the
81    // cancellation.
82    optional android.app.job.StopReasonEnum cancellation_reason = 2;
83
84    // The duration of the job run, in milliseconds.
85    optional int64 duration_ms = 3;
86
87    // The duration of the job run, in milliseconds, including time spent in
88    // sleep. Deprecated as the job scheduler holds a wake lock, hence this
89    // duration is always going to be the same as above.
90    optional int64 duration_including_sleep_ms = 4 [deprecated = true];
91
92    // The number of packages successfully optimized in this run.
93    optional int32 optimized_package_count = 5;
94    // The number of packages depending on the boot classpath.
95    optional int32 packages_depending_on_boot_classpath_count = 6;
96    // The total number of packages scanned in this run. This is usually the
97    // total number of packages on device, but may vary due to
98    // OEM customizations.
99    optional int32 total_package_count = 7;
100
101    // Background dexopt runs in multiple passes, each of which reports a
102    // separate atom. This enum indicates which pass this atom is about.
103    enum Pass {
104        PASS_UNKNOWN = 0;
105
106        // The downgrade pass, run before the main pass.
107        PASS_DOWNGRADE = 1;
108
109        // The main pass. This is converted to JOB_TYPE_INCREMENTAL_RUN or
110        // JOB_TYPE_FULL_RUN on Pitot.
111        PASS_MAIN = 2;
112
113        // The supplementary pass, run after the main pass.
114        PASS_SUPPLEMENTARY = 3;
115    }
116
117    optional Pass pass = 8;
118}
119
120/**
121 * Logs when a pre-reboot dexopt job is ended.
122 *
123 * Logged from:
124 *   art/libartservice/service/java/com/android/server/art/prereboot/PreRebootStatsReporter.java
125 */
126message PreRebootDexoptJobEnded {
127    // Overall status of the job right before the reboot.
128    enum Status {
129        STATUS_UNKNOWN = 0;
130        // The job was scheduled but was never run before the reboot.
131        // Package counts are not available.
132        STATUS_SCHEDULED = 1;
133        // The job was started but was interrupted by the reboot, when the job
134        // criteria were still met (e.g., adb reboot or unattended reboot).
135        // A user-requested reboot is probably not logged as this status because
136        // the device is probably not idle when the user requests the reboot,
137        // making the job cancelled.
138        // Package counts may or may not be available, depending on whether the
139        // job was interrupted before or after the package scanning.
140        STATUS_STARTED = 5;
141        // The job failed in an unexpected way.
142        // Package counts may or may not be available, depending on whether the
143        // job failed before or after the package scanning.
144        STATUS_FAILED = 3;
145        // The job was finished or cancelled. Some packages may be successfully
146        // optimized, while some may fail to be optimized.
147        // Package counts may or may not be available, depending on whether the
148        // job was cancelled before or after the package scanning.
149        STATUS_FINISHED = 2;
150        // Deprecated.
151        STATUS_CANCELLED = 4 [deprecated = true];
152        // The job was aborted because the system requirement check failed or
153        // system requirements were not met.
154        // Package counts are not available.
155        STATUS_ABORTED_SYSTEM_REQUIREMENTS = 6;
156        // The job was not scheduled because it was disabled by build-time flag or phenotype flag.
157        STATUS_NOT_SCHEDULED_DISABLED = 7;
158        // The job was not scheduled because a job scheduler failure occurred.
159        STATUS_NOT_SCHEDULED_JOB_SCHEDULER = 8;
160    }
161    optional Status status = 1;
162
163    // Number of packages successfully optimized.
164    optional int32 optimized_package_count = 2;
165    // Number of packages that failed to be optimized.
166    optional int32 failed_package_count = 3;
167    // Number of packages skipped.
168    optional int32 skipped_package_count = 4;
169    // Total number of packages scanned.
170    optional int32 total_package_count = 5;
171
172    // Duration of the job run (delta between when then job is started and when
173    // the job is finished or failed), in milliseconds, in wall time.
174    optional int64 job_duration_millis = 6;
175    // Latency of the job run (delta between when the job is scheduled and when
176    // the job is started the first time), in milliseconds.
177    optional int64 job_latency_millis = 7;
178    // The number of times the job is run due to retries.
179    optional int32 job_run_count = 10;
180
181    // Number of packages that have Pre-reboot Dexopt artifacts before the
182    // reboot. Note that this isn't necessarily equal to
183    // `optimized_package_count` because packages that failed to be optimized
184    // may still have some splits successfully optimized.
185    // Depending on the implementation, in rare cases, this may be undercounted when the progress is
186    // not 100% (i.e., `optimized_package_count` + `failed_package_count` + `skipped_package_count`
187    // < `total_package_count`).
188    optional int32 packages_with_artifacts_before_reboot_count = 11;
189    // Number of packages that have Pre-reboot Dexopt artifacts after the
190    // reboot. Normally, this should be equal to
191    // `packages_with_artifacts_before_reboot_count`, but artifacts may be lost
192    // due to apps added/removed/updated after the job was run or due to bugs.
193    optional int32 packages_with_artifacts_after_reboot_count = 8;
194    // Number of packages that have Pre-reboot Dexopt artifacts that are usable
195    // after the reboot. Normally, this should be equal to
196    // `packages_with_artifacts_after_reboot_count`, but artifacts may be
197    // invalid due to bugs.
198    optional int32 packages_with_artifacts_usable_after_reboot_count = 9;
199
200    // The type of the job.
201    enum JobType {
202        JOB_TYPE_UNKNOWN = 0;
203        JOB_TYPE_OTA = 1;
204        JOB_TYPE_MAINLINE = 2;
205    }
206    optional JobType job_type = 12;
207}
208