Add simple malloc statistics and metrics
Add some basic statistics for allocated memory based on mallinfo(), and use that to define two metrics: usedAfterOverview: bytes used after the overview is shown once leakedAfterOverview: additional bytes used when the overview is shown a second time. https://bugzilla.gnome.org/show_bug.cgi?id=618189
This commit is contained in:
@ -12,7 +12,9 @@ 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"
|
||||
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 = {
|
||||
@ -21,6 +23,7 @@ let METRICS = {
|
||||
function run() {
|
||||
Scripting.defineScriptEvent("overviewShowStart", "Starting to show the overview");
|
||||
Scripting.defineScriptEvent("overviewShowDone", "Overview finished showing");
|
||||
Scripting.defineScriptEvent("afterShowHide", "After a show/hide cycle for the overview");
|
||||
|
||||
yield Scripting.sleep(1000);
|
||||
yield Scripting.waitLeisure();
|
||||
@ -29,8 +32,14 @@ function run() {
|
||||
Main.overview.show();
|
||||
yield Scripting.waitLeisure();
|
||||
Scripting.scriptEvent('overviewShowDone');
|
||||
|
||||
Main.overview.hide();
|
||||
yield Scripting.waitLeisure();
|
||||
|
||||
global.gc();
|
||||
yield Scripting.sleep(1000);
|
||||
Scripting.collectStatistics();
|
||||
Scripting.scriptEvent('afterShowHide');
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +47,9 @@ let showingOverview = false;
|
||||
let overviewShowStart;
|
||||
let overviewFrames;
|
||||
let overviewLatency;
|
||||
let mallocUsedSize = 0;
|
||||
let overviewShowCount = 0;
|
||||
let firstOverviewUsedSize;
|
||||
|
||||
function script_overviewShowStart(time) {
|
||||
showingOverview = true;
|
||||
@ -48,7 +60,9 @@ function script_overviewShowStart(time) {
|
||||
function script_overviewShowDone(time) {
|
||||
showingOverview = false;
|
||||
|
||||
if (!('overviewLatencyFirst' in METRICS)) {
|
||||
overviewShowCount++;
|
||||
|
||||
if (overviewShowCount == 1) {
|
||||
METRICS.overviewLatencyFirst = overviewLatency;
|
||||
METRICS.overviewFramesFirst = overviewFrames;
|
||||
} else {
|
||||
@ -57,6 +71,18 @@ function script_overviewShowDone(time) {
|
||||
}
|
||||
}
|
||||
|
||||
function script_afterShowHide(time) {
|
||||
if (overviewShowCount == 1) {
|
||||
METRICS.usedAfterOverview = mallocUsedSize;
|
||||
} else {
|
||||
METRICS.leakedAfterOverview = mallocUsedSize - METRICS.usedAfterOverview;
|
||||
}
|
||||
}
|
||||
|
||||
function malloc_usedSize(time, bytes) {
|
||||
mallocUsedSize = bytes;
|
||||
}
|
||||
|
||||
function clutter_stagePaintDone(time) {
|
||||
if (showingOverview) {
|
||||
if (overviewFrames == 0)
|
||||
|
Reference in New Issue
Block a user