本文整理汇总了C++中Query::getAverageDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::getAverageDuration方法的具体用法?C++ Query::getAverageDuration怎么用?C++ Query::getAverageDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::getAverageDuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_queries
QString print_queries(QList<Query*> queries, int top) {
QString output_string;
QTextStream output(&output_string, QIODevice::WriteOnly);
output <<"<table class=\"queryList\">"
"<tr>"
"<th>Total duration</th>"
"<th>Executions</th>"
"<th>Average duration</th>"
"<th>User</th>"
"<th>Database</th>"
"<th>Query</th>"
"</tr>";
for(int i=0; i<min(queries.size(), top); i++) {
Query *q = queries.at(i);
output << QString("<tr class=\"row%1\">"
"<td class=\"relevantInformation top center\">%3 ms</td>"
"<td class=\"top center\">%4</td>"
"<td class=\"top center\">%5 ms</td>"
"<td class=\"top center\">%6</td>"
"<td class=\"top center\">%7</td>"
"<td><pre onclick=\"highlight(this);\">%8</pre></td></tr>"
"<tr><td colspan=\"6\">"
"<input type=\"button\" class=\"examplesButton\" value=\"Show examples\" "
"onclick=\"javascript:toggleExamples(this, %9);\" />"
"<div id=\"example_%9\" \"class=\"examples c1\" style=\"display: none;\">") \
.arg(i%2) \
.arg(q->getTotalDuration() / 1000) \
.arg(q->getExecutions()) \
.arg(q->getAverageDuration() / 1000) \
.arg(q->getUser()) \
.arg(q->getDatabase()) \
.arg(escape(q->getStatement())) \
.arg(example);
QStringList examples = q->getExamples();
QList<uint> durations = q->getDurations();
for(int j=0; j<examples.count(); j++) {
output << QString("<div class=\"example%1 sql\">%2ms | <pre onclick=\"highlight(this);\">%3</pre></div>") \
.arg(j % 2) \
.arg(durations.at(j)) \
.arg(escape(examples.at(j)));
}
output << "</div></td></tr>";
example++;
}
output << "</table>";
return output_string;
}