user_metrics_action.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // Copyright 2014 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 BASE_METRICS_USER_METRICS_ACTION_H_
  5. #define BASE_METRICS_USER_METRICS_ACTION_H_
  6. namespace base {
  7. // UserMetricsAction exists purely to standardize on the parameters passed to
  8. // UserMetrics. That way, our toolset can scan the source code reliable for
  9. // constructors and extract the associated string constants.
  10. // WARNING: When using UserMetricsAction you should use a string literal
  11. // parameter e.g.
  12. // RecordAction(UserMetricsAction("my action name"));
  13. // This ensures that our processing scripts can associate this action's hash
  14. // with its metric name. Therefore, it will be possible to retrieve the metric
  15. // name from the hash later on.
  16. // Please see tools/metrics/actions/extract_actions.py for details.
  17. struct UserMetricsAction {
  18. const char* str_;
  19. explicit constexpr UserMetricsAction(const char* str) noexcept : str_(str) {}
  20. };
  21. } // namespace base
  22. #endif // BASE_METRICS_USER_METRICS_ACTION_H_