mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
cfe084d02f
Summary: Timeseries is memory intensive and not really required in the current context it is being used. Reviewed By: chadaustin Differential Revision: D26315632 fbshipit-source-id: ee51c3ad8bef6fce152aa787c8c4602f0b499f92
70 lines
2.0 KiB
C++
70 lines
2.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 "eden/fs/telemetry/EdenStats.h"
|
|
|
|
#include <chrono>
|
|
#include <memory>
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
ChannelThreadStats& EdenStats::getChannelStatsForCurrentThread() {
|
|
return *threadLocalChannelStats_.get();
|
|
}
|
|
|
|
ObjectStoreThreadStats& EdenStats::getObjectStoreStatsForCurrentThread() {
|
|
return *threadLocalObjectStoreStats_.get();
|
|
}
|
|
|
|
HgBackingStoreThreadStats& EdenStats::getHgBackingStoreStatsForCurrentThread() {
|
|
return *threadLocalHgBackingStoreStats_.get();
|
|
}
|
|
|
|
HgImporterThreadStats& EdenStats::getHgImporterStatsForCurrentThread() {
|
|
return *threadLocalHgImporterStats_.get();
|
|
}
|
|
|
|
JournalThreadStats& EdenStats::getJournalStatsForCurrentThread() {
|
|
return *threadLocalJournalStats_.get();
|
|
}
|
|
|
|
void EdenStats::flush() {
|
|
// This method is only really useful while testing to ensure that the service
|
|
// data singleton instance has the latest stats. Since all our stats are now
|
|
// quantile stat based, flushing the quantile stat map is sufficient for that
|
|
// use case.
|
|
fb303::ServiceData::get()->getQuantileStatMap()->flushAll();
|
|
}
|
|
|
|
std::shared_ptr<HgImporterThreadStats> getSharedHgImporterStatsForCurrentThread(
|
|
std::shared_ptr<EdenStats> stats) {
|
|
return std::shared_ptr<HgImporterThreadStats>(
|
|
stats, &stats->getHgImporterStatsForCurrentThread());
|
|
}
|
|
|
|
EdenThreadStatsBase::EdenThreadStatsBase() {}
|
|
|
|
EdenThreadStatsBase::Stat EdenThreadStatsBase::createStat(
|
|
const std::string& name) {
|
|
return Stat{
|
|
name,
|
|
fb303::ExportTypeConsts::kSumCountAvgRate,
|
|
fb303::QuantileConsts::kP1_P10_P50_P90_P99,
|
|
fb303::SlidingWindowPeriodConsts::kOneMinTenMinHour,
|
|
};
|
|
}
|
|
|
|
void ChannelThreadStats::recordLatency(
|
|
StatPtr item,
|
|
std::chrono::microseconds elapsed) {
|
|
(this->*item).addValue(elapsed.count());
|
|
}
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|