blob: b2e0373000128882d0dc4809aaadbfb2f556a4e4 [file] [log] [blame]
Yi Jin9680cfa2017-09-15 15:14:43 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Yi Jinc7f93072017-09-29 15:29:38 -070017syntax = "proto2";
Yi Jin9680cfa2017-09-15 15:14:43 -070018option java_multiple_files = true;
19option java_outer_classname = "ProcessStatsServiceProto";
20
21import "frameworks/base/core/proto/android/util/common.proto";
22
23package android.service.procstats;
24
25/**
26 * Data from ProcStatsService Dumpsys
27 *
28 * Next Tag: 4
29 */
30message ProcessStatsServiceDumpProto {
31
Yi Jinc7f93072017-09-29 15:29:38 -070032 optional ProcessStatsSectionProto procstats_now = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070033
Yi Jinc7f93072017-09-29 15:29:38 -070034 optional ProcessStatsSectionProto procstats_over_3hrs = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070035
Yi Jinc7f93072017-09-29 15:29:38 -070036 optional ProcessStatsSectionProto procstats_over_24hrs = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -070037}
38
39/**
40 * Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
41 * This proto is defined based on the writeToParcel method.
42 *
43 * Next Tag: 9
44 */
45message ProcessStatsSectionProto {
46
47 // Elapsed realtime at start of report.
Yi Jinc7f93072017-09-29 15:29:38 -070048 optional int64 start_realtime_ms = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070049
50 // Elapsed realtime at end of report.
Yi Jinc7f93072017-09-29 15:29:38 -070051 optional int64 end_realtime_ms = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070052
53 // CPU uptime at start of report.
Yi Jinc7f93072017-09-29 15:29:38 -070054 optional int64 start_uptime_ms = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -070055
56 // CPU uptime at end of report.
Yi Jinc7f93072017-09-29 15:29:38 -070057 optional int64 end_uptime_ms = 4;
Yi Jin9680cfa2017-09-15 15:14:43 -070058
59 // System runtime library. e.g. "libdvm.so", "libart.so".
Yi Jinc7f93072017-09-29 15:29:38 -070060 optional string runtime = 5;
Yi Jin9680cfa2017-09-15 15:14:43 -070061
62 // whether kernel reports swapped pss.
Yi Jinc7f93072017-09-29 15:29:38 -070063 optional bool has_swapped_pss = 6;
Yi Jin9680cfa2017-09-15 15:14:43 -070064
65 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
66 enum Status {
67 STATUS_UNKNOWN = 0;
68 STATUS_COMPLETE = 1;
69 STATUS_PARTIAL = 2;
70 STATUS_SHUTDOWN = 3;
71 STATUS_SYSPROPS = 4;
72 }
73 repeated Status status = 7;
74
75 // Stats for each process.
76 repeated ProcessStatsProto process_stats = 8;
77}
78
79// Next Tag: 6
80message ProcessStatsProto {
81
82 // Name of process.
Yi Jinc7f93072017-09-29 15:29:38 -070083 optional string process = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070084
85 // Uid of the process.
Yi Jinc7f93072017-09-29 15:29:38 -070086 optional int32 uid = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070087
88 // Information about how often kills occurred
89 message Kill {
Yi Jin9680cfa2017-09-15 15:14:43 -070090 // Count of excessive CPU kills
Yi Jinc7f93072017-09-29 15:29:38 -070091 optional int32 cpu = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -070092
93 // Count of kills when cached
Yi Jinc7f93072017-09-29 15:29:38 -070094 optional int32 cached = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -070095
96 // PSS stats during cached kill
Yi Jinc7f93072017-09-29 15:29:38 -070097 optional android.util.AggStats cached_pss = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -070098 }
Yi Jinc7f93072017-09-29 15:29:38 -070099 optional Kill kill = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -0700100
101 message State {
102 enum ScreenState {
103 SCREEN_UNKNOWN = 0;
104 OFF = 1;
105 ON = 2;
106 }
Yi Jinc7f93072017-09-29 15:29:38 -0700107 optional ScreenState screen_state = 1;
Yi Jin9680cfa2017-09-15 15:14:43 -0700108
109 enum MemoryState {
110 MEMORY_UNKNOWN = 0;
111 NORMAL = 1; // normal.
112 MODERATE = 2; // moderate memory pressure.
113 LOW = 3; // low memory.
114 CRITICAL = 4; // critical memory.
115 }
Yi Jinc7f93072017-09-29 15:29:38 -0700116 optional MemoryState memory_state = 2;
Yi Jin9680cfa2017-09-15 15:14:43 -0700117
118 enum ProcessState {
119 PROCESS_UNKNOWN = 0;
120 // Persistent system process.
121 PERSISTENT = 1;
122 // Top activity; actually any visible activity.
123 TOP = 2;
124 // Important foreground process (ime, wallpaper, etc).
125 IMPORTANT_FOREGROUND = 3;
126 // Important background process.
127 IMPORTANT_BACKGROUND = 4;
128 // Performing backup operation.
129 BACKUP = 5;
130 // Heavy-weight process (currently not used).
131 HEAVY_WEIGHT = 6;
132 // Background process running a service.
133 SERVICE = 7;
134 // Process not running, but would be if there was enough RAM.
135 SERVICE_RESTARTING = 8;
136 // Process running a receiver.
137 RECEIVER = 9;
138 // Process hosting home/launcher app when not on top.
139 HOME = 10;
140 // Process hosting the last app the user was in.
141 LAST_ACTIVITY = 11;
142 // Cached process hosting a previous activity.
143 CACHED_ACTIVITY = 12;
144 // Cached process hosting a client activity.
145 CACHED_ACTIVITY_CLIENT = 13;
146 // Cached process that is empty.
147 CACHED_EMPTY = 14;
148 }
Yi Jinc7f93072017-09-29 15:29:38 -0700149 optional ProcessState process_state = 3;
Yi Jin9680cfa2017-09-15 15:14:43 -0700150
151 // Millisecond duration spent in this state
Yi Jinc7f93072017-09-29 15:29:38 -0700152 optional int64 duration_ms = 4;
Yi Jin9680cfa2017-09-15 15:14:43 -0700153
154 // # of samples taken
Yi Jinc7f93072017-09-29 15:29:38 -0700155 optional int32 sample_size = 5;
Yi Jin9680cfa2017-09-15 15:14:43 -0700156
157 // PSS is memory reserved for this process
Yi Jinc7f93072017-09-29 15:29:38 -0700158 optional android.util.AggStats pss = 6;
Yi Jin9680cfa2017-09-15 15:14:43 -0700159
160 // USS is memory shared between processes, divided evenly for accounting
Yi Jinc7f93072017-09-29 15:29:38 -0700161 optional android.util.AggStats uss = 7;
Yi Jin9680cfa2017-09-15 15:14:43 -0700162 }
163 repeated State states = 5;
164}