mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 09:40:12 +01:00
ircd::ctx::prof: Add uint argument for rdpmc; minor cleanup.
This commit is contained in:
parent
46324b1ac8
commit
40b3bdaa89
1 changed files with 21 additions and 21 deletions
|
@ -33,9 +33,9 @@ namespace ircd::ctx::prof
|
|||
struct ticker;
|
||||
|
||||
// util
|
||||
unsigned long long rdpmc();
|
||||
unsigned long long rdtsc();
|
||||
unsigned long long rdpmc(const uint &);
|
||||
unsigned long long rdtscp();
|
||||
unsigned long long rdtsc();
|
||||
uint64_t cycles();
|
||||
|
||||
string_view reflect(const event &);
|
||||
|
@ -109,6 +109,22 @@ ircd::ctx::prof::cycles()
|
|||
return rdtsc();
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
inline unsigned long long
|
||||
__attribute__((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
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
inline unsigned long long
|
||||
__attribute__((always_inline, gnu_inline, artificial))
|
||||
|
@ -129,29 +145,13 @@ ircd::ctx::prof::rdtscp()
|
|||
#if defined(__x86_64__) || defined(__i386__)
|
||||
inline unsigned long long
|
||||
__attribute__((always_inline, gnu_inline, artificial))
|
||||
ircd::ctx::prof::rdtsc()
|
||||
ircd::ctx::prof::rdpmc(const uint &c)
|
||||
{
|
||||
return __builtin_ia32_rdtsc();
|
||||
return __builtin_ia32_rdpmc(c);
|
||||
}
|
||||
#else
|
||||
inline unsigned long long
|
||||
ircd::ctx::prof::rdtsc()
|
||||
{
|
||||
static_assert(false, "TODO: Implement fallback here");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
inline unsigned long long
|
||||
__attribute__((always_inline, gnu_inline, artificial))
|
||||
ircd::ctx::prof::rdpmc()
|
||||
{
|
||||
return __builtin_ia32_rdpmc(0);
|
||||
}
|
||||
#else
|
||||
inline unsigned long long
|
||||
ircd::ctx::prof::rdpmc()
|
||||
ircd::ctx::prof::rdpmc(const uint &c)
|
||||
{
|
||||
static_assert(false, "TODO: Implement fallback here");
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue