mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::db: Consolidate various stats interfaces into header.
This commit is contained in:
parent
77755a2ab4
commit
5708d9c36b
4 changed files with 45 additions and 21 deletions
|
@ -35,18 +35,6 @@ namespace ircd::db
|
|||
const rocksdb::Cache *cache(const database &);
|
||||
rocksdb::Cache *cache(database &);
|
||||
|
||||
// Ticker
|
||||
extern const uint32_t ticker_max;
|
||||
string_view ticker_id(const uint32_t &id);
|
||||
uint32_t ticker_id(const string_view &key);
|
||||
uint64_t ticker(const database &, const uint32_t &id);
|
||||
uint64_t ticker(const database &, const string_view &key);
|
||||
|
||||
// Histogram
|
||||
extern const uint32_t histogram_max;
|
||||
string_view histogram_id(const uint32_t &id);
|
||||
uint32_t histogram_id(const string_view &key);
|
||||
|
||||
// Control panel
|
||||
void setopt(database &, const string_view &key, const string_view &val);
|
||||
void fdeletions(database &, const bool &enable, const bool &force = false);
|
||||
|
|
|
@ -76,6 +76,7 @@ enum class ircd::db::pos
|
|||
#include "index.h"
|
||||
#include "json.h"
|
||||
#include "txn.h"
|
||||
#include "stats.h"
|
||||
|
||||
//
|
||||
// Misc utils
|
||||
|
@ -87,14 +88,6 @@ namespace ircd::db
|
|||
std::string path(const std::string &name);
|
||||
std::vector<std::string> available();
|
||||
|
||||
uint perf_level();
|
||||
void perf_level(const uint &);
|
||||
const rocksdb::PerfContext &perf_current();
|
||||
std::string string(const rocksdb::PerfContext &, const bool &all = false);
|
||||
|
||||
const rocksdb::IOStatsContext &iostats_current();
|
||||
std::string string(const rocksdb::IOStatsContext &, const bool &all = false);
|
||||
|
||||
string_view reflect(const pos &);
|
||||
}
|
||||
|
||||
|
|
37
include/ircd/db/stats.h
Normal file
37
include/ircd/db/stats.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_DB_STATS_H
|
||||
|
||||
namespace ircd::db
|
||||
{
|
||||
// Histogram (per database)
|
||||
extern const uint32_t histogram_max;
|
||||
string_view histogram_id(const uint32_t &id);
|
||||
uint32_t histogram_id(const string_view &key);
|
||||
|
||||
// Ticker (per database)
|
||||
extern const uint32_t ticker_max;
|
||||
string_view ticker_id(const uint32_t &id);
|
||||
uint32_t ticker_id(const string_view &key);
|
||||
uint64_t ticker(const database &, const uint32_t &id);
|
||||
uint64_t ticker(const database &, const string_view &key);
|
||||
|
||||
// Perf counts (global)
|
||||
uint perf_level();
|
||||
void perf_level(const uint &);
|
||||
const rocksdb::PerfContext &perf_current();
|
||||
std::string string(const rocksdb::PerfContext &, const bool &all = false);
|
||||
|
||||
// IO counters (global)
|
||||
const rocksdb::IOStatsContext &iostats_current();
|
||||
std::string string(const rocksdb::IOStatsContext &, const bool &all = false);
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
#include <rocksdb/merge_operator.h>
|
||||
#include <rocksdb/perf_level.h>
|
||||
#include <rocksdb/perf_context.h>
|
||||
#include <rocksdb/iostats_context.h>
|
||||
#include <rocksdb/listener.h>
|
||||
#include <rocksdb/statistics.h>
|
||||
#include <rocksdb/convenience.h>
|
||||
|
@ -1301,7 +1302,7 @@ catch(const std::exception &e)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// database::stats
|
||||
// db/stats.h
|
||||
//
|
||||
|
||||
std::string
|
||||
|
@ -1432,6 +1433,11 @@ ircd::db::histogram_max
|
|||
rocksdb::HISTOGRAM_ENUM_MAX
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// database::stats (db/database/stats.h) internal
|
||||
//
|
||||
|
||||
uint64_t
|
||||
ircd::db::database::stats::getAndResetTickerCount(const uint32_t type)
|
||||
noexcept
|
||||
|
|
Loading…
Reference in a new issue