call_stack_profile_params.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright 2016 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. #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_
  5. #define COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_
  6. namespace metrics {
  7. // Parameters to pass back to the metrics provider.
  8. struct CallStackProfileParams {
  9. // The process in which the collection occurred.
  10. enum class Process {
  11. kUnknown,
  12. kBrowser,
  13. kRenderer,
  14. kGpu,
  15. kUtility,
  16. kZygote,
  17. kSandboxHelper,
  18. kPpapiPlugin,
  19. kNetworkService,
  20. kMax = kNetworkService,
  21. };
  22. // The thread from which the collection occurred.
  23. enum class Thread {
  24. kUnknown,
  25. // Each process has a 'main thread'. In the Browser process, the 'main
  26. // thread' is also often called the 'UI thread'.
  27. kMain,
  28. kIo,
  29. // Compositor thread (can be in both renderer and gpu processes).
  30. kCompositor,
  31. // Service worker thread.
  32. kServiceWorker,
  33. kMax = kServiceWorker,
  34. };
  35. // The event that triggered the profile collection.
  36. enum class Trigger {
  37. kUnknown,
  38. kProcessStartup,
  39. kJankyTask,
  40. kThreadHung,
  41. kPeriodicCollection,
  42. kPeriodicHeapCollection,
  43. kLast = kPeriodicHeapCollection
  44. };
  45. // The default constructor is required for mojo and should not be used
  46. // otherwise. A valid trigger should always be specified.
  47. constexpr CallStackProfileParams()
  48. : CallStackProfileParams(Process::kUnknown,
  49. Thread::kUnknown,
  50. Trigger::kUnknown) {}
  51. constexpr CallStackProfileParams(Process process,
  52. Thread thread,
  53. Trigger trigger)
  54. : process(process), thread(thread), trigger(trigger) {}
  55. // The collection process.
  56. Process process;
  57. // The collection thread.
  58. Thread thread;
  59. // The triggering event.
  60. Trigger trigger;
  61. };
  62. } // namespace metrics
  63. #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_