blob: bbe46fb27876acd5b4c547965c55caa36916a9df [file] [log] [blame]
Yabin Cui42c8dc62016-06-03 15:06:53 -07001// The file format generated by report_sample.proto is as below:
Yabin Cui17461212018-04-09 12:13:39 -07002// char magic[10] = "SIMPLEPERF";
3// LittleEndian16(version) = 1;
Yabin Cui42c8dc62016-06-03 15:06:53 -07004// 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;
Yabin Cui35df8632016-07-19 17:15:12 -070016option java_package = "com.android.tools.profiler.proto";
17option java_outer_classname = "SimpleperfReport";
Yabin Cui42c8dc62016-06-03 15:06:53 -070018
19message Sample {
Yabin Cui07ee9412017-05-02 13:25:21 -070020 // Wall clock time for current sample.
21 // By default, it is perf clock used in kernel.
Yabin Cui42c8dc62016-06-03 15:06:53 -070022 optional uint64 time = 1;
Yabin Cui16501ff2016-10-19 15:06:29 -070023 optional int32 thread_id = 2;
Yabin Cui42c8dc62016-06-03 15:06:53 -070024
25 message CallChainEntry {
Yabin Cui16501ff2016-10-19 15:06:29 -070026 // 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;
Yabin Cui42c8dc62016-06-03 15:06:53 -070036 }
37
Yabin Cui16501ff2016-10-19 15:06:29 -070038 repeated CallChainEntry callchain = 3;
Yabin Cui07ee9412017-05-02 13:25:21 -070039
Yabin Cui20663f52017-07-31 15:08:27 -070040 // 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.
Yabin Cui07ee9412017-05-02 13:25:21 -070052 optional uint64 event_count = 4;
53
Yabin Cui20663f52017-07-31 15:08:27 -070054 // An index in meta_info.event_type, shows which event type current sample belongs to.
55 optional uint32 event_type_id = 5;
Yabin Cui42c8dc62016-06-03 15:06:53 -070056}
57
Yabin Cui587fb9b2016-07-26 19:49:15 -070058message LostSituation {
59 optional uint64 sample_count = 1;
60 optional uint64 lost_count = 2;
61}
62
Yabin Cui16501ff2016-10-19 15:06:29 -070063message 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;
Yabin Cui66bade82018-04-18 15:10:59 -070072
73 // mangled symbol table of the file.
74 repeated string mangled_symbol = 4;
Yabin Cui16501ff2016-10-19 15:06:29 -070075}
76
Yabin Cui52190a32017-06-02 14:47:33 -070077message Thread {
78 optional uint32 thread_id = 1;
79 optional uint32 process_id = 2;
80 optional string thread_name = 3;
81}
82
Yabin Cui20663f52017-07-31 15:08:27 -070083message MetaInfo {
Amaury Medeiros22773682017-09-27 13:28:53 +010084 repeated string event_type = 1;
Yabin Cui0a599292018-04-10 17:05:30 -070085 optional string app_package_name = 2;
Yabin Cui20663f52017-07-31 15:08:27 -070086}
87
Yabin Cui42c8dc62016-06-03 15:06:53 -070088message Record {
Yabin Cui16501ff2016-10-19 15:06:29 -070089 oneof record_data {
90 Sample sample = 1;
91 LostSituation lost = 2;
92 File file = 3;
Yabin Cui52190a32017-06-02 14:47:33 -070093 Thread thread = 4;
Yabin Cui20663f52017-07-31 15:08:27 -070094 MetaInfo meta_info = 5;
Yabin Cui42c8dc62016-06-03 15:06:53 -070095 }
Yabin Cui42c8dc62016-06-03 15:06:53 -070096}