sapling/eden/fs/telemetry/SessionId.cpp
Stiopa Koltsov afddf66676 Move getSessionId to a separate file
Summary: Refactoring to make the following diff smaller.

Reviewed By: chadaustin

Differential Revision: D27522581

fbshipit-source-id: 8f858714fcbfe4b8f8b1c3678bb2003623abbd94
2021-04-02 11:36:13 -07:00

29 lines
542 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include "eden/fs/telemetry/SessionId.h"
#include <random>
namespace {
uint32_t generateSessionId() {
std::random_device rd;
std::uniform_int_distribution<uint32_t> u;
return u(rd);
}
} // namespace
namespace facebook::eden {
uint32_t getSessionId() {
static auto sessionId = generateSessionId();
return sessionId;
}
} // namespace facebook::eden