Skip to content

Commit

Permalink
ircd::ctx: Add access to rdtsc through ctx::prof; minor comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jevolk committed Nov 15, 2018
1 parent 6576406 commit 9222de0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/ircd/ctx/ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ namespace ircd

using ctx::critical_assertion;
using ctx::critical_indicator;

using ctx::prof::rdtsc;
}
5 changes: 5 additions & 0 deletions include/ircd/ctx/prof.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ namespace ircd::ctx::prof
enum class event;
struct settings extern settings;

// lowlevel
ulong rdtsc();

// state accessors
const ulong &total_slice_cycles();
const ulong &cur_slice_start();
ulong cur_slice_cycles();

// called at the appropriate point to mark the event (internal use).
void mark(const event &);
}

Expand Down
10 changes: 8 additions & 2 deletions ircd/ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ ircd::ctx::prof::mark(const event &e)
ulong
ircd::ctx::prof::cur_slice_cycles()
{
return __rdtsc() - cur_slice_start();
return rdtsc() - cur_slice_start();
}

const ulong &
Expand Down Expand Up @@ -1274,7 +1274,7 @@ ircd::ctx::prof::handle_cur_continue()
void
ircd::ctx::prof::slice_start()
{
_slice_start = __rdtsc();
_slice_start = rdtsc();
}

void
Expand Down Expand Up @@ -1335,6 +1335,12 @@ ircd::ctx::prof::check_stack()
}
}

ulong
ircd::ctx::prof::rdtsc()
{
return __rdtsc();
}

///////////////////////////////////////////////////////////////////////////////
//
// ctx_ole.h
Expand Down

0 comments on commit 9222de0

Please sign in to comment.