Normalize the debugger's profile times by the repeat count
https://codereview.appspot.com/7520043/
git-svn-id: http://skia.googlecode.com/svn/trunk@8025 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index f1f4694..83dd17f 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -404,7 +404,7 @@
item->setData(Qt::UserRole + 4, 100.0*temp);
}
- setupOverviewText(picture.typeTimes(), picture.totTime());
+ setupOverviewText(picture.typeTimes(), picture.totTime(), kNumRepeats);
}
void SkDebuggerGUI::actionCancel() {
@@ -1032,7 +1032,7 @@
setupListWidget(commands);
setupComboBox(commands);
- setupOverviewText(NULL, 0.0);
+ setupOverviewText(NULL, 0.0, 1);
fInspectorWidget.setDisabled(false);
fSettingsWidget.setDisabled(false);
fMenuEdit.setDisabled(false);
@@ -1070,7 +1070,9 @@
}
}
-void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, double totTime) {
+void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
+ double totTime,
+ int numRuns) {
const SkTDArray<SkDrawCommand*>& commands = fDebugger.getDrawCommands();
@@ -1101,7 +1103,7 @@
overview.append(QString::number(counts[i]));
if (NULL != typeTimes) {
overview.append(" - ");
- overview.append(QString::number((*typeTimes)[i], 'f', 1));
+ overview.append(QString::number((*typeTimes)[i]/(float)numRuns, 'f', 1));
overview.append("ms");
overview.append(" - ");
double percent = 100.0*(*typeTimes)[i]/totTime;
@@ -1124,7 +1126,7 @@
if (totTime > 0.0) {
overview.append("Total Time: ");
- overview.append(QString::number(totTime, 'f', 2));
+ overview.append(QString::number(totTime/(float)numRuns, 'f', 2));
overview.append("ms");
#ifdef SK_DEBUG
overview.append(" ");
diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h
index bb3d6ce..f9960a3 100644
--- a/debugger/QT/SkDebuggerGUI.h
+++ b/debugger/QT/SkDebuggerGUI.h
@@ -323,7 +323,7 @@
/**
Fills in the overview pane with text
*/
- void setupOverviewText(const SkTDArray<double>* typeTimes, double totTime);
+ void setupOverviewText(const SkTDArray<double>* typeTimes, double totTime, int numRuns);
/**
Render the supplied picture several times tracking the time consumed
diff --git a/debugger/QT/SkListWidget.cpp b/debugger/QT/SkListWidget.cpp
index b797cc0..cc94ff8 100644
--- a/debugger/QT/SkListWidget.cpp
+++ b/debugger/QT/SkListWidget.cpp
@@ -68,6 +68,7 @@
float time = index.data(Qt::UserRole + 4).toFloat();
QString drawTime;
drawTime.setNum(time, 'f', 2);
+ drawTime += "%";
/* option.rect is a struct that Qt uses as a target to draw into. Following
* the format (x1,y1,x2,y2) x1 and y1 represent where the painter can start