Support heap profiles in ReceiveSerializedProfile

* Adds a ProfilerType (heap, cpu) to the CallStackProfileCollector
  mojom. This is derived from the `trigger_event` of the serialized
  SampledProfile, allowing the receiver to make decisions based on the
  profile type without the overhead of parsing the profile.
* Handles the heap profile case in ReceiveSerializedProfile.
* Add heap profile tests to the CallStackProfileCollector and
  ChildCallStackProfileCollector unit tests.

A followup patch will enable heap profiling in child processes, which
will cause heap profiles to be passed to ReceiveSerializedProfile.

Bug: 1327069
Change-Id: I4eecfd23163432dd8a7e3567ad137d5e858e50a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3686242
Auto-Submit: Joe Mason <joenotcharles@google.com>
Commit-Queue: Joe Mason <joenotcharles@google.com>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Mike Wittman <wittman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013659}
NOKEYCHECK=True
GitOrigin-RevId: 92bf665b6721340bd0349becf6b58251dcd298de
10 files changed
tree: b93959d1a8da91626b1c0253c088d7964824cac3
  1. android/
  2. content/
  3. demographics/
  4. library_support/
  5. net/
  6. public/
  7. serialization/
  8. structured/
  9. system_session_analyzer/
  10. test/
  11. ui/
  12. android_metrics_provider.cc
  13. android_metrics_provider.h
  14. android_metrics_provider_unittest.cc
  15. BUILD.gn
  16. call_stack_profile_builder.cc
  17. call_stack_profile_builder.h
  18. call_stack_profile_builder_unittest.cc
  19. call_stack_profile_collector.cc
  20. call_stack_profile_collector.h
  21. call_stack_profile_encoding.cc
  22. call_stack_profile_encoding.h
  23. call_stack_profile_metadata.cc
  24. call_stack_profile_metadata.h
  25. call_stack_profile_metadata_unittest.cc
  26. call_stack_profile_metrics_provider.cc
  27. call_stack_profile_metrics_provider.h
  28. call_stack_profile_metrics_provider_unittest.cc
  29. call_stack_profile_params.h
  30. child_call_stack_profile_collector.cc
  31. child_call_stack_profile_collector.h
  32. child_call_stack_profile_collector_unittest.cc
  33. clean_exit_beacon.cc
  34. clean_exit_beacon.h
  35. clean_exit_beacon_ios.mm
  36. clean_exit_beacon_unittest.cc
  37. client_info.cc
  38. client_info.h
  39. cloned_install_detector.cc
  40. cloned_install_detector.h
  41. cloned_install_detector_unittest.cc
  42. component_metrics_provider.cc
  43. component_metrics_provider.h
  44. component_metrics_provider_unittest.cc
  45. cpu_metrics_provider.cc
  46. cpu_metrics_provider.h
  47. daily_event.cc
  48. daily_event.h
  49. daily_event_unittest.cc
  50. data_use_tracker.cc
  51. data_use_tracker.h
  52. data_use_tracker_unittest.cc
  53. date_changed_helper.cc
  54. date_changed_helper.h
  55. date_changed_helper_unittest.cc
  56. delegating_provider.cc
  57. delegating_provider.h
  58. DEPS
  59. DIR_METADATA
  60. drive_metrics_provider.cc
  61. drive_metrics_provider.h
  62. drive_metrics_provider_android.cc
  63. drive_metrics_provider_fuchsia.cc
  64. drive_metrics_provider_ios.mm
  65. drive_metrics_provider_linux.cc
  66. drive_metrics_provider_mac.mm
  67. drive_metrics_provider_unittest.cc
  68. drive_metrics_provider_win.cc
  69. enabled_state_provider.cc
  70. enabled_state_provider.h
  71. entropy_state.cc
  72. entropy_state.h
  73. entropy_state_provider.cc
  74. entropy_state_provider.h
  75. entropy_state_provider_unittest.cc
  76. entropy_state_unittest.cc
  77. environment_recorder.cc
  78. environment_recorder.h
  79. environment_recorder_unittest.cc
  80. expired_histogram_util.cc
  81. expired_histogram_util.h
  82. expired_histograms_checker.cc
  83. expired_histograms_checker.h
  84. expired_histograms_checker_unittest.cc
  85. field_trials_provider.cc
  86. field_trials_provider.h
  87. field_trials_provider_unittest.cc
  88. file_metrics_provider.cc
  89. file_metrics_provider.h
  90. file_metrics_provider_unittest.cc
  91. form_factor_metrics_provider.cc
  92. form_factor_metrics_provider.h
  93. form_factor_metrics_provider_unittest.cc
  94. generate_expired_histograms_array.gni
  95. histogram_encoder.cc
  96. histogram_encoder.h
  97. histogram_encoder_unittest.cc
  98. log_decoder.cc
  99. log_decoder.h
  100. log_decoder_unittest.cc
  101. log_store.h
  102. machine_id_provider.h
  103. machine_id_provider_nonwin.cc
  104. machine_id_provider_nonwin_unittest.cc
  105. machine_id_provider_win.cc
  106. machine_id_provider_win_unittest.cc
  107. metrics_data_validation.cc
  108. metrics_data_validation.h
  109. metrics_data_validation_unittest.cc
  110. metrics_log.cc
  111. metrics_log.h
  112. metrics_log_manager.cc
  113. metrics_log_manager.h
  114. metrics_log_manager_unittest.cc
  115. metrics_log_store.cc
  116. metrics_log_store.h
  117. metrics_log_store_unittest.cc
  118. metrics_log_unittest.cc
  119. metrics_log_uploader.h
  120. metrics_pref_names.cc
  121. metrics_pref_names.h
  122. metrics_provider.cc
  123. metrics_provider.h
  124. metrics_reporting_default_state.cc
  125. metrics_reporting_default_state.h
  126. metrics_reporting_service.cc
  127. metrics_reporting_service.h
  128. metrics_rotation_scheduler.cc
  129. metrics_rotation_scheduler.h
  130. metrics_scheduler.cc
  131. metrics_scheduler.h
  132. metrics_service.cc
  133. metrics_service.h
  134. metrics_service_accessor.cc
  135. metrics_service_accessor.h
  136. metrics_service_client.cc
  137. metrics_service_client.h
  138. metrics_service_client_unittest.cc
  139. metrics_service_unittest.cc
  140. metrics_state_manager.cc
  141. metrics_state_manager.h
  142. metrics_state_manager_unittest.cc
  143. metrics_switches.cc
  144. metrics_switches.h
  145. metrics_upload_scheduler.cc
  146. metrics_upload_scheduler.h
  147. OWNERS
  148. persistent_histograms.cc
  149. persistent_histograms.h
  150. persistent_system_profile.cc
  151. persistent_system_profile.h
  152. persistent_system_profile_unittest.cc
  153. psi_memory_parser.h
  154. psi_memory_parser_linux.cc
  155. psi_memory_parser_linux_unittest.cc
  156. README
  157. reporting_service.cc
  158. reporting_service.h
  159. reporting_service_unittest.cc
  160. sampling_metrics_provider.cc
  161. sampling_metrics_provider.h
  162. single_sample_metrics.cc
  163. single_sample_metrics.h
  164. single_sample_metrics_factory_impl.cc
  165. single_sample_metrics_factory_impl.h
  166. single_sample_metrics_factory_impl_unittest.cc
  167. stability_metrics_helper.cc
  168. stability_metrics_helper.h
  169. stability_metrics_helper_unittest.cc
  170. stability_metrics_provider.cc
  171. stability_metrics_provider.h
  172. stability_metrics_provider_unittest.cc
  173. system_memory_stats_recorder.h
  174. system_memory_stats_recorder_linux.cc
  175. ukm_demographic_metrics_provider.h
  176. unsent_log_store.cc
  177. unsent_log_store.h
  178. unsent_log_store_metrics.cc
  179. unsent_log_store_metrics.h
  180. unsent_log_store_metrics_impl.cc
  181. unsent_log_store_metrics_impl.h
  182. unsent_log_store_metrics_impl_unittest.cc
  183. unsent_log_store_unittest.cc
  184. url_constants.cc
  185. url_constants.h
  186. version_utils.cc
  187. version_utils.h