0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-04 21:08:57 +01:00

ircd::ctx: Inline rdtsc().

This commit is contained in:
Jason Volk 2019-03-26 21:59:29 -07:00
parent 42d275d787
commit 28063823dd
2 changed files with 17 additions and 20 deletions

View file

@ -33,7 +33,7 @@ namespace ircd::ctx::prof
struct ticker;
// util
ulong rdtsc();
unsigned long long rdtsc();
string_view reflect(const event &);
// totals
@ -97,3 +97,19 @@ struct ircd::ctx::prof::ticker
// monotonic counters for events
std::array<uint64_t, num_of<prof::event>()> event {{0}};
};
#if defined(__x86_64__) || defined(__i386__)
inline unsigned long long
__attribute__((flatten, always_inline, gnu_inline, artificial))
ircd::ctx::prof::rdtsc()
{
return __builtin_ia32_rdtsc();
}
#else
inline unsigned long long
ircd::ctx::prof::rdtsc()
{
static_assert(false, "TODO: Implement fallback here");
return 0;
}
#endif

View file

@ -1867,25 +1867,6 @@ ircd::ctx::prof::reflect(const event &e)
return "?????";
}
#ifdef HAVE_X86INTRIN_H
ulong
ircd::ctx::prof::rdtsc()
{
return __rdtsc();
}
#else
ulong
ircd::ctx::prof::rdtsc()
{
static_assert
(
0, "TODO: Implement fallback here"
);
return 0;
}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// ctx_ole.h