| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 1 | // 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 | |
| 11 | syntax = "proto2"; |
| 12 | option optimize_for = LITE_RUNTIME; |
| 13 | package simpleperf_report_proto; |
| Yabin Cui | 35df863 | 2016-07-19 17:15:12 -0700 | [diff] [blame] | 14 | option java_package = "com.android.tools.profiler.proto"; |
| 15 | option java_outer_classname = "SimpleperfReport"; |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 16 | |
| 17 | message Sample { |
| Yabin Cui | 07ee941 | 2017-05-02 13:25:21 -0700 | [diff] [blame^] | 18 | // Wall clock time for current sample. |
| 19 | // By default, it is perf clock used in kernel. |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 20 | optional uint64 time = 1; |
| Yabin Cui | 16501ff | 2016-10-19 15:06:29 -0700 | [diff] [blame] | 21 | optional int32 thread_id = 2; |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 22 | |
| 23 | message CallChainEntry { |
| Yabin Cui | 16501ff | 2016-10-19 15:06:29 -0700 | [diff] [blame] | 24 | // 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 Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| Yabin Cui | 16501ff | 2016-10-19 15:06:29 -0700 | [diff] [blame] | 36 | repeated CallChainEntry callchain = 3; |
| Yabin Cui | 07ee941 | 2017-05-02 13:25:21 -0700 | [diff] [blame^] | 37 | |
| 38 | // Count of the events that have happened since last sample (regardless of |
| 39 | // whether the last sample is lost). The event type is decided by '-e' option |
| 40 | // in simpleperf record command. By default, '-e cpu-cycles' is used, and this |
| 41 | // field is the number of cpu cycles. |
| 42 | optional uint64 event_count = 4; |
| 43 | |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| Yabin Cui | 587fb9b | 2016-07-26 19:49:15 -0700 | [diff] [blame] | 46 | message LostSituation { |
| 47 | optional uint64 sample_count = 1; |
| 48 | optional uint64 lost_count = 2; |
| 49 | } |
| 50 | |
| Yabin Cui | 16501ff | 2016-10-19 15:06:29 -0700 | [diff] [blame] | 51 | message File { |
| 52 | // unique id for each file, starting from 0, and add 1 each time. |
| 53 | optional uint32 id = 1; |
| 54 | |
| 55 | // file path, like /system/lib/libc.so. |
| 56 | optional string path = 2; |
| 57 | |
| 58 | // symbol table of the file. |
| 59 | repeated string symbol = 3; |
| 60 | } |
| 61 | |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 62 | message Record { |
| Yabin Cui | 16501ff | 2016-10-19 15:06:29 -0700 | [diff] [blame] | 63 | oneof record_data { |
| 64 | Sample sample = 1; |
| 65 | LostSituation lost = 2; |
| 66 | File file = 3; |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 67 | } |
| Yabin Cui | 42c8dc6 | 2016-06-03 15:06:53 -0700 | [diff] [blame] | 68 | } |