1/* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18option optimize_for = LITE_RUNTIME; 19 20package perfetto.protos; 21 22message ProfilePacket { 23 // either a function or library name. 24 repeated InternedString strings = 1; 25 message InternedString { 26 optional uint64 id = 1; 27 optional bytes str = 2; 28 } 29 30 repeated Mapping mappings = 4; 31 message Mapping { 32 optional uint64 id = 1; // Interning key. 33 optional uint64 build_id = 2; // Interning key. 34 optional uint64 offset = 3; 35 optional uint64 start = 4; 36 optional uint64 end = 5; 37 optional uint64 load_bias = 6; 38 // E.g. ["system", "lib64", "libc.so"] 39 repeated uint64 path_string_ids = 7; // id of string. 40 } 41 42 repeated Frame frames = 2; 43 message Frame { 44 optional uint64 id = 1; // Interning key 45 // E.g. "fopen" 46 optional uint64 function_name_id = 2; // id of string. 47 optional uint64 mapping_id = 3; 48 optional uint64 rel_pc = 4; 49 } 50 51 repeated Callstack callstacks = 3; 52 message Callstack { 53 optional uint64 id = 1; 54 // Frames of this callstack. Bottom frame first. 55 repeated uint64 frame_ids = 2; 56 } 57 58 message HeapSample { 59 optional uint64 callstack_id = 1; 60 // bytes allocated at this frame. 61 optional uint64 self_allocated = 2; 62 // bytes allocated at this frame that have been freed. 63 optional uint64 self_freed = 3; 64 optional uint64 timestamp = 4; // timestamp [opt] 65 optional uint64 alloc_count = 5; 66 optional uint64 free_count = 6; 67 } 68 69 message Histogram { 70 message Bucket { 71 // This bucket counts values from the previous bucket's (or -infinity if 72 // this is the first bucket) upper_limit (inclusive) to this upper_limit 73 // (exclusive). 74 optional uint64 upper_limit = 1; 75 // This is the highest bucket. This is set instead of the upper_limit. Any 76 // values larger or equal to the previous bucket's upper_limit are counted 77 // in this bucket. 78 optional bool max_bucket = 2; 79 // Number of values that fall into this range. 80 optional uint64 count = 3; 81 } 82 repeated Bucket buckets = 1; 83 } 84 85 message ProcessStats { 86 optional uint64 unwinding_errors = 1; 87 optional uint64 heap_samples = 2; 88 optional uint64 map_reparses = 3; 89 optional Histogram unwinding_time_us = 4; 90 optional uint64 total_unwinding_time_us = 5; 91 } 92 93 repeated ProcessHeapSamples process_dumps = 5; 94 message ProcessHeapSamples { 95 optional uint64 pid = 1; 96 97 // This process was profiled from startup. 98 // If false, this process was already running when profiling started. 99 optional bool from_startup = 3; 100 101 // This process was not profiled because a concurrent session was active. 102 // If this is true, samples will be empty. 103 optional bool rejected_concurrent = 4; 104 105 // This process disconnected while it was profiled. 106 // If false, the process outlived the profiling session. 107 optional bool disconnected = 6; 108 109 // If disconnected, this disconnect was caused by the client overrunning 110 // the buffer. 111 optional bool buffer_overran = 7; 112 113 // If disconnected, this disconnected was caused by the shared memory 114 // buffer being corrupted. THIS IS ALWAYS A BUG IN HEAPPROFD OR CLIENT 115 // MEMORY CORRUPTION. 116 optional bool buffer_corrupted = 8; 117 118 // Timestamp of the state of the target process that this dump represents. 119 // This can be different to the timestamp of the TracePackets for various 120 // reasons: 121 // * If disconnected is set above, this is the timestamp of last state 122 // heapprofd had of the process before it disconnected. 123 // * Otherwise, if the rate of events produced by the process is high, 124 // heapprofd might be behind. 125 // 126 // TODO(fmayer): This is MONOTONIC_COARSE. Refactor ClockSnapshot::Clock 127 // to have a type enum that we can reuse here. 128 optional uint64 timestamp = 9; 129 130 optional ProcessStats stats = 5; 131 132 repeated HeapSample samples = 2; 133 } 134 135 optional bool continued = 6; 136 optional uint64 index = 7; 137} 138