mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
modules/console: Add bare metal latency as control result.
This commit is contained in:
parent
217076f147
commit
fa698123dc
1 changed files with 96 additions and 17 deletions
|
@ -1352,20 +1352,69 @@ console_cmd__ios(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
bool
|
||||
console_cmd__ios__latency(opt &out, const string_view &line)
|
||||
{
|
||||
auto returned(0UL);
|
||||
auto executed(0UL);
|
||||
auto started(0UL);
|
||||
volatile long long returned, executed, started;
|
||||
|
||||
// control
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
started = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
executed = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
returned = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
}
|
||||
|
||||
out
|
||||
<< "bare send: " << (executed - started) << std::endl
|
||||
<< "bare recv: " << (returned - executed) << std::endl
|
||||
<< "bare rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
|
||||
// control
|
||||
{
|
||||
__sync_synchronize();
|
||||
started = prof::x86::rdtscp();
|
||||
asm volatile ("lfence" :::);
|
||||
executed = prof::x86::rdtscp();
|
||||
asm volatile ("lfence" :::);
|
||||
returned = prof::x86::rdtscp();
|
||||
asm volatile ("lfence" :::);
|
||||
}
|
||||
|
||||
out
|
||||
<< "tscp send: " << (executed - started) << std::endl
|
||||
<< "tscp recv: " << (returned - executed) << std::endl
|
||||
<< "tscp rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
|
||||
//
|
||||
// ios::dispatch
|
||||
//
|
||||
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
started = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
|
||||
ios::dispatch(ios::synchronous, [&executed]
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
executed = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
});
|
||||
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
returned = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
}
|
||||
|
||||
out
|
||||
|
@ -1374,28 +1423,28 @@ console_cmd__ios__latency(opt &out, const string_view &line)
|
|||
<< "disp rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
|
||||
{
|
||||
started = prof::cycles();
|
||||
ios::post(ios::synchronous, [&executed]
|
||||
{
|
||||
executed = prof::cycles();
|
||||
});
|
||||
returned = prof::cycles();
|
||||
}
|
||||
|
||||
out
|
||||
<< "post send: " << (executed - started) << std::endl
|
||||
<< "post recv: " << (returned - executed) << std::endl
|
||||
<< "post rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
//
|
||||
// ios::defer
|
||||
//
|
||||
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
started = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
|
||||
ios::defer(ios::synchronous, [&executed]
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
executed = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
});
|
||||
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
returned = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
}
|
||||
|
||||
out
|
||||
|
@ -1404,9 +1453,39 @@ console_cmd__ios__latency(opt &out, const string_view &line)
|
|||
<< "defer rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
|
||||
//
|
||||
// ios::post
|
||||
//
|
||||
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
started = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
|
||||
ios::post(ios::synchronous, [&executed]
|
||||
{
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
executed = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
});
|
||||
|
||||
__sync_synchronize();
|
||||
asm volatile ("lfence" :::);
|
||||
returned = prof::cycles();
|
||||
asm volatile ("lfence" :::);
|
||||
}
|
||||
|
||||
out
|
||||
<< "post send: " << (executed - started) << std::endl
|
||||
<< "post recv: " << (returned - executed) << std::endl
|
||||
<< "post rtt: " << (returned - started) << std::endl
|
||||
<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// aio
|
||||
|
|
Loading…
Reference in a new issue