1/* 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 17syntax = "proto2"; 18 19package android.os; 20 21option java_multiple_files = true; 22 23import "frameworks/base/core/proto/android/privacy.proto"; 24 25message PsProto { 26 option (android.msg_privacy).dest = DEST_AUTOMATIC; 27 28 message Process { 29 option (android.msg_privacy).dest = DEST_AUTOMATIC; 30 31 // Security label, most commonly used for SELinux context data. 32 optional string label = 1; 33 // String representation of uid. 34 optional string user = 2; 35 // Process ID number. 36 optional int32 pid = 3; 37 // The unique number representing a dispatchable entity (alias lwp, 38 // spid). This value may also appear as: a process ID (pid); a process 39 // group ID (pgrp); a session ID for the session leader (sid); a thread 40 // group ID for the thread group leader (tgid); and a tty process group 41 // ID for the process group leader (tpgid). 42 optional int32 tid = 4; 43 // Parent process ID. 44 optional int32 ppid = 5; 45 // Virtual set size (memory size) of the process, in KiB. 46 optional int32 vsz = 6; 47 // Resident set size. How many physical pages are associated with the 48 // process; real memory usage, in KiB. 49 optional int32 rss = 7; 50 // Name of the kernel function in which the process is sleeping, a "-" 51 // if the process is running, or a "*" if the process is multi-threaded 52 // and ps is not displaying threads. 53 optional string wchan = 8; 54 // Memory address of the process. 55 optional string addr = 9 [ (android.privacy).dest = DEST_LOCAL ]; 56 57 enum ProcessStateCode { 58 STATE_UNKNOWN = 0; 59 // Uninterruptible sleep (usually IO). 60 STATE_D = 1; 61 // Running or runnable (on run queue). 62 STATE_R = 2; 63 // Interruptible sleep (waiting for an event to complete). 64 STATE_S = 3; 65 // Stopped by job control signal. 66 STATE_T = 4; 67 // Stopped by debugger during the tracing. 68 STATE_TRACING = 5; 69 // Dead (should never be seen). 70 STATE_X = 6; 71 // Defunct ("zombie") process. Terminated but not reaped by its 72 // parent. 73 STATE_Z = 7; 74 } 75 // Minimal state display 76 optional ProcessStateCode s = 10; 77 // Priority of the process. Higher number means lower priority. 78 optional int32 pri = 11; 79 // Nice value. This ranges from 19 (nicest) to -20 (not nice to others). 80 optional sint32 ni = 12; 81 // Realtime priority. 82 optional string rtprio = 13; // Number or - 83 84 enum SchedulingPolicy { 85 option allow_alias = true; 86 87 // Regular names conflict with macros defined in 88 // bionic/libc/kernel/uapi/linux/sched.h. 89 SCH_OTHER = 0; 90 SCH_NORMAL = 0; 91 92 SCH_FIFO = 1; 93 SCH_RR = 2; 94 SCH_BATCH = 3; 95 SCH_ISO = 4; 96 SCH_IDLE = 5; 97 } 98 // Scheduling policy of the process. 99 optional SchedulingPolicy sch = 14; 100 101 // How Android memory manager will treat the task 102 enum Policy { 103 POLICY_UNKNOWN = 0; 104 // Foreground. 105 POLICY_FG = 1; 106 // Background. 107 POLICY_BG = 2; 108 POLICY_TA = 3; // TODO: figure out what this value is 109 } 110 optional Policy pcy = 15; 111 // Total CPU time, "[DD-]HH:MM:SS" format. 112 optional string time = 16; 113 // Command with all its arguments as a string. 114 optional string cmd = 17; 115 } 116 repeated Process processes = 1; 117} 118