blob: 5d4c3ac9529710f97f56b0a803943374057b3d3a [file] [log] [blame]
Yabin Cui42c8dc62016-06-03 15:06:53 -07001// The file format generated by report_sample.proto is as below:
2// LittleEndian32(record_size_0)
3// message Record(record_0) (having record_size_0 bytes)
4// LittleEndian32(record_size_1)
5// message Record(record_1) (having record_size_1 bytes)
6// ...
7// LittleEndian32(record_size_N)
8// message Record(record_N) (having record_size_N bytes)
9// LittleEndian32(0)
10
11syntax = "proto2";
12option optimize_for = LITE_RUNTIME;
13package simpleperf_report_proto;
Yabin Cui35df8632016-07-19 17:15:12 -070014option java_package = "com.android.tools.profiler.proto";
15option java_outer_classname = "SimpleperfReport";
Yabin Cui42c8dc62016-06-03 15:06:53 -070016
17message Sample {
Yabin Cui07ee9412017-05-02 13:25:21 -070018 // Wall clock time for current sample.
19 // By default, it is perf clock used in kernel.
Yabin Cui42c8dc62016-06-03 15:06:53 -070020 optional uint64 time = 1;
Yabin Cui16501ff2016-10-19 15:06:29 -070021 optional int32 thread_id = 2;
Yabin Cui42c8dc62016-06-03 15:06:53 -070022
23 message CallChainEntry {
Yabin Cui16501ff2016-10-19 15:06:29 -070024 // virtual address of the instruction in elf file
25 optional uint64 vaddr_in_file = 1;
26
27 // index of the elf file containing the instruction
28 optional uint32 file_id = 2;
29
30 // symbol_id refers to the name of the function containing the instruction.
31 // If the function name is found, it is a valid index in the symbol table
32 // of File with 'id' field being file_id, otherwise it is -1.
33 optional int32 symbol_id = 3;
Yabin Cui42c8dc62016-06-03 15:06:53 -070034 }
35
Yabin Cui16501ff2016-10-19 15:06:29 -070036 repeated CallChainEntry callchain = 3;
Yabin Cui07ee9412017-05-02 13:25:21 -070037
Yabin Cui20663f52017-07-31 15:08:27 -070038 // Simpleperf generates one sample whenever a specified amount of events happen
39 // while running a monitored thread. So each sample belongs to one event type.
40 // Event type can be cpu-cycles, cpu-clock, sched:sched_switch or other types.
41 // By using '-e' option, we can ask simpleperf to record samples for one or more
42 // event types.
43 // Each event type generates samples independently. But recording more event types
44 // will cost more cpu time generating samples, which may affect the monitored threads
45 // and sample lost rate.
46 // event_count field shows the count of the events (belong to the sample's event type)
47 // that have happened since last sample (belong to the sample's event type) for the
48 // same thread. However, if there are lost samples between current sample and previous
49 // sample, the event_count is the count of events from the last lost sample.
Yabin Cui07ee9412017-05-02 13:25:21 -070050 optional uint64 event_count = 4;
51
Yabin Cui20663f52017-07-31 15:08:27 -070052 // An index in meta_info.event_type, shows which event type current sample belongs to.
53 optional uint32 event_type_id = 5;
Yabin Cui42c8dc62016-06-03 15:06:53 -070054}
55
Yabin Cui587fb9b2016-07-26 19:49:15 -070056message LostSituation {
57 optional uint64 sample_count = 1;
58 optional uint64 lost_count = 2;
59}
60
Yabin Cui16501ff2016-10-19 15:06:29 -070061message File {
62 // unique id for each file, starting from 0, and add 1 each time.
63 optional uint32 id = 1;
64
65 // file path, like /system/lib/libc.so.
66 optional string path = 2;
67
68 // symbol table of the file.
69 repeated string symbol = 3;
70}
71
Yabin Cui52190a32017-06-02 14:47:33 -070072message Thread {
73 optional uint32 thread_id = 1;
74 optional uint32 process_id = 2;
75 optional string thread_name = 3;
76}
77
Yabin Cui20663f52017-07-31 15:08:27 -070078message MetaInfo {
Amaury Medeiros22773682017-09-27 13:28:53 +010079 repeated string event_type = 1;
Yabin Cui20663f52017-07-31 15:08:27 -070080}
81
Yabin Cui42c8dc62016-06-03 15:06:53 -070082message Record {
Yabin Cui16501ff2016-10-19 15:06:29 -070083 oneof record_data {
84 Sample sample = 1;
85 LostSituation lost = 2;
86 File file = 3;
Yabin Cui52190a32017-06-02 14:47:33 -070087 Thread thread = 4;
Yabin Cui20663f52017-07-31 15:08:27 -070088 MetaInfo meta_info = 5;
Yabin Cui42c8dc62016-06-03 15:06:53 -070089 }
Yabin Cui42c8dc62016-06-03 15:06:53 -070090}