summaryrefslogtreecommitdiff
path: root/simpleperf/report_sample.proto
blob: 5e1d8605a516f874b56528be5b74ddda48a61387 (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
// The file format generated by report_sample.proto is as below:
// LittleEndian32(record_size_0)
// message Record(record_0) (having record_size_0 bytes)
// LittleEndian32(record_size_1)
// message Record(record_1) (having record_size_1 bytes)
// ...
// LittleEndian32(record_size_N)
// message Record(record_N) (having record_size_N bytes)
// LittleEndian32(0)

syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package simpleperf_report_proto;
option java_package = "com.android.tools.profiler.proto";
option java_outer_classname = "SimpleperfReport";

message Sample {
  // Wall clock time for current sample.
  // By default, it is perf clock used in kernel.
  optional uint64 time = 1;
  optional int32 thread_id = 2;

  message CallChainEntry {
    // virtual address of the instruction in elf file
    optional uint64 vaddr_in_file = 1;

    // index of the elf file containing the instruction
    optional uint32 file_id = 2;

    // symbol_id refers to the name of the function containing the instruction.
    // If the function name is found, it is a valid index in the symbol table
    // of File with 'id' field being file_id, otherwise it is -1.
    optional int32 symbol_id = 3;
  }

  repeated CallChainEntry callchain = 3;

  // Count of the events that have happened since last sample (regardless of
  // whether the last sample is lost). The event type is decided by '-e' option
  // in simpleperf record command. By default, '-e cpu-cycles' is used, and this
  // field is the number of cpu cycles.
  optional uint64 event_count = 4;

}

message LostSituation {
  optional uint64 sample_count = 1;
  optional uint64 lost_count = 2;
}

message File {
  // unique id for each file, starting from 0, and add 1 each time.
  optional uint32 id = 1;

  // file path, like /system/lib/libc.so.
  optional string path = 2;

  // symbol table of the file.
  repeated string symbol = 3;
}

message Record {
  oneof record_data {
    Sample sample = 1;
    LostSituation lost = 2;
    File file = 3;
  }
}