Bug 1249789, 1249791, 1249792, 1249796, 1249798 - Clean up memory tool breakdowns; r=jsantell

This commit does the following:

- Rename "Group By: {Allocation => Call} Stack" in memory tool
- Rename "Label By: {Allocation => Call} Stack" in memory tool
- Get rid of "Internal Type" for labeling and grouping nodes
- Get rid of group by "Object Class" in memory tool
- Rename group/label by "Coarse Type" to plain "Type" in memory tool
This commit is contained in:
Nick Fitzgerald 2016-02-22 14:27:51 -08:00
parent 3a07b4cbf8
commit 33233f0cbd
12 changed files with 46 additions and 85 deletions

View File

@ -110,7 +110,7 @@ const OBJECT_CLASS = { by: "objectClass", then: COUNT, other: COUNT };
const breakdowns = exports.breakdowns = {
coarseType: {
displayName: "Coarse Type",
displayName: "Type",
get tooltip() {
// Importing down here is necessary because of the circular dependency
// this introduces with `./utils.js`.
@ -131,31 +131,13 @@ const breakdowns = exports.breakdowns = {
},
allocationStack: {
displayName: "Allocation Stack",
displayName: "Call Stack",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("breakdowns.allocationStack.tooltip");
},
breakdown: ALLOCATION_STACK,
},
objectClass: {
displayName: "Object Class",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("breakdowns.objectClass.tooltip");
},
breakdown: OBJECT_CLASS,
},
internalType: {
displayName: "Internal Type",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("breakdowns.internalType.tooltip");
},
breakdown: INTERNAL_TYPE,
},
};
const DOMINATOR_TREE_LABEL_COARSE_TYPE = {
@ -175,7 +157,7 @@ const DOMINATOR_TREE_LABEL_COARSE_TYPE = {
const dominatorTreeBreakdowns = exports.dominatorTreeBreakdowns = {
coarseType: {
displayName: "Coarse Type",
displayName: "Type",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("dominatorTreeBreakdowns.coarseType.tooltip");
@ -184,7 +166,7 @@ const dominatorTreeBreakdowns = exports.dominatorTreeBreakdowns = {
},
allocationStack: {
displayName: "Allocation Stack",
displayName: "Call Stack",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("dominatorTreeBreakdowns.allocationStack.tooltip");
@ -195,15 +177,6 @@ const dominatorTreeBreakdowns = exports.dominatorTreeBreakdowns = {
noStack: DOMINATOR_TREE_LABEL_COARSE_TYPE,
},
},
internalType: {
displayName: "Internal Type",
get tooltip() {
const { L10N } = require("./utils");
return L10N.getStr("dominatorTreeBreakdowns.internalType.tooltip");
},
breakdown: INTERNAL_TYPE,
},
};
/*** View States **************************************************************/

View File

@ -50,7 +50,7 @@ function catchAndIgnore(fn) {
* @see `js/src/doc/Debugger/Debugger.Memory.md`
*/
let breakdownModel = exports.breakdown = PropTypes.shape({
by: PropTypes.oneOf(["coarseType", "allocationStack", "objectClass", "internalType"]).isRequired,
by: PropTypes.string.isRequired,
});
let censusModel = exports.censusModel = PropTypes.shape({

View File

@ -61,10 +61,6 @@ exports.countCensus = makeInfallible(function ({ inverted, filter, diffing, brea
histogram.add(COARSE_TYPE);
} else if (breakdown === breakdowns.allocationStack.breakdown) {
histogram.add(ALLOCATION_STACK);
} else if (breakdown === breakdowns.objectClass.breakdown) {
histogram.add(OBJECT_CLASS);
} else if (breakdown === breakdowns.internalType.breakdown) {
histogram.add(INTERNAL_TYPE);
} else {
histogram.add(CUSTOM);
}
@ -91,8 +87,6 @@ exports.countDominatorTree = makeInfallible(function ({ breakdown }) {
histogram.add(COARSE_TYPE);
} else if (breakdown === dominatorTreeBreakdowns.allocationStack.breakdown) {
histogram.add(ALLOCATION_STACK);
} else if (breakdown === dominatorTreeBreakdowns.internalType.breakdown) {
histogram.add(INTERNAL_TYPE);
} else {
histogram.add(CUSTOM);
}

View File

@ -19,13 +19,9 @@ this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
info("Check coarse type heap view");
["objects", "other", "scripts", "strings"].forEach(findNameCell);
yield setBreakdown(panel.panelWin, "objectClass");
info("Check object class heap view");
["Function", "Object"].forEach(findNameCell);
yield setBreakdown(panel.panelWin, "internalType");
info("Check internal type heap view");
["JSObject"].forEach(findNameCell);
yield setBreakdown(panel.panelWin, "allocationStack");
info("Check allocation stack heap view");
[L10N.getStr("tree-item.nostack")].forEach(findNameCell);
function findNameCell (name) {
let el = Array.prototype.find.call($$(".tree .heap-tree-item-name span"), el => el.textContent === name);

View File

@ -28,11 +28,8 @@ this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
const doc = panel.panelWin.document;
yield dispatch(takeSnapshotAndCensus(front, heapWorker));
yield dispatch(breakdownActions.setBreakdownAndRefresh(heapWorker,
breakdowns.objectClass.breakdown));
is(getState().breakdown.by, "objectClass",
"Should be using object class breakdown");
is(getState().breakdown.by, "coarseType",
"Should be using coarse type breakdown");
const bytesCells = [...doc.querySelectorAll(".heap-tree-item-bytes")];
checkCells(bytesCells);

View File

@ -14,7 +14,7 @@ Services.scriptloader.loadSubScript(
this);
var { snapshotState: states } = require("devtools/client/memory/constants");
var { breakdownEquals, breakdownNameToSpec } = require("devtools/client/memory/utils");
var { breakdownEquals, breakdownNameToSpec, L10N } = require("devtools/client/memory/utils");
Services.prefs.setBoolPref("devtools.memory.enabled", true);

View File

@ -23,6 +23,7 @@ var HeapSnapshotFileUtils = require("devtools/shared/heapsnapshot/HeapSnapshotFi
var HeapAnalysesClient = require("devtools/shared/heapsnapshot/HeapAnalysesClient");
var { addDebuggerToGlobal } = require("resource://gre/modules/jsdebugger.jsm");
var Store = require("devtools/client/memory/store");
var { L10N } = require("devtools/client/memory/utils");
var SYSTEM_PRINCIPAL = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal);
function dumpn(msg) {
@ -80,11 +81,8 @@ function isBreakdownType (report, type) {
switch (type) {
case "coarseType":
return report.children.find(c => c.name === "objects");
case "objectClass":
return report.children.find(c => c.name === "Function");
case "internalType":
return report.children.find(c => c.name === "js::BaseShape") &&
!report.children.find(c => c.name === "objects");
case "allocationStack":
return report.children.find(c => c.name === "noStack");
default:
throw new Error(`isBreakdownType does not yet support ${type}`);
}

View File

@ -25,8 +25,8 @@ add_task(function *() {
// Test default breakdown with no snapshots
equal(getState().breakdown.by, "coarseType", "default coarseType breakdown selected at start.");
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.objectClass.breakdown));
equal(getState().breakdown.by, "objectClass", "breakdown changed with no snapshots");
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.allocationStack.breakdown));
equal(getState().breakdown.by, "allocationStack", "breakdown changed with no snapshots");
// Test invalid breakdowns
ok(getState().errors.length === 0, "No error actions in the queue.");
@ -34,13 +34,13 @@ add_task(function *() {
yield waitUntilState(store, () => getState().errors.length === 1);
ok(true, "Emits an error action when passing in an invalid breakdown object");
equal(getState().breakdown.by, "objectClass",
equal(getState().breakdown.by, "allocationStack",
"current breakdown unchanged when passing invalid breakdown");
// Test new snapshots
dispatch(takeSnapshotAndCensus(front, heapWorker));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS]);
ok(isBreakdownType(getState().snapshots[0].census.report, "objectClass"),
ok(isBreakdownType(getState().snapshots[0].census.report, "allocationStack"),
"New snapshots use the current, non-default breakdown");
@ -57,21 +57,24 @@ add_task(function *() {
// Updates when changing breakdown during `SAVING_CENSUS`
dispatch(takeSnapshotAndCensus(front, heapWorker));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS, states.SAVED_CENSUS, states.SAVING_CENSUS]);
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.objectClass.breakdown));
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.allocationStack.breakdown));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS, states.SAVED_CENSUS, states.SAVED_CENSUS]);
ok(breakdownEquals(getState().snapshots[2].census.breakdown, breakdowns.objectClass.breakdown),
ok(breakdownEquals(getState().snapshots[2].census.breakdown, breakdowns.allocationStack.breakdown),
"Breakdown can be changed while saving census, stores updated breakdown in snapshot");
ok(isBreakdownType(getState().snapshots[2].census.report, "objectClass"),
ok(isBreakdownType(getState().snapshots[2].census.report, "allocationStack"),
"Breakdown can be changed while saving census, uses updated breakdown in census");
// Updates census on currently selected snapshot when changing breakdown
ok(getState().snapshots[2].selected, "Third snapshot currently selected");
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.internalType.breakdown));
yield waitUntilState(store, () => isBreakdownType(getState().snapshots[2].census.report, "internalType"));
ok(isBreakdownType(getState().snapshots[2].census.report, "internalType"),
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.coarseType.breakdown));
yield waitUntilState(store, () => isBreakdownType(getState().snapshots[2].census.report, "coarseType"));
ok(isBreakdownType(getState().snapshots[2].census.report, "coarseType"),
"Snapshot census updated when changing breakdowns after already generating one census");
dispatch(setBreakdownAndRefresh(heapWorker, breakdowns.allocationStack.breakdown));
yield waitUntilState(store, () => isBreakdownType(getState().snapshots[2].census.report, "allocationStack"));
// Does not update unselected censuses
ok(!getState().snapshots[1].selected, "Second snapshot unselected currently");
ok(breakdownEquals(getState().snapshots[1].census.breakdown, breakdowns.coarseType.breakdown),
@ -85,10 +88,10 @@ add_task(function *() {
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS, states.SAVED_CENSUS, states.SAVED_CENSUS]);
ok(getState().snapshots[1].selected, "Second snapshot selected currently");
ok(breakdownEquals(getState().snapshots[1].census.breakdown, breakdowns.internalType.breakdown),
"Second snapshot using `internalType` breakdown and updated to correct breakdown");
ok(isBreakdownType(getState().snapshots[1].census.report, "internalType"),
"Second snapshot using `internalType` for census and updated to correct breakdown");
ok(breakdownEquals(getState().snapshots[1].census.breakdown, breakdowns.allocationStack.breakdown),
"Second snapshot using `allocationStack` breakdown and updated to correct breakdown");
ok(isBreakdownType(getState().snapshots[1].census.report, "allocationStack"),
"Second snapshot using `allocationStack` for census and updated to correct breakdown");
heapWorker.destroy();
yield front.detach();

View File

@ -24,8 +24,8 @@ add_task(function *() {
// Test default breakdown with no snapshots
equal(getState().breakdown.by, "coarseType", "default coarseType breakdown selected at start.");
dispatch(setBreakdown(breakdowns.objectClass.breakdown));
equal(getState().breakdown.by, "objectClass", "breakdown changed with no snapshots");
dispatch(setBreakdown(breakdowns.allocationStack.breakdown));
equal(getState().breakdown.by, "allocationStack", "breakdown changed with no snapshots");
// Test invalid breakdowns
try {
@ -34,12 +34,12 @@ add_task(function *() {
} catch (e) {
ok(true, "Throws when passing in an invalid breakdown object");
}
equal(getState().breakdown.by, "objectClass",
equal(getState().breakdown.by, "allocationStack",
"current breakdown unchanged when passing invalid breakdown");
// Test new snapshots
dispatch(takeSnapshotAndCensus(front, heapWorker));
yield waitUntilSnapshotState(store, [states.SAVED_CENSUS]);
ok(isBreakdownType(getState().snapshots[0].census.report, "objectClass"),
ok(isBreakdownType(getState().snapshots[0].census.report, "allocationStack"),
"New snapshots use the current, non-default breakdown");
});

View File

@ -71,7 +71,7 @@ add_task(function *() {
name: "changing breakdowns",
func: () =>
dispatch(setBreakdownAndRefresh(heapWorker,
breakdowns.objectClass.breakdown))
breakdowns.allocationStack.breakdown))
}
];

View File

@ -55,10 +55,10 @@ add_task(function *() {
getState().snapshots[0].dominatorTree.breakdown,
"and the newly computed dominator tree has that breakdown");
// Switch to the internalType breakdown.
// Switch to the allocationStack breakdown.
dispatch(setDominatorTreeBreakdownAndRefresh(
heapWorker,
dominatorTreeBreakdowns.internalType.breakdown));
dominatorTreeBreakdowns.allocationStack.breakdown));
yield waitUntilState(store, state =>
state.snapshots[0].dominatorTree.state === dominatorTreeState.FETCHING);
@ -69,10 +69,10 @@ add_task(function *() {
yield waitUntilState(store, state =>
state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED);
equal(getState().snapshots[0].dominatorTree.breakdown,
dominatorTreeBreakdowns.internalType.breakdown,
"The new dominator tree's breakdown is internalType");
dominatorTreeBreakdowns.allocationStack.breakdown,
"The new dominator tree's breakdown is allocationStack");
equal(getState().dominatorTreeBreakdown,
dominatorTreeBreakdowns.internalType.breakdown,
dominatorTreeBreakdowns.allocationStack.breakdown,
"as is our requested dominator tree breakdown");
heapWorker.destroy();

View File

@ -55,21 +55,21 @@ add_task(function *() {
getState().snapshots[0].dominatorTree.breakdown,
"and the newly computed dominator tree has that breakdown");
// Switch to the internalType breakdown while we are still fetching the
// Switch to the allocationStack breakdown while we are still fetching the
// dominator tree.
dispatch(setDominatorTreeBreakdownAndRefresh(
heapWorker,
dominatorTreeBreakdowns.internalType.breakdown));
dominatorTreeBreakdowns.allocationStack.breakdown));
// Wait for the dominator tree to finish being fetched.
yield waitUntilState(store, state =>
state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED);
equal(getState().snapshots[0].dominatorTree.breakdown,
dominatorTreeBreakdowns.internalType.breakdown,
"The new dominator tree's breakdown is internalType");
dominatorTreeBreakdowns.allocationStack.breakdown,
"The new dominator tree's breakdown is allocationStack");
equal(getState().dominatorTreeBreakdown,
dominatorTreeBreakdowns.internalType.breakdown,
dominatorTreeBreakdowns.allocationStack.breakdown,
"as is our requested dominator tree breakdown");
heapWorker.destroy();