暫無描述

profile.proto 7.1KB

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