1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19

base / trace_event / trace_id_helper.cc [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/trace_event/trace_id_helper.h"
#include "base/atomic_sequence_num.h"
#include "base/rand_util.h"

namespace base {
namespace trace_event {

uint64_t GetNextGlobalTraceId() {
  static const uint64_t kPerProcessRandomValue = base::RandUint64();
  static base::AtomicSequenceNumber counter;
  return kPerProcessRandomValue ^ static_cast<uint64_t>(counter.GetNext());
}

}  // namespace trace_event
}  // namespace base