mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
65c93484e2
Summary: Tracing was not an accurate name for what this directory had become. So rename it to telemetry. Reviewed By: wez Differential Revision: D17923303 fbshipit-source-id: fca07e8447d9b9b3ea5d860809a2d377e3c4f9f2
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
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 "Tracing.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
namespace detail {
|
|
Tracer globalTracer;
|
|
|
|
void ThreadLocalTracePoints::flush() {
|
|
auto points = globalTracer.tracepoints_.wlock();
|
|
auto state = state_.lock();
|
|
size_t npoints = std::min(kBufferPoints, state->currNum_);
|
|
points->insert(
|
|
points->end(),
|
|
state->tracePoints_.begin(),
|
|
state->tracePoints_.begin() + npoints);
|
|
state->currNum_ = 0;
|
|
}
|
|
|
|
folly::RequestToken tracingToken("eden_tracing");
|
|
|
|
std::vector<CompactTracePoint> Tracer::getAllTracepoints() {
|
|
for (auto& tltp : tltp_.accessAllThreads()) {
|
|
tltp.flush();
|
|
}
|
|
auto points = tracepoints_.wlock();
|
|
std::sort(points->begin(), points->end(), [](const auto& a, const auto& b) {
|
|
return a.timestamp < b.timestamp;
|
|
});
|
|
return std::move(*points);
|
|
}
|
|
} // namespace detail
|
|
} // namespace eden
|
|
} // namespace facebook
|