blob: 4c11f1eb022046fb19882f5fb28515326b36cc34 [file] [log] [blame]
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto2";
option java_multiple_files = true;
option java_outer_classname = "ProcessStatsServiceProto";
import "frameworks/base/core/proto/android/util/common.proto";
import "frameworks/base/libs/incident/proto/android/privacy.proto";
package android.service.procstats;
/**
* Data from ProcStatsService Dumpsys
*
* Next Tag: 4
*/
message ProcessStatsServiceDumpProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
optional ProcessStatsSectionProto procstats_now = 1;
optional ProcessStatsSectionProto procstats_over_3hrs = 2;
optional ProcessStatsSectionProto procstats_over_24hrs = 3;
}
/**
* Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
* This proto is defined based on the writeToParcel method.
*
* Next Tag: 9
*/
message ProcessStatsSectionProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
// Elapsed realtime at start of report.
optional int64 start_realtime_ms = 1;
// Elapsed realtime at end of report.
optional int64 end_realtime_ms = 2;
// CPU uptime at start of report.
optional int64 start_uptime_ms = 3;
// CPU uptime at end of report.
optional int64 end_uptime_ms = 4;
// System runtime library. e.g. "libdvm.so", "libart.so".
optional string runtime = 5;
// whether kernel reports swapped pss.
optional bool has_swapped_pss = 6;
// Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
enum Status {
STATUS_UNKNOWN = 0;
STATUS_COMPLETE = 1;
STATUS_PARTIAL = 2;
STATUS_SHUTDOWN = 3;
STATUS_SYSPROPS = 4;
}
repeated Status status = 7;
// Stats for each process.
repeated ProcessStatsProto process_stats = 8;
}
// Next Tag: 6
message ProcessStatsProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
// Name of process.
optional string process = 1;
// Uid of the process.
optional int32 uid = 2;
// Information about how often kills occurred
message Kill {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
// Count of excessive CPU kills
optional int32 cpu = 1;
// Count of kills when cached
optional int32 cached = 2;
// PSS stats during cached kill
optional android.util.AggStats cached_pss = 3;
}
optional Kill kill = 3;
message State {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
enum ScreenState {
SCREEN_UNKNOWN = 0;
OFF = 1;
ON = 2;
}
optional ScreenState screen_state = 1;
enum MemoryState {
MEMORY_UNKNOWN = 0;
NORMAL = 1; // normal.
MODERATE = 2; // moderate memory pressure.
LOW = 3; // low memory.
CRITICAL = 4; // critical memory.
}
optional MemoryState memory_state = 2;
// this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
// and not frameworks/base/core/java/android/app/ActivityManager.java
enum ProcessState {
PROCESS_UNKNOWN = 0;
// Persistent system process.
PERSISTENT = 1;
// Top activity; actually any visible activity.
TOP = 2;
// Important foreground process (ime, wallpaper, etc).
IMPORTANT_FOREGROUND = 3;
// Important background process.
IMPORTANT_BACKGROUND = 4;
// Performing backup operation.
BACKUP = 5;
// Background process running a service.
SERVICE = 6;
// Process not running, but would be if there was enough RAM.
SERVICE_RESTARTING = 7;
// Process running a receiver.
RECEIVER = 8;
// Heavy-weight process (currently not used).
HEAVY_WEIGHT = 9;
// Process hosting home/launcher app when not on top.
HOME = 10;
// Process hosting the last app the user was in.
LAST_ACTIVITY = 11;
// Cached process hosting a previous activity.
CACHED_ACTIVITY = 12;
// Cached process hosting a client activity.
CACHED_ACTIVITY_CLIENT = 13;
// Cached process that is empty.
CACHED_EMPTY = 14;
}
optional ProcessState process_state = 3;
// Millisecond duration spent in this state
optional int64 duration_ms = 4;
// # of samples taken
optional int32 sample_size = 5;
// PSS is memory reserved for this process
optional android.util.AggStats pss = 6;
// USS is memory shared between processes, divided evenly for accounting
optional android.util.AggStats uss = 7;
}
repeated State states = 5;
}