File: cpu_profiler_data.proto

package info (click to toggle)
android-platform-tools-base 2.2.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 113,928 kB
  • sloc: java: 696,396; xml: 45,920; cpp: 2,526; ansic: 1,432; sh: 508; lisp: 110; javascript: 108; makefile: 17
file content (90 lines) | stat: -rw-r--r-- 3,105 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2016 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 = "proto3";

package profiler.proto;
option java_package = "com.android.tools.profiler.proto";
option java_outer_classname = "Cpu";

import "profiler.proto";

// CPU data of a given app process.
message CpuProfilerData {
  ProfilerData basic_info = 1;
  oneof data {
    CpuUsageData cpu_usage = 2;
    ThreadActivities thread_activities = 3;
  }
}

// CPU usage data of an app process and the entire system at a given point.
//
// CPU usage data is most valuable when app data is combined with system data,
// e.g., showing the CPU usage percentage number. One data consumer (e.g., an
// Android Studio instance) would request an app's data, and another consumer
// (e.g., another Android Studio instance) would request another app's. Both of
// them need system data. Therefore, we put system data together with every
// piece of app specific data.
//
// The absolute values of fields in this message are not very interesting.
// The difference of two instances is more useful. It can show the system-
// wide CPU utilization percentage and an app's CPU utilization percentage.
// The values of the fields may overflow their type, but the usefulness stays
// the same.
message CpuUsageData {
  // Amount of time that this process has been using CPU, measured in
  // milliseconds.
  int64 app_cpu_time_in_millisec = 1;
  // Amount of time that the entire system (including applications) has been
  // using CPU, measured in milliseconds.
  int64 system_cpu_time_in_millisec = 2;
  // Amount of time since the system start, measured in milliseconds.
  int64 elapsed_time_in_millisec = 3;
}

// Thread activities, which is essentially changes in thread states.
message ThreadActivities {
  repeated TheadActivity activities = 1;
}

// A thread activity, which is essentially the change of a thread's state.
message TheadActivity {
  // TODO: Reduce the number of |State| values to exactly what we surface
  // to the user.
  enum State {
    UNSPECIFIED = 0;
    RUNNING = 1;
    SLEEPING = 2;
    WAITING = 3;
    ZOMBIE = 4;
    STOPPED = 5;
    TRACING = 6;
    PAGING = 7;
    DEAD = 8;
    WAKEKILL = 9;
    WAKING = 10;
    PARKED = 11;
  }
  int32 tid = 1;
  State new_state = 2;
  // Name of the thread.
  string name = 3;
  // Timestamp when the activity happens (or is detected).
  // Null means the timestamp of this activity is the same as the timestamp
  // as the |CpuProfilerData| message that includes this |TheadActivity|
  // message.
  int64 timestamp = 4;
}