mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::prof::psi: Additional state relative to last refresh.
This commit is contained in:
parent
19f4917d9f
commit
32192bf439
3 changed files with 61 additions and 40 deletions
|
@ -42,8 +42,15 @@ struct ircd::prof::psi::metric
|
|||
float pct;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
microseconds total; // stall value direct from system
|
||||
microseconds relative; // value since last sample only
|
||||
microseconds window; // duration since last sample
|
||||
float pct; // % of stall time since last sample
|
||||
}
|
||||
stall;
|
||||
std::array<struct avg, 3> avg;
|
||||
microseconds stall;
|
||||
};
|
||||
|
||||
struct ircd::prof::psi::file
|
||||
|
|
|
@ -377,7 +377,7 @@ noexcept try
|
|||
};
|
||||
|
||||
size_t i(0);
|
||||
tokens(vals, ' ', [&metric, &i] // Read each key=value pair
|
||||
tokens(vals, ' ', [&file, &metric, &i] // Read each key=value pair
|
||||
(const string_view &key_val)
|
||||
{
|
||||
const auto &[key, val]
|
||||
|
@ -387,7 +387,14 @@ noexcept try
|
|||
|
||||
if(key == "total")
|
||||
{
|
||||
metric.stall = lex_cast<microseconds>(val);
|
||||
const auto total(lex_cast<microseconds>(val));
|
||||
metric.stall.relative = total - metric.stall.total;
|
||||
metric.stall.window = duration_cast<microseconds>(now<system_point>() - file.sampled);
|
||||
metric.stall.pct = metric.stall.window.count()?
|
||||
metric.stall.relative.count() / double(metric.stall.window.count()):
|
||||
0.0;
|
||||
metric.stall.pct *= 100;
|
||||
metric.stall.total = total;
|
||||
return;
|
||||
}
|
||||
else if(startswith(key, "avg") && i < metric.avg.size())
|
||||
|
|
|
@ -1235,47 +1235,54 @@ console_cmd__prof__psi(opt &out, const string_view &line)
|
|||
if(!refresh(file))
|
||||
return;
|
||||
|
||||
char pbuf[48];
|
||||
out
|
||||
<< std::left << name
|
||||
<< " some stall "
|
||||
<< pretty(pbuf, file.some.stall)
|
||||
<< " ("
|
||||
<< file.some.stall.count()
|
||||
<< ')'
|
||||
<< std::endl
|
||||
;
|
||||
for(size_t i(0); i < file.some.avg.size(); i++)
|
||||
const auto show_metric{[&out, &name]
|
||||
(const auto &metric, const string_view &metric_name)
|
||||
{
|
||||
char pbuf[48];
|
||||
out
|
||||
<< std::left << name
|
||||
<< " some "
|
||||
<< std::right << std::setw(3) << file.some.avg.at(i).window.count()
|
||||
<< "s "
|
||||
<< std::right << std::setw(4) << file.some.avg.at(i).pct << '%'
|
||||
<< std::endl
|
||||
;
|
||||
<< std::left << std::setw(6) << name
|
||||
<< ' '
|
||||
<< metric_name << " stall window "
|
||||
<< pretty(pbuf, metric.stall.window)
|
||||
<< " ("
|
||||
<< metric.stall.window.count()
|
||||
<< ')'
|
||||
<< std::endl;
|
||||
|
||||
out
|
||||
<< std::endl
|
||||
<< std::left << name
|
||||
<< " full stall "
|
||||
<< pretty(pbuf, file.full.stall)
|
||||
<< " ("
|
||||
<< file.full.stall.count()
|
||||
<< ')'
|
||||
<< std::endl
|
||||
;
|
||||
for(size_t i(0); i < file.full.avg.size(); i++)
|
||||
out
|
||||
<< std::left << name
|
||||
<< " full "
|
||||
<< std::right << std::setw(3) << file.full.avg.at(i).window.count()
|
||||
<< "s "
|
||||
<< std::right << std::setw(4) << file.full.avg.at(i).pct << '%'
|
||||
<< std::endl
|
||||
;
|
||||
<< std::left << std::setw(6) << name
|
||||
<< ' '
|
||||
<< metric_name << " stall last "
|
||||
<< pretty(pbuf, metric.stall.relative)
|
||||
<< " ("
|
||||
<< metric.stall.relative.count()
|
||||
<< ") "
|
||||
<< metric.stall.pct << '%'
|
||||
<< std::endl;
|
||||
|
||||
out << std::endl;
|
||||
out
|
||||
<< std::left << std::setw(6) << name
|
||||
<< ' '
|
||||
<< metric_name << " stall total "
|
||||
<< pretty(pbuf, metric.stall.total)
|
||||
<< " ("
|
||||
<< metric.stall.total.count()
|
||||
<< ')'
|
||||
<< std::endl;
|
||||
|
||||
for(size_t i(0); i < metric.avg.size(); i++)
|
||||
out
|
||||
<< std::left << std::setw(6) << name
|
||||
<< ' '
|
||||
<< metric_name << " "
|
||||
<< std::right << std::setw(4) << metric.avg.at(i).window.count()
|
||||
<< "s "
|
||||
<< std::right << metric.avg.at(i).pct << '%'
|
||||
<< std::endl;
|
||||
}};
|
||||
|
||||
show_metric(file.some, "some");
|
||||
show_metric(file.full, "full");
|
||||
}};
|
||||
|
||||
const params param{line, " ",
|
||||
|
|
Loading…
Reference in a new issue