Skip to content

Commit 9222de0

Browse files
committed
ircd::ctx: Add access to rdtsc through ctx::prof; minor comments.
1 parent 6576406 commit 9222de0

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

include/ircd/ctx/ctx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,6 @@ namespace ircd
115115

116116
using ctx::critical_assertion;
117117
using ctx::critical_indicator;
118+
119+
using ctx::prof::rdtsc;
118120
}

include/ircd/ctx/prof.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ namespace ircd::ctx::prof
3232
enum class event;
3333
struct settings extern settings;
3434

35+
// lowlevel
36+
ulong rdtsc();
37+
38+
// state accessors
3539
const ulong &total_slice_cycles();
3640
const ulong &cur_slice_start();
3741
ulong cur_slice_cycles();
3842

43+
// called at the appropriate point to mark the event (internal use).
3944
void mark(const event &);
4045
}
4146

ircd/ctx.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ ircd::ctx::prof::mark(const event &e)
12311231
ulong
12321232
ircd::ctx::prof::cur_slice_cycles()
12331233
{
1234-
return __rdtsc() - cur_slice_start();
1234+
return rdtsc() - cur_slice_start();
12351235
}
12361236

12371237
const ulong &
@@ -1274,7 +1274,7 @@ ircd::ctx::prof::handle_cur_continue()
12741274
void
12751275
ircd::ctx::prof::slice_start()
12761276
{
1277-
_slice_start = __rdtsc();
1277+
_slice_start = rdtsc();
12781278
}
12791279

12801280
void
@@ -1335,6 +1335,12 @@ ircd::ctx::prof::check_stack()
13351335
}
13361336
}
13371337

1338+
ulong
1339+
ircd::ctx::prof::rdtsc()
1340+
{
1341+
return __rdtsc();
1342+
}
1343+
13381344
///////////////////////////////////////////////////////////////////////////////
13391345
//
13401346
// ctx_ole.h

0 commit comments

Comments
 (0)