0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-18 01:30:12 +01:00

modules/console: Add ios latency diagnostic.

This commit is contained in:
Jason Volk 2019-09-12 12:13:27 -07:00
parent d3039669f5
commit a60750ab86

View file

@ -1352,6 +1352,62 @@ console_cmd__ios(opt &out, const string_view &line)
return true;
}
bool
console_cmd__ios__latency(opt &out, const string_view &line)
{
auto returned(0UL);
auto executed(0UL);
auto started(0UL);
{
started = prof::cycles();
ios::dispatch(ios::synchronous, [&executed]
{
executed = prof::cycles();
});
returned = prof::cycles();
}
out
<< "disp send: " << (executed - started) << std::endl
<< "disp recv: " << (returned - executed) << std::endl
<< "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;
{
started = prof::cycles();
ios::defer(ios::synchronous, [&executed]
{
executed = prof::cycles();
});
returned = prof::cycles();
}
out
<< "defer send: " << (executed - started) << std::endl
<< "defer recv: " << (returned - executed) << std::endl
<< "defer rtt: " << (returned - started) << std::endl
<< std::endl;
return true;
}
//
// aio
//