Нема описа

profile.proto 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. // Copyright (c) 2016, Google Inc.
  2. // All rights reserved.
  3. //
  4. ////////////////////////////////////////////////////////////////////////////////
  5. // Profile is a common stacktrace profile format.
  6. //
  7. // Measurements represented with this format should follow the
  8. // following conventions:
  9. //
  10. // - Consumers should treat unset optional fields as if they had been
  11. // set with their default value.
  12. //
  13. // - When possible, measurements should be stored in "unsampled" form
  14. // that is most useful to humans. There should be enough
  15. // information present to determine the original sampled values.
  16. //
  17. // - On-disk, the serialized proto must be gzip-compressed.
  18. //
  19. // - The profile is represented as a set of samples, where each sample
  20. // references a sequence of locations, and where each location belongs
  21. // to a mapping.
  22. // - There is a N->1 relationship from sample.location_id entries to
  23. // locations. For every sample.location_id entry there must be a
  24. // unique Location with that id.
  25. // - There is an optional N->1 relationship from locations to
  26. // mappings. For every nonzero Location.mapping_id there must be a
  27. // unique Mapping with that id.
  28. syntax = "proto3";
  29. package perftools.profiles;
  30. option java_package = "com.google.perftools.profiles";
  31. option java_outer_classname = "ProfileProto";
  32. message Profile {
  33. // A description of the samples associated with each Sample.value.
  34. // For a cpu profile this might be:
  35. // [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]]
  36. // For a heap profile, this might be:
  37. // [["allocations","count"], ["space","bytes"]],
  38. // If one of the values represents the number of events represented
  39. // by the sample, by convention it should be at index 0 and use
  40. // sample_type.unit == "count".
  41. repeated ValueType sample_type = 1;
  42. // The set of samples recorded in this profile.
  43. repeated Sample sample = 2;
  44. // Mapping from address ranges to the image/binary/library mapped
  45. // into that address range. mapping[0] will be the main binary.
  46. repeated Mapping mapping = 3;
  47. // Useful program location
  48. repeated Location location = 4;
  49. // Functions referenced by locations
  50. repeated Function function = 5;
  51. // A common table for strings referenced by various messages.
  52. // string_table[0] must always be "".
  53. repeated string string_table = 6;
  54. // frames with Function.function_name fully matching the following
  55. // regexp will be dropped from the samples, along with their successors.
  56. int64 drop_frames = 7; // Index into string table.
  57. // frames with Function.function_name fully matching the following
  58. // regexp will be kept, even if it matches drop_functions.
  59. int64 keep_frames = 8; // Index into string table.
  60. // The following fields are informational, do not affect
  61. // interpretation of results.
  62. // Time of collection (UTC) represented as nanoseconds past the epoch.
  63. int64 time_nanos = 9;
  64. // Duration of the profile, if a duration makes sense.
  65. int64 duration_nanos = 10;
  66. // The kind of events between sampled ocurrences.
  67. // e.g [ "cpu","cycles" ] or [ "heap","bytes" ]
  68. ValueType period_type = 11;
  69. // The number of events between sampled occurrences.
  70. int64 period = 12;
  71. // Freeform text associated to the profile.
  72. repeated int64 comment = 13; // Indices into string table.
  73. // Index into the string table of the type of the preferred sample
  74. // value. If unset, clients should default to the last sample value.
  75. int64 default_sample_type = 14;
  76. }
  77. // ValueType describes the semantics and measurement units of a value.
  78. message ValueType {
  79. int64 type = 1; // Index into string table.
  80. int64 unit = 2; // Index into string table.
  81. }
  82. // Each Sample records values encountered in some program
  83. // context. The program context is typically a stack trace, perhaps
  84. // augmented with auxiliary information like the thread-id, some
  85. // indicator of a higher level request being handled etc.
  86. message Sample {
  87. // The ids recorded here correspond to a Profile.location.id.
  88. // The leaf is at location_id[0].
  89. repeated uint64 location_id = 1;
  90. // The type and unit of each value is defined by the corresponding
  91. // entry in Profile.sample_type. All samples must have the same
  92. // number of values, the same as the length of Profile.sample_type.
  93. // When aggregating multiple samples into a single sample, the
  94. // result has a list of values that is the elemntwise sum of the
  95. // lists of the originals.
  96. repeated int64 value = 2;
  97. // label includes additional context for this sample. It can include
  98. // things like a thread id, allocation size, etc
  99. repeated Label label = 3;
  100. }
  101. message Label {
  102. int64 key = 1; // Index into string table
  103. // At most one of the following must be present
  104. int64 str = 2; // Index into string table
  105. int64 num = 3;
  106. // Should only be present when num is present.
  107. // Specifies the units of num.
  108. // Use arbitrary string (for example, "requests") as a custom count unit.
  109. // If no unit is specified, consumer may apply heuristic to deduce the unit.
  110. // Consumers may also interpret units like "bytes" and "kilobytes" as memory
  111. // units and units like "seconds" and "nanoseconds" as time units,
  112. // and apply appropriate unit conversions to these.
  113. int64 num_unit = 4; // Index into string table
  114. }
  115. message Mapping {
  116. // Unique nonzero id for the mapping.
  117. uint64 id = 1;
  118. // Address at which the binary (or DLL) is loaded into memory.
  119. uint64 memory_start = 2;
  120. // The limit of the address range occupied by this mapping.
  121. uint64 memory_limit = 3;
  122. // Offset in the binary that corresponds to the first mapped address.
  123. uint64 file_offset = 4;
  124. // The object this entry is loaded from. This can be a filename on
  125. // disk for the main binary and shared libraries, or virtual
  126. // abstractions like "[vdso]".
  127. int64 filename = 5; // Index into string table
  128. // A string that uniquely identifies a particular program version
  129. // with high probability. E.g., for binaries generated by GNU tools,
  130. // it could be the contents of the .note.gnu.build-id field.
  131. int64 build_id = 6; // Index into string table
  132. // The following fields indicate the resolution of symbolic info.
  133. bool has_functions = 7;
  134. bool has_filenames = 8;
  135. bool has_line_numbers = 9;
  136. bool has_inline_frames = 10;
  137. }
  138. // Describes function and line table debug information.
  139. message Location {
  140. // Unique nonzero id for the location. A profile could use
  141. // instruction addresses or any integer sequence as ids.
  142. uint64 id = 1;
  143. // The id of the corresponding profile.Mapping for this location.
  144. // It can be unset if the mapping is unknown or not applicable for
  145. // this profile type.
  146. uint64 mapping_id = 2;
  147. // The instruction address for this location, if available. It
  148. // should be within [Mapping.memory_start...Mapping.memory_limit]
  149. // for the corresponding mapping. A non-leaf address may be in the
  150. // middle of a call instruction. It is up to display tools to find
  151. // the beginning of the instruction if necessary.
  152. uint64 address = 3;
  153. // Multiple line indicates this location has inlined functions,
  154. // where the last entry represents the caller into which the
  155. // preceding entries were inlined.
  156. //
  157. // E.g., if memcpy() is inlined into printf:
  158. // line[0].function_name == "memcpy"
  159. // line[1].function_name == "printf"
  160. repeated Line line = 4;
  161. // Provides an indication that multiple symbols map to this location's
  162. // address, for example due to identical code folding by the linker. In that
  163. // case the line information above represents one of the multiple
  164. // symbols. This field must be recomputed when the symbolization state of the
  165. // profile changes.
  166. bool is_folded = 5;
  167. }
  168. message Line {
  169. // The id of the corresponding profile.Function for this line.
  170. uint64 function_id = 1;
  171. // Line number in source code.
  172. int64 line = 2;
  173. }
  174. message Function {
  175. // Unique nonzero id for the function.
  176. uint64 id = 1;
  177. // Name of the function, in human-readable form if available.
  178. int64 name = 2; // Index into string table
  179. // Name of the function, as identified by the system.
  180. // For instance, it can be a C++ mangled name.
  181. int64 system_name = 3; // Index into string table
  182. // Source file containing the function.
  183. int64 filename = 4; // Index into string table
  184. // Line number in source file.
  185. int64 start_line = 5;
  186. }