summaryrefslogtreecommitdiff
path: root/perfprofd/perf_profile.proto
blob: 2f60e1285187c3f12046395db39c82950a11d21f (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

syntax = "proto2";

option java_package = "com.google.common.logging";

option optimize_for = LITE_RUNTIME;

package wireless_android_play_playlog;

// An entry of the map from a stack of addresses to count.
// Address here is the offset of the instruction address to the load address
// of the load_module.
message AddressSample {
  // List of addresses that represents a call stack.
  // address[0] is the leaf of the call stack.
  repeated uint64 address = 1;

  // List of load_module_ids that represents a call stack.
  // load_module_id[0] is the leaf of the call stack.
  // This field can be set as empty if all frame share the same load_module_id
  // with LoadModuleSamples.load_module_id.
  repeated int32 load_module_id = 2;

  // Total count that the address/address_range is sampled.
  optional int64 count = 3;
};

// An entry of the map from address_range to count.
// [start, end] represents the range of addresses, end->to represents the
// taken branch that ends the range.
message RangeSample {
  // Start instruction address of a range.
  optional uint64 start = 1;

  // If "end" and "to" is not provided, "start" represents a single instruction.
  optional uint64 end = 2;
  optional uint64 to = 3;

  // Total count that the address/address_range is sampled.
  optional int64 count = 4;
};

// A load module.
message LoadModule {
  // Name of the load_module.
  optional string name = 1;

  // LoadModule's linker build_id.
  optional string build_id = 2;
}

// All samples for a load_module.
message LoadModuleSamples {
  optional int32 load_module_id = 1;

  // Map from a stack of addresses to count.
  repeated AddressSample address_samples = 2;

  // Map from a range triplet (start, end, to) to count.
  repeated RangeSample range_samples = 3;
}

// All samples for a program.
message ProgramSamples {
  // Name of the program.
  optional string name = 1;

  // Load module profiles.
  repeated LoadModuleSamples modules = 2;
}

// A compressed representation of a perf profile, which contains samples from
// multiple binaries.
message AndroidPerfProfile {

  // Type of the hardware event.
  enum EventType {
    CYCLE = 0;
    BRANCH = 1;
  }
  // Hardware event used in profiling.
  optional EventType event = 1;

  // Total number of samples in this profile.
  // This is the sum of counts of address_samples and range_samples in all
  // load_module_samples.
  optional int64 total_samples = 2;

  // Samples for all profiled programs.
  repeated ProgramSamples programs = 3;

  // List of all load modules.
  repeated LoadModule load_modules = 4;

  // is device screen on at point when profile is collected?
  optional bool display_on = 5;

  // system load at point when profile is collected; corresponds
  // to first value from /proc/loadavg multiplied by 100 then
  // converted to int32
  optional int32 sys_load_average = 6;

  // At the point when the profile was collected, was a camera active?
  optional bool camera_active = 7;

  // At the point when the profile was collected, was the device still booting?
  optional bool booting = 8;

  // At the point when the profile was collected, was the device plugged into
  // a charger?
  optional bool on_charger = 9;

  // CPU utilization measured prior to profile collection (expressed as
  // 100 minus the idle percentage).
  optional int32 cpu_utilization = 10;

}