1 // Copyright 2020 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/trace_event/trace_id_helper.h" 6 #include "base/atomic_sequence_num.h" 7 #include "base/rand_util.h" 8 9 namespace base { 10 namespace trace_event { 11 GetNextGlobalTraceId()12uint64_t GetNextGlobalTraceId() { 13 static const uint64_t kPerProcessRandomValue = base::RandUint64(); 14 static base::AtomicSequenceNumber counter; 15 return kPerProcessRandomValue ^ static_cast<uint64_t>(counter.GetNext()); 16 } 17 18 } // namespace trace_event 19 } // namespace base 20