Support for explain containing single runtime instead of planning and execution time.

This commit is contained in:
eelke 2017-02-18 12:03:52 +01:00
parent 3dff4dade8
commit 8c077b3d5f
2 changed files with 8 additions and 3 deletions

View file

@ -62,8 +62,9 @@ ExplainRoot::SPtr ExplainRoot::createFromJson(Json::Value &json)
Json::Value &plan = explain["Plan"];
res->plan = createPlanItemFromJson(plan);
res->planningTime = explain["Planning Time"].asFloat();
res->planningTime = explain["Planning Time"].asFloat();
res->executionTime = explain["Execution Time"].asFloat();
res->totalRuntime = explain["Total Runtime"].asFloat();
}
}
return res;

View file

@ -408,8 +408,12 @@ void QueryTab::explain_ready(ExplainRoot::SPtr explain)
m_stopwatch.stop();
if (explain) {
addLog("Explain ready");
QString times_str = QString("Execution time: %1, Planning time: %2")
.arg(
QString times_str;
if (explain->totalRuntime > 0.f)
times_str = QString("Total time: %1").arg(
msfloatToHumanReadableString(explain->totalRuntime));
else
times_str = QString("Execution time: %1, Planning time: %2").arg(
msfloatToHumanReadableString(explain->executionTime)
, msfloatToHumanReadableString(explain->planningTime));
ui->lblTimes->setText(times_str);