Add units to metrics definitions

Switch from having separate METRICS and METRIC_DESCRIPTIONS objects
in a perf module to a single METRICS array. This is done so the
perf module can define the units for each metric.

In addition to improving the output in the web interface, the purpose
of having units is to give some clue about how to pick from multiple
values from different runs. In particular, with the assumption that
"noise" on the system will increase run times, for time values we want
to pick the smallest values, while for "rate" values, we want to pick
the largest value.

https://bugzilla.gnome.org/show_bug.cgi?id=618189
This commit is contained in:
Owen W. Taylor
2010-05-17 14:04:09 -04:00
parent 52a68eb24a
commit 20d579e7d8
3 changed files with 41 additions and 22 deletions

View File

@ -8,16 +8,25 @@ const Scripting = imports.ui.scripting;
// someone should be able to get an idea of how well the shell is performing
// on a particular system.
let METRIC_DESCRIPTIONS = {
overviewLatencyFirst: "Time to first frame after triggering overview, first time",
overviewFramesFirst: "Frames displayed when going to overview, first time",
overviewLatencySubsequent: "Time to first frame after triggering overview, second time",
overviewFramesSubsequent: "Frames displayed when going to overview, second time",
usedAfterOverview: "Malloc'ed bytes after the overview is shown once",
leakedAfterOverview: "Additional malloc'ed bytes the second time the overview is shown"
};
let METRICS = {
overviewLatencyFirst:
{ description: "Time to first frame after triggering overview, first time",
units: "us" },
overviewFramesFirst:
{ description: "Frames displayed when going to overview, first time",
units: "frames" },
overviewLatencySubsequent:
{ description: "Time to first frame after triggering overview, second time",
units: "us"},
overviewFramesSubsequent:
{ description: "Frames displayed when going to overview, second time",
units: "us" },
usedAfterOverview:
{ description: "Malloc'ed bytes after the overview is shown once",
units: "B" },
leakedAfterOverview:
{ description: "Additional malloc'ed bytes the second time the overview is shown",
units: "B" }
};
function run() {
@ -63,19 +72,19 @@ function script_overviewShowDone(time) {
overviewShowCount++;
if (overviewShowCount == 1) {
METRICS.overviewLatencyFirst = overviewLatency;
METRICS.overviewFramesFirst = overviewFrames;
METRICS.overviewLatencyFirst.value = overviewLatency;
METRICS.overviewFramesFirst.value = overviewFrames;
} else {
METRICS.overviewLatencySubsequent = overviewLatency;
METRICS.overviewFramesSubsequent = overviewFrames;
METRICS.overviewLatencySubsequent.value = overviewLatency;
METRICS.overviewFramesSubsequent.value = overviewFrames;
}
}
function script_afterShowHide(time) {
if (overviewShowCount == 1) {
METRICS.usedAfterOverview = mallocUsedSize;
METRICS.usedAfterOverview.value = mallocUsedSize;
} else {
METRICS.leakedAfterOverview = mallocUsedSize - METRICS.usedAfterOverview;
METRICS.leakedAfterOverview.value = mallocUsedSize - METRICS.usedAfterOverview.value;
}
}