mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd: Rename perf:: to prof::.
This commit is contained in:
parent
96ce15b4d9
commit
63c850b123
8 changed files with 35 additions and 27 deletions
|
@ -32,6 +32,7 @@ namespace ircd::ctx::prof
|
||||||
enum class event :uint8_t;
|
enum class event :uint8_t;
|
||||||
struct ticker;
|
struct ticker;
|
||||||
|
|
||||||
|
uint64_t cycles();
|
||||||
string_view reflect(const event &);
|
string_view reflect(const event &);
|
||||||
|
|
||||||
// totals
|
// totals
|
||||||
|
@ -95,3 +96,10 @@ struct ircd::ctx::prof::ticker
|
||||||
// monotonic counters for events
|
// monotonic counters for events
|
||||||
std::array<uint64_t, num_of<prof::event>()> event {{0}};
|
std::array<uint64_t, num_of<prof::event>()> event {{0}};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline uint64_t
|
||||||
|
__attribute__((flatten, always_inline, gnu_inline, artificial))
|
||||||
|
ircd::ctx::prof::cycles()
|
||||||
|
{
|
||||||
|
return ircd::prof::cycles();
|
||||||
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "magics.h"
|
#include "magics.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "perf.h"
|
#include "prof.h"
|
||||||
#include "fs/fs.h"
|
#include "fs/fs.h"
|
||||||
#include "ios.h"
|
#include "ios.h"
|
||||||
#include "ctx/ctx.h"
|
#include "ctx/ctx.h"
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#define HAVE_IRCD_PERF_H
|
#define HAVE_IRCD_PROF_H
|
||||||
|
|
||||||
namespace ircd::perf
|
namespace ircd::prof
|
||||||
{
|
{
|
||||||
struct init;
|
struct init;
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ namespace ircd::perf
|
||||||
|
|
||||||
namespace ircd
|
namespace ircd
|
||||||
{
|
{
|
||||||
using perf::cycles;
|
using prof::cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ircd::perf::init
|
struct ircd::prof::init
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
~init() noexcept;
|
~init() noexcept;
|
||||||
|
@ -37,21 +37,21 @@ struct ircd::perf::init
|
||||||
|
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
__attribute__((flatten, always_inline, gnu_inline, artificial))
|
__attribute__((flatten, always_inline, gnu_inline, artificial))
|
||||||
ircd::perf::cycles()
|
ircd::prof::cycles()
|
||||||
{
|
{
|
||||||
return perf::rdtsc();
|
return prof::rdtsc();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
__attribute__((always_inline, gnu_inline, artificial))
|
__attribute__((always_inline, gnu_inline, artificial))
|
||||||
ircd::perf::rdtsc()
|
ircd::prof::rdtsc()
|
||||||
{
|
{
|
||||||
return __builtin_ia32_rdtsc();
|
return __builtin_ia32_rdtsc();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
ircd::perf::rdtsc()
|
ircd::prof::rdtsc()
|
||||||
{
|
{
|
||||||
static_assert(false, "TODO: Implement fallback here");
|
static_assert(false, "TODO: Implement fallback here");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -61,14 +61,14 @@ ircd::perf::rdtsc()
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
__attribute__((always_inline, gnu_inline, artificial))
|
__attribute__((always_inline, gnu_inline, artificial))
|
||||||
ircd::perf::rdtscp()
|
ircd::prof::rdtscp()
|
||||||
{
|
{
|
||||||
uint32_t ia32_tsc_aux;
|
uint32_t ia32_tsc_aux;
|
||||||
return __builtin_ia32_rdtscp(&ia32_tsc_aux);
|
return __builtin_ia32_rdtscp(&ia32_tsc_aux);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
ircd::perf::rdtscp()
|
ircd::prof::rdtscp()
|
||||||
{
|
{
|
||||||
static_assert(false, "TODO: Implement fallback here");
|
static_assert(false, "TODO: Implement fallback here");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -78,13 +78,13 @@ ircd::perf::rdtscp()
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
__attribute__((always_inline, gnu_inline, artificial))
|
__attribute__((always_inline, gnu_inline, artificial))
|
||||||
ircd::perf::rdpmc(const uint &c)
|
ircd::prof::rdpmc(const uint &c)
|
||||||
{
|
{
|
||||||
return __builtin_ia32_rdpmc(c);
|
return __builtin_ia32_rdpmc(c);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline unsigned long long
|
inline unsigned long long
|
||||||
ircd::perf::rdpmc(const uint &c)
|
ircd::prof::rdpmc(const uint &c)
|
||||||
{
|
{
|
||||||
static_assert(false, "TODO: Implement fallback here");
|
static_assert(false, "TODO: Implement fallback here");
|
||||||
return 0;
|
return 0;
|
|
@ -116,7 +116,7 @@ libircd_la_SOURCES = \
|
||||||
logger.cc \
|
logger.cc \
|
||||||
magic.cc \
|
magic.cc \
|
||||||
stats.cc \
|
stats.cc \
|
||||||
perf.cc \
|
prof.cc \
|
||||||
fs.cc \
|
fs.cc \
|
||||||
sodium.cc \
|
sodium.cc \
|
||||||
openssl.cc \
|
openssl.cc \
|
||||||
|
|
10
ircd/ctx.cc
10
ircd/ctx.cc
|
@ -872,7 +872,7 @@ ircd::ctx::this_ctx::slice_usage_warning::slice_usage_warning(const string_view
|
||||||
// Set the start value to the total number of cycles accrued by this
|
// Set the start value to the total number of cycles accrued by this
|
||||||
// context including the current time slice.
|
// context including the current time slice.
|
||||||
!current?
|
!current?
|
||||||
perf::cycles():
|
prof::cycles():
|
||||||
~cur().flags & context::SLICE_EXEMPT?
|
~cur().flags & context::SLICE_EXEMPT?
|
||||||
cur().profile.cycles + prof::cur_slice_cycles():
|
cur().profile.cycles + prof::cur_slice_cycles():
|
||||||
0
|
0
|
||||||
|
@ -898,7 +898,7 @@ noexcept
|
||||||
{
|
{
|
||||||
current?
|
current?
|
||||||
cur().profile.cycles + prof::cur_slice_cycles():
|
cur().profile.cycles + prof::cur_slice_cycles():
|
||||||
perf::cycles()
|
prof::cycles()
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(stop >= start);
|
assert(stop >= start);
|
||||||
|
@ -1663,13 +1663,13 @@ ircd::ctx::prof::handle_cur_continue()
|
||||||
void
|
void
|
||||||
ircd::ctx::prof::slice_enter()
|
ircd::ctx::prof::slice_enter()
|
||||||
{
|
{
|
||||||
_slice_start = perf::cycles();
|
_slice_start = cycles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::ctx::prof::slice_leave()
|
ircd::ctx::prof::slice_leave()
|
||||||
{
|
{
|
||||||
_slice_stop = perf::cycles();
|
_slice_stop = cycles();
|
||||||
|
|
||||||
auto &c(cur());
|
auto &c(cur());
|
||||||
assert(_slice_stop >= _slice_start);
|
assert(_slice_stop >= _slice_start);
|
||||||
|
@ -1811,7 +1811,7 @@ ircd::ctx::prof::slice_exceeded_warning(const ulong &cycles)
|
||||||
ulong
|
ulong
|
||||||
ircd::ctx::prof::cur_slice_cycles()
|
ircd::ctx::prof::cur_slice_cycles()
|
||||||
{
|
{
|
||||||
return perf::cycles() - cur_slice_start();
|
return cycles() - cur_slice_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ulong &
|
const ulong &
|
||||||
|
|
|
@ -208,7 +208,7 @@ ircd::ios::handler::fault(handler *const &handler)
|
||||||
// needs to be tied off here instead.
|
// needs to be tied off here instead.
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
stats.slice_last = perf::cycles() - handler->slice_start;
|
stats.slice_last = cycles() - handler->slice_start;
|
||||||
stats.slice_total += stats.slice_last;
|
stats.slice_total += stats.slice_last;
|
||||||
|
|
||||||
assert(handler::current == handler);
|
assert(handler::current == handler);
|
||||||
|
@ -226,7 +226,7 @@ ircd::ios::handler::leave(handler *const &handler)
|
||||||
|
|
||||||
assert(descriptor.stats);
|
assert(descriptor.stats);
|
||||||
auto &stats(*descriptor.stats);
|
auto &stats(*descriptor.stats);
|
||||||
stats.slice_last = perf::cycles() - handler->slice_start;
|
stats.slice_last = cycles() - handler->slice_start;
|
||||||
stats.slice_total += stats.slice_last;
|
stats.slice_total += stats.slice_last;
|
||||||
|
|
||||||
assert(handler::current == handler);
|
assert(handler::current == handler);
|
||||||
|
@ -245,7 +245,7 @@ ircd::ios::handler::enter(handler *const &handler)
|
||||||
|
|
||||||
assert(!handler::current);
|
assert(!handler::current);
|
||||||
handler::current = handler;
|
handler::current = handler;
|
||||||
handler->slice_start = perf::cycles();
|
handler->slice_start = cycles();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -202,7 +202,7 @@ noexcept try
|
||||||
// more appropriate.
|
// more appropriate.
|
||||||
|
|
||||||
fs::init _fs_; // Local filesystem
|
fs::init _fs_; // Local filesystem
|
||||||
perf::init _perf_; // Profiling related
|
prof::init _prof_; // Profiling related
|
||||||
magic::init _magic_; // libmagic
|
magic::init _magic_; // libmagic
|
||||||
ctx::ole::init _ole_; // Thread OffLoad Engine
|
ctx::ole::init _ole_; // Thread OffLoad Engine
|
||||||
nacl::init _nacl_; // nacl crypto
|
nacl::init _nacl_; // nacl crypto
|
||||||
|
|
|
@ -17,24 +17,24 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_PERF_EVENT_H
|
#ifdef HAVE_LINUX_PERF_EVENT_H
|
||||||
ircd::perf::init::init()
|
ircd::prof::init::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ircd::perf::init::init()
|
ircd::prof::init::init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_PERF_EVENT_H
|
#ifdef HAVE_LINUX_PERF_EVENT_H
|
||||||
ircd::perf::init::~init()
|
ircd::prof::init::~init()
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ircd::perf::init::~init()
|
ircd::prof::init::~init()
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
}
|
}
|
Loading…
Reference in a new issue