• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// The file format generated by report_sample.proto is as below:
2// char magic[10] = "SIMPLEPERF";
3// LittleEndian16(version) = 1;
4// LittleEndian32(record_size_0)
5// message Record(record_0) (having record_size_0 bytes)
6// LittleEndian32(record_size_1)
7// message Record(record_1) (having record_size_1 bytes)
8// ...
9// LittleEndian32(record_size_N)
10// message Record(record_N) (having record_size_N bytes)
11// LittleEndian32(0)
12
13syntax = "proto2";
14option optimize_for = LITE_RUNTIME;
15package simpleperf_report_proto;
16option java_package = "com.android.tools.profiler.proto";
17option java_outer_classname = "SimpleperfReport";
18
19message Sample {
20  // Wall clock time for current sample.
21  // By default, it is perf clock used in kernel.
22  optional uint64 time = 1;
23  optional int32 thread_id = 2;
24
25  message CallChainEntry {
26    // virtual address of the instruction in elf file
27    optional uint64 vaddr_in_file = 1;
28
29    // index of the elf file containing the instruction
30    optional uint32 file_id = 2;
31
32    // symbol_id refers to the name of the function containing the instruction.
33    // If the function name is found, it is a valid index in the symbol table
34    // of File with 'id' field being file_id, otherwise it is -1.
35    optional int32 symbol_id = 3;
36  }
37
38  repeated CallChainEntry callchain = 3;
39
40  // Simpleperf generates one sample whenever a specified amount of events happen
41  // while running a monitored thread. So each sample belongs to one event type.
42  // Event type can be cpu-cycles, cpu-clock, sched:sched_switch or other types.
43  // By using '-e' option, we can ask simpleperf to record samples for one or more
44  // event types.
45  // Each event type generates samples independently. But recording more event types
46  // will cost more cpu time generating samples, which may affect the monitored threads
47  // and sample lost rate.
48  // event_count field shows the count of the events (belong to the sample's event type)
49  // that have happened since last sample (belong to the sample's event type) for the
50  // same thread. However, if there are lost samples between current sample and previous
51  // sample, the event_count is the count of events from the last lost sample.
52  optional uint64 event_count = 4;
53
54  // An index in meta_info.event_type, shows which event type current sample belongs to.
55  optional uint32 event_type_id = 5;
56}
57
58message LostSituation {
59  optional uint64 sample_count = 1;
60  optional uint64 lost_count = 2;
61}
62
63message File {
64  // unique id for each file, starting from 0, and add 1 each time.
65  optional uint32 id = 1;
66
67  // file path, like /system/lib/libc.so.
68  optional string path = 2;
69
70  // symbol table of the file.
71  repeated string symbol = 3;
72
73  // mangled symbol table of the file.
74  repeated string mangled_symbol = 4;
75}
76
77message Thread {
78  optional uint32 thread_id = 1;
79  optional uint32 process_id = 2;
80  optional string thread_name = 3;
81}
82
83message MetaInfo {
84  repeated string event_type = 1;
85  optional string app_package_name = 2;
86}
87
88message Record {
89  oneof record_data {
90    Sample sample = 1;
91    LostSituation lost = 2;
92    File file = 3;
93    Thread thread = 4;
94    MetaInfo meta_info = 5;
95  }
96}