CernVM-FS
2.12.0
|
#include <statistics.h>
Classes | |
struct | CounterInfo |
Public Types | |
enum | PrintOptions { kPrintSimple = 0, kPrintHeader } |
Public Member Functions | |
Statistics () | |
~Statistics () | |
Statistics * | Fork () |
Counter * | Register (const std::string &name, const std::string &desc) |
Counter * | Lookup (const std::string &name) const |
std::string | LookupDesc (const std::string &name) |
std::string | PrintList (const PrintOptions print_options) |
std::string | PrintJSON () |
void | SnapshotCounters (std::map< std::string, int64_t > *counters, uint64_t *timestamp_ns) |
Private Member Functions | |
Statistics (const Statistics &other) | |
Statistics & | operator= (const Statistics &other) |
Private Attributes | |
std::map< std::string, CounterInfo * > | counters_ |
pthread_mutex_t * | lock_ |
A collection of Counter objects with a name and a description. Counters in a Statistics class have a name and a description. Thread-safe.
Definition at line 60 of file statistics.h.
Enumerator | |
---|---|
kPrintSimple | |
kPrintHeader |
Definition at line 62 of file statistics.h.
perf::Statistics::Statistics | ( | ) |
perf::Statistics::~Statistics | ( | ) |
Definition at line 177 of file statistics.cc.
|
private |
Statistics * perf::Statistics::Fork | ( | ) |
Creates a new Statistics binder which maintains the same Counters as the existing one. Changes to those counters are visible in both Statistics objects. The child can then independently add more counters. CounterInfo objects are reference counted and deleted when all the statistics objects dealing with it are destroyed.
Definition at line 47 of file statistics.cc.
Referenced by MountPoint::CreateStatistics().
Counter * perf::Statistics::Lookup | ( | const std::string & | name | ) | const |
Definition at line 62 of file statistics.cc.
Referenced by shrinkwrap::copyFile(), NDownloadMagicXattr::FinalizeValue(), HitrateMagicXattr::FinalizeValue(), RxMagicXattr::FinalizeValue(), SpeedMagicXattr::FinalizeValue(), anonymous_namespace{statistics_database.cc}::GcStats::GcStats(), shrinkwrap::getNext(), shrinkwrap::handle_file(), TalkManager::MainResponder(), shrinkwrap::MainWorker(), PosixGcMainWorker(), perf::StatisticsTemplate::RegisterOrLookupTemplated(), and shrinkwrap::Sync().
string perf::Statistics::LookupDesc | ( | const std::string & | name | ) |
Definition at line 71 of file statistics.cc.
|
private |
string perf::Statistics::PrintJSON | ( | ) |
Converts statistics counters into JSON string in following format { "name_major1": { "counter1": val1, "counter2": val2 }, "name_major2": { "counter3": val3 } }
Definition at line 106 of file statistics.cc.
Referenced by receiver::Reactor::HandleSubmitPayload().
string perf::Statistics::PrintList | ( | const PrintOptions | print_options | ) |
Definition at line 79 of file statistics.cc.
Referenced by cvmfs_statistics_format(), main(), TalkManager::MainResponder(), RunGarbageCollection(), shrinkwrap::SyncFull(), and shrinkwrap::SyncInit().
Counter * perf::Statistics::Register | ( | const std::string & | name, |
const std::string & | desc | ||
) |
Definition at line 160 of file statistics.cc.
Referenced by catalog::ClientCatalogManager::ClientCatalogManager(), NfsMapsSqlite::Create(), NfsMapsLeveldb::Create(), AuthzSessionManager::Create(), FileSystem::CreateStatistics(), MountPoint::CreateStatistics(), shrinkwrap::GetSyncStatTemplate(), swissknife::Ingest::Main(), perf::StatisticsTemplate::RegisterTemplated(), sqlite::RegisterVfsRdOnly(), RunGarbageCollection(), receiver::CommitProcessor::SetStatistics(), and catalog::Statistics::Statistics().
void perf::Statistics::SnapshotCounters | ( | std::map< std::string, int64_t > * | counters, |
uint64_t * | timestamp_ns | ||
) |
Snapshot current state of the counters. Elements will either be updated or inserted into the map.
Note: This function does NOT clear previous elements part of the map.
Returns map of the updated counters and the timestamp of the snapshot.
Definition at line 147 of file statistics.cc.
Referenced by perf::TelemetryAggregator::MainTelemetry().
|
private |
Definition at line 90 of file statistics.h.
Referenced by Fork().
|
mutableprivate |
Definition at line 91 of file statistics.h.