call_stack_profile.proto 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. option optimize_for = LITE_RUNTIME;
  6. option java_package = "org.chromium.components.metrics";
  7. option java_outer_classname = "CallStackProfileProtos";
  8. package metrics;
  9. import "execution_context.proto";
  10. // Call stack sample data for a given profiling session.
  11. // Next tag: 11
  12. message CallStackProfile {
  13. // Uniquely identifies a module.
  14. message ModuleIdentifier {
  15. // A hash that uniquely identifies a particular program version with high
  16. // probability. This is parsed from headers of the loaded module.
  17. // For binaries generated by GNU tools:
  18. // Contents of the .note.gnu.build-id field.
  19. // On Windows:
  20. // GUID + AGE in the debug image headers of a module.
  21. optional string build_id = 1;
  22. // MD5Sum Prefix of the module name. This is the same hashing scheme as used
  23. // to hash UMA histogram names.
  24. optional fixed64 name_md5_prefix = 2;
  25. }
  26. // Describes a location within executable code.
  27. message Location {
  28. // Instruction pointer subtracted by module base.
  29. optional uint64 address = 1;
  30. // Index to the module identifier in |module_ids| of CallStackProfile.
  31. optional int32 module_id_index = 2;
  32. }
  33. // The sampled call stack.
  34. message Stack {
  35. // The frames in the callstack. The frame[0] entry represents the call on
  36. // the top of the stack.
  37. repeated Location frame = 1;
  38. }
  39. // An item of metadata associated with either the entire profile or a single
  40. // sample.
  41. message MetadataItem {
  42. // Index of the hash of the metadata name.
  43. optional int32 name_hash_index = 1;
  44. // Optional user-specified key value. Absent if unspecified.
  45. optional sint64 key = 3;
  46. // Value for the item. An absent value indicates the metadata has become
  47. // unset since the previous StackSample.
  48. optional sint64 value = 2;
  49. }
  50. // Backtrace of locations of async execution requests (e.g. task postings, IPC
  51. // message sending, requests over mojo) that led to the current task
  52. // execution. Note that these are saved in a fixed length buffer on the client
  53. // which as of 2018/08/14 includes only the most recent four entries.
  54. message AsyncBacktrace {
  55. // The locations saved in the backtrace, with the most recent in
  56. // location[0]. Empty if the work was not tied to an async execution request
  57. // -- for example, handling a mouse event.
  58. repeated Location location = 1;
  59. }
  60. // Deprecated version of a sample consisting of one or more callstacks with
  61. // the same stack frames and instruction pointers. Deprecated as of
  62. // 2018/08/14.
  63. message Sample {
  64. // The callstack. Sample.frame[0] represents the call on the top of the
  65. // stack.
  66. repeated Location frame = 1;
  67. // Number of times this stack signature occurs.
  68. optional int64 count = 2;
  69. // This repeating field indicates the current phase of the system such as
  70. // whether it is in startup, general operation, or shutdown. The first
  71. // Sample of a CallStackProfile will list all phases that have been reached;
  72. // later samples will list only the new phases that occurred since the
  73. // previous one.
  74. repeated ProcessPhase process_phase = 3;
  75. }
  76. // A sampled stack, along with associated metadata.
  77. message StackSample {
  78. // Index into the profile's repeated |stack| field for the stack
  79. // corresponding to this sample.
  80. optional int32 stack_index = 1;
  81. // Sample time relative to the first sample.
  82. optional int32 sample_time_offset_ms = 2;
  83. // True if this sample is executing the same item of work (task, event) as
  84. // the last sample.
  85. optional bool continued_work = 3;
  86. // Index of the backtrace in the profile of posted task locations that led
  87. // to this task execution.
  88. optional int32 async_backtrace_index = 4;
  89. // Metadata items associated with the sample. To minimize memory usage,
  90. // metadata items are specified only when their values change from the
  91. // previous sample. Items are not guaranteed to be in a particular order.
  92. repeated MetadataItem metadata = 5;
  93. // Weight of the sample. When omitted the sample is presumed to have
  94. // a weight of 1.
  95. // Not currently used for CPU profiles.
  96. // For heap profiles it represents the total number of bytes associated with
  97. // the StackSample record.
  98. optional int64 weight = 6;
  99. // Number of events associated with the sample. When omitted the default
  100. // value of 1 should be used.
  101. // Not currently used for CPU profiles.
  102. // For heap profiles it represents the number of allocations associated with
  103. // the StackSample record. The following relation holds:
  104. // allocation_size * count == weight.
  105. optional int64 count = 7 [default = 1];
  106. }
  107. // The previous sample encoding. Deprecated 2018/08/04 in favor of
  108. // stack_sample.
  109. repeated Sample DEPRECATED_sample = 1 [deprecated = true];
  110. // List of module ids found in this sample.
  111. repeated ModuleIdentifier module_id = 2;
  112. // Metadata name hashes used in this profile. Recorded global to the profile
  113. // to minimize per-sample memory usage.
  114. repeated fixed64 metadata_name_hash = 5;
  115. // Metadata global to the profile.
  116. repeated MetadataItem profile_metadata = 6;
  117. // The distinct async backtraces for the samples.
  118. repeated AsyncBacktrace async_backtrace = 7;
  119. // The distinct stacks for the samples.
  120. repeated Stack stack = 8;
  121. // The stack samples collected for this profile.
  122. repeated StackSample stack_sample = 9;
  123. // Time of the first sample relative to Chrome start. This value may be
  124. // imprecise or wrong for Windows clients without high-resolution
  125. // TimeTicks. TODO(wittman): Clarify the actual properties of this value for
  126. // clients without high-resolution TimeTicks once we understand what they are.
  127. optional int64 profile_start_time_offset_ms = 10;
  128. // Duration of this profile.
  129. optional int32 profile_duration_ms = 3;
  130. // Time between samples.
  131. optional int32 sampling_period_ms = 4;
  132. }