trace_id_helper.h 837 B

12345678910111213141516171819202122232425
  1. // Copyright 2020 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_TRACE_EVENT_TRACE_ID_HELPER_H_
  5. #define BASE_TRACE_EVENT_TRACE_ID_HELPER_H_
  6. #include <cstdint>
  7. #include "base/base_export.h"
  8. namespace base {
  9. namespace trace_event {
  10. // Returns an globally-unique id which can be used as a flow id or async event
  11. // id. This is fast (powered by an memory-order-relaxed atomic int), so use this
  12. // function instead of implementing your own counter and hashing it with a
  13. // random value. However, consider using TRACE_ID_LOCAL(this) to avoid storing
  14. // additional data if possible.
  15. BASE_EXPORT uint64_t GetNextGlobalTraceId();
  16. } // namespace trace_event
  17. } // namespace base
  18. #endif // BASE_TRACE_EVENT_TRACE_ID_HELPER_H_