Merge f-t to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2015-05-25 19:17:04 -07:00
commit cc8f9e31d6
29 changed files with 186 additions and 235 deletions

View File

@ -14,7 +14,7 @@ loader.lazyRequireGetter(this, "Poller",
loader.lazyRequireGetter(this, "CompatUtils",
"devtools/performance/compatibility");
loader.lazyRequireGetter(this, "RecordingUtils",
"devtools/performance/recording-utils", true);
"devtools/performance/recording-utils");
loader.lazyRequireGetter(this, "TimelineFront",
"devtools/server/actors/timeline", true);
loader.lazyRequireGetter(this, "MemoryFront",
@ -207,10 +207,6 @@ ProfilerFrontFacade.prototype = {
toString: () => "[object ProfilerFrontFacade]"
};
// Bind all the methods that directly proxy to the actor
PROFILER_ACTOR_METHODS.forEach(method => ProfilerFrontFacade.prototype[method] = CompatUtils.actorCompatibilityBridge(method));
exports.ProfilerFront = ProfilerFrontFacade;
/**
* Constructor for a facade around an underlying TimelineFront.
*/
@ -258,10 +254,6 @@ TimelineFrontFacade.prototype = {
toString: () => "[object TimelineFrontFacade]"
};
// Bind all the methods that directly proxy to the actor
TIMELINE_ACTOR_METHODS.forEach(method => TimelineFrontFacade.prototype[method] = CompatUtils.actorCompatibilityBridge(method));
exports.TimelineFront = TimelineFrontFacade;
/**
* Constructor for a facade around an underlying ProfilerFront.
*/
@ -378,5 +370,10 @@ MemoryFrontFacade.prototype = {
};
// Bind all the methods that directly proxy to the actor
MEMORY_ACTOR_METHODS.forEach(method => MemoryFrontFacade.prototype[method] = CompatUtils.actorCompatibilityBridge(method));
PROFILER_ACTOR_METHODS.forEach(m => ProfilerFrontFacade.prototype[m] = CompatUtils.actorCompatibilityBridge(m));
TIMELINE_ACTOR_METHODS.forEach(m => TimelineFrontFacade.prototype[m] = CompatUtils.actorCompatibilityBridge(m));
MEMORY_ACTOR_METHODS.forEach(m => MemoryFrontFacade.prototype[m] = CompatUtils.actorCompatibilityBridge(m));
exports.ProfilerFront = ProfilerFrontFacade;
exports.TimelineFront = TimelineFrontFacade;
exports.MemoryFront = MemoryFrontFacade;

View File

@ -3,8 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Task } = require("resource://gre/modules/Task.jsm");
loader.lazyRequireGetter(this, "promise");
loader.lazyRequireGetter(this, "EventEmitter",
"devtools/toolkit/event-emitter");
@ -36,7 +34,6 @@ function MockMemoryFront () {
["getAllocations", createMockAllocations],
]);
}
exports.MockMemoryFront = MockMemoryFront;
function MockTimelineFront () {
MockFront.call(this, [
@ -45,7 +42,6 @@ function MockTimelineFront () {
["stop", 0],
]);
}
exports.MockTimelineFront = MockTimelineFront;
/**
* Create a fake allocations object, to be used with the MockMemoryFront
@ -86,7 +82,6 @@ function memoryActorSupported (target) {
// but no memory actor (like addon debugging in Gecko 38+)
return !!target.getTrait("memoryActorAllocations") && target.hasActor("memory");
}
exports.memoryActorSupported = Task.async(memoryActorSupported);
/**
* Takes a TabTarget, and checks existence of a TimelineActor on
@ -104,7 +99,6 @@ function timelineActorSupported(target) {
return target.hasActor("timeline");
}
exports.timelineActorSupported = Task.async(timelineActorSupported);
/**
* Returns a promise resolving to the location of the profiler actor
@ -131,7 +125,6 @@ function getProfiler (target) {
}
return deferred.promise;
}
exports.getProfiler = Task.async(getProfiler);
/**
* Makes a request to an actor that does not have the modern `Front`
@ -176,4 +169,10 @@ function actorCompatibilityBridge (method) {
}
};
}
exports.MockMemoryFront = MockMemoryFront;
exports.MockTimelineFront = MockTimelineFront;
exports.memoryActorSupported = memoryActorSupported;
exports.timelineActorSupported = timelineActorSupported;
exports.getProfiler = getProfiler;
exports.actorCompatibilityBridge = actorCompatibilityBridge;

View File

@ -42,7 +42,7 @@ const gInflatedFrameStore = new WeakMap();
* Parses the raw location of this function call to retrieve the actual
* function name, source url, host name, line and column.
*/
exports.parseLocation = function parseLocation(location, fallbackLine, fallbackColumn) {
function parseLocation(location, fallbackLine, fallbackColumn) {
// Parse the `location` for the function name, source url, line, column etc.
let line, column, url;
@ -190,7 +190,6 @@ function isContent({ location, category }) {
// If there was no left parenthesis, try matching from the start.
return isContentScheme(location, 0);
}
exports.isContent = isContent;
/**
* Get caches to cache inflated frames and computed frame keys of a frame
@ -199,7 +198,7 @@ exports.isContent = isContent;
* @param object framesTable
* @return object
*/
exports.getInflatedFrameCache = function getInflatedFrameCache(frameTable) {
function getInflatedFrameCache(frameTable) {
let inflatedCache = gInflatedFrameStore.get(frameTable);
if (inflatedCache !== undefined) {
return inflatedCache;
@ -220,7 +219,7 @@ exports.getInflatedFrameCache = function getInflatedFrameCache(frameTable) {
* @param object stringTable
* @param object allocationsTable
*/
exports.getOrAddInflatedFrame = function getOrAddInflatedFrame(cache, index, frameTable, stringTable, allocationsTable) {
function getOrAddInflatedFrame(cache, index, frameTable, stringTable, allocationsTable) {
let inflatedFrame = cache[index];
if (inflatedFrame === null) {
inflatedFrame = cache[index] = new InflatedFrame(index, frameTable, stringTable, allocationsTable);
@ -292,8 +291,6 @@ InflatedFrame.prototype.getFrameKey = function getFrameKey(options) {
return "";
};
exports.InflatedFrame = InflatedFrame;
/**
* Helper for getting an nsIURL instance out of a string.
*/
@ -420,3 +417,9 @@ function isChromeScheme(location, i) {
function isNumeric(c) {
return c >= CHAR_CODE_0 && c <= CHAR_CODE_9;
}
exports.parseLocation = parseLocation;
exports.isContent = isContent;
exports.getInflatedFrameCache = getInflatedFrameCache;
exports.getOrAddInflatedFrame = getOrAddInflatedFrame;
exports.InflatedFrame = InflatedFrame;

View File

@ -534,5 +534,5 @@ function getRecordingModelPrefs () {
};
}
exports.getPerformanceActorsConnection = target => SharedPerformanceActors.forTarget(target);
exports.getPerformanceActorsConnection = t => SharedPerformanceActors.forTarget(t);
exports.PerformanceFront = PerformanceFront;

View File

@ -8,7 +8,7 @@ const { Cc, Ci, Cu, Cr } = require("chrome");
loader.lazyRequireGetter(this, "Services");
loader.lazyRequireGetter(this, "promise");
loader.lazyRequireGetter(this, "RecordingUtils",
"devtools/performance/recording-utils", true);
"devtools/performance/recording-utils");
loader.lazyImporter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
@ -111,8 +111,6 @@ let PerformanceIO = {
}
};
exports.PerformanceIO = PerformanceIO;
/**
* Returns a boolean indicating whether or not the passed in `version`
* is supported by this serializer.
@ -161,3 +159,5 @@ function convertLegacyData (legacyData) {
return data;
}
exports.PerformanceIO = PerformanceIO;

View File

@ -114,7 +114,7 @@ const SUCCESSFUL_OUTCOMES = [
* @type {number} id
*/
const OptimizationSite = exports.OptimizationSite = function (id, opts) {
const OptimizationSite = function (id, opts) {
this.id = id;
this.data = opts;
this.samples = 1;
@ -166,7 +166,7 @@ OptimizationSite.prototype.getIonTypes = function () {
* JIT optimizations. Do not modify this!
*/
const JITOptimizations = exports.JITOptimizations = function (rawSites, stringTable) {
const JITOptimizations = function (rawSites, stringTable) {
// Build a histogram of optimization sites.
let sites = [];
@ -238,3 +238,6 @@ function maybeTypeset(typeset, stringTable) {
};
});
}
exports.OptimizationSite = OptimizationSite;
exports.JITOptimizations = JITOptimizations;

View File

@ -28,7 +28,6 @@ function getMarkerLabel (marker) {
// as a string.
return typeof blueprint.label === "function" ? blueprint.label(marker) : blueprint.label;
}
exports.getMarkerLabel = getMarkerLabel;
/**
* Returns the correct generic name for a marker class, like "Function Call"
@ -57,7 +56,6 @@ function getMarkerClassName (type) {
return className;
}
exports.getMarkerClassName = getMarkerClassName;
/**
* Returns an array of objects with key/value pairs of what should be rendered
@ -92,12 +90,11 @@ function getMarkerFields (marker) {
return fields;
}, []);
}
exports.getMarkerFields = getMarkerFields;
/**
* Utilites for creating elements for markers.
*/
const DOM = exports.DOM = {
const DOM = {
/**
* Builds all the fields possible for the given marker. Returns an
* array of elements to be appended to a parent element.
@ -272,3 +269,8 @@ const DOM = exports.DOM = {
return container;
}
};
exports.getMarkerLabel = getMarkerLabel;
exports.getMarkerClassName = getMarkerClassName;
exports.getMarkerFields = getMarkerFields;
exports.DOM = DOM;

View File

@ -9,7 +9,7 @@ const { Task } = require("resource://gre/modules/Task.jsm");
loader.lazyRequireGetter(this, "PerformanceIO",
"devtools/performance/io", true);
loader.lazyRequireGetter(this, "RecordingUtils",
"devtools/performance/recording-utils", true);
"devtools/performance/recording-utils");
/**
* Model for a wholistic profile, containing the duration, profiling data,

View File

@ -10,8 +10,6 @@ const { Cc, Ci, Cu, Cr } = require("chrome");
* such as filtering profile samples or offsetting timestamps.
*/
exports.RecordingUtils = {};
/**
* Filters all the samples in the provided profiler data to be more recent
* than the specified start time.
@ -21,7 +19,7 @@ exports.RecordingUtils = {};
* @param number profilerStartTime
* The earliest acceptable sample time (in milliseconds).
*/
exports.RecordingUtils.filterSamples = function(profile, profilerStartTime) {
function filterSamples(profile, profilerStartTime) {
let firstThread = profile.threads[0];
const TIME_SLOT = firstThread.samples.schema.time;
firstThread.samples.data = firstThread.samples.data.filter(e => {
@ -37,7 +35,7 @@ exports.RecordingUtils.filterSamples = function(profile, profilerStartTime) {
* @param number timeOffset
* The amount of time to offset by (in milliseconds).
*/
exports.RecordingUtils.offsetSampleTimes = function(profile, timeOffset) {
function offsetSampleTimes(profile, timeOffset) {
let firstThread = profile.threads[0];
const TIME_SLOT = firstThread.samples.schema.time;
let samplesData = firstThread.samples.data;
@ -54,7 +52,7 @@ exports.RecordingUtils.offsetSampleTimes = function(profile, timeOffset) {
* @param number timeOffset
* The amount of time to offset by (in milliseconds).
*/
exports.RecordingUtils.offsetMarkerTimes = function(markers, timeOffset) {
function offsetMarkerTimes(markers, timeOffset) {
for (let marker of markers) {
marker.start -= timeOffset;
marker.end -= timeOffset;
@ -72,7 +70,7 @@ exports.RecordingUtils.offsetMarkerTimes = function(markers, timeOffset) {
* @param number timeScale
* The factor to scale by, after offsetting.
*/
exports.RecordingUtils.offsetAndScaleTimestamps = function(timestamps, timeOffset, timeScale) {
function offsetAndScaleTimestamps(timestamps, timeOffset, timeScale) {
for (let i = 0, len = timestamps.length; i < len; i++) {
timestamps[i] -= timeOffset;
timestamps[i] /= timeScale;
@ -95,7 +93,7 @@ let gProfileThreadFromAllocationCache = new WeakMap();
* @return object
* The "profile" describing the allocations log.
*/
exports.RecordingUtils.getProfileThreadFromAllocations = function(allocations) {
function getProfileThreadFromAllocations(allocations) {
let cached = gProfileThreadFromAllocationCache.get(allocations);
if (cached) {
return cached;
@ -208,7 +206,7 @@ exports.RecordingUtils.getProfileThreadFromAllocations = function(allocations) {
* @return object
* The filtered timeline blueprint.
*/
exports.RecordingUtils.getFilteredBlueprint = function({ blueprint, hiddenMarkers }) {
function getFilteredBlueprint({ blueprint, hiddenMarkers }) {
// Clone functions here just to prevent an error, as the blueprint
// contains functions (even though we do not use them).
let filteredBlueprint = Cu.cloneInto(blueprint, {}, { cloneFunctions: true });
@ -259,7 +257,7 @@ exports.RecordingUtils.getFilteredBlueprint = function({ blueprint, hiddenMarker
* @param object profile
* A profile with version 2.
*/
exports.RecordingUtils.deflateProfile = function deflateProfile(profile) {
function deflateProfile(profile) {
profile.threads = profile.threads.map((thread) => {
let uniqueStacks = new UniqueStacks();
return deflateThread(thread, uniqueStacks);
@ -379,7 +377,6 @@ function deflateThread(thread, uniqueStacks) {
stringTable: uniqueStacks.getStringTable()
};
}
exports.RecordingUtils.deflateThread = deflateThread;
function stackTableWithSchema(data) {
let slot = 0;
@ -448,8 +445,6 @@ UniqueStrings.prototype.getOrAddStringIndex = function(s) {
return index;
};
exports.RecordingUtils.UniqueStrings = UniqueStrings;
/**
* A helper class to deduplicate old-version profiles.
*
@ -571,4 +566,13 @@ UniqueStacks.prototype.getOrAddStringIndex = function(s) {
return this._uniqueStrings.getOrAddStringIndex(s);
};
exports.RecordingUtils.UniqueStacks = UniqueStacks;
exports.filterSamples = filterSamples;
exports.offsetSampleTimes = offsetSampleTimes;
exports.offsetMarkerTimes = offsetMarkerTimes;
exports.offsetAndScaleTimestamps = offsetAndScaleTimestamps;
exports.getProfileThreadFromAllocations = getProfileThreadFromAllocations;
exports.getFilteredBlueprint = getFilteredBlueprint;
exports.deflateProfile = deflateProfile;
exports.deflateThread = deflateThread;
exports.UniqueStrings = UniqueStrings;
exports.UniqueStacks = UniqueStacks;

View File

@ -20,10 +20,6 @@ loader.lazyRequireGetter(this, "JITOptimizations",
loader.lazyRequireGetter(this, "FrameUtils",
"devtools/performance/frame-utils");
exports.ThreadNode = ThreadNode;
exports.FrameNode = FrameNode;
exports.FrameNode.isContent = FrameUtils.isContent;
/**
* A call tree for a thread. This is essentially a linkage between all frames
* of all samples into a single tree structure, with additional information
@ -502,3 +498,6 @@ FrameNode.prototype = {
return new JITOptimizations(this._optimizations, this._stringTable);
}
};
exports.ThreadNode = ThreadNode;
exports.FrameNode = FrameNode;

View File

@ -100,8 +100,6 @@ MarkerDetails.prototype = {
},
};
exports.MarkerDetails = MarkerDetails;
/**
* Take an element from an event `target`, and asend through
* the DOM, looking for an element with a `data-action` attribute. Return
@ -123,3 +121,5 @@ function findActionFromEvent (target, container) {
}
return null;
}
exports.MarkerDetails = MarkerDetails;

View File

@ -41,8 +41,6 @@ const DEFAULT_VISIBLE_CELLS = {
const clamp = (val, min, max) => Math.max(min, Math.min(max, val));
const sum = vals => vals.reduce((a, b) => a + b, 0);
exports.CallView = CallView;
/**
* An item in a call tree view, which looks like this:
*
@ -123,34 +121,32 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
* @return nsIDOMNode
*/
_displaySelf: function(document, arrowNode) {
this.document = document;
let displayedData = this.getDisplayedData();
let frameInfo = this.frame.getInfo();
if (this.visibleCells.duration) {
var durationCell = this._createTimeCell(displayedData.totalDuration);
var durationCell = this._createTimeCell(document, displayedData.totalDuration);
}
if (this.visibleCells.selfDuration) {
var selfDurationCell = this._createTimeCell(displayedData.selfDuration, true);
var selfDurationCell = this._createTimeCell(document, displayedData.selfDuration, true);
}
if (this.visibleCells.percentage) {
var percentageCell = this._createExecutionCell(displayedData.totalPercentage);
var percentageCell = this._createExecutionCell(document, displayedData.totalPercentage);
}
if (this.visibleCells.selfPercentage) {
var selfPercentageCell = this._createExecutionCell(displayedData.selfPercentage, true);
var selfPercentageCell = this._createExecutionCell(document, displayedData.selfPercentage, true);
}
if (this.visibleCells.allocations) {
var allocationsCell = this._createAllocationsCell(displayedData.totalAllocations);
var allocationsCell = this._createAllocationsCell(document, displayedData.totalAllocations);
}
if (this.visibleCells.selfAllocations) {
var selfAllocationsCell = this._createAllocationsCell(displayedData.selfAllocations, true);
var selfAllocationsCell = this._createAllocationsCell(document, displayedData.selfAllocations, true);
}
if (this.visibleCells.samples) {
var samplesCell = this._createSamplesCell(displayedData.samples);
var samplesCell = this._createSamplesCell(document, displayedData.samples);
}
if (this.visibleCells.function) {
var functionCell = this._createFunctionCell(arrowNode, displayedData.name, frameInfo, this.level);
var functionCell = this._createFunctionCell(document, arrowNode, displayedData.name, frameInfo, this.level);
}
let targetNode = document.createElement("hbox");
@ -216,40 +212,40 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
* Functions creating each cell in this call view.
* Invoked by `_displaySelf`.
*/
_createTimeCell: function(duration, isSelf = false) {
let cell = this.document.createElement("label");
_createTimeCell: function(doc, duration, isSelf = false) {
let cell = doc.createElement("label");
cell.className = "plain call-tree-cell";
cell.setAttribute("type", isSelf ? "self-duration" : "duration");
cell.setAttribute("crop", "end");
cell.setAttribute("value", L10N.numberWithDecimals(duration, 2) + " " + MILLISECOND_UNITS);
return cell;
},
_createExecutionCell: function(percentage, isSelf = false) {
let cell = this.document.createElement("label");
_createExecutionCell: function(doc, percentage, isSelf = false) {
let cell = doc.createElement("label");
cell.className = "plain call-tree-cell";
cell.setAttribute("type", isSelf ? "self-percentage" : "percentage");
cell.setAttribute("crop", "end");
cell.setAttribute("value", L10N.numberWithDecimals(percentage, 2) + PERCENTAGE_UNITS);
return cell;
},
_createAllocationsCell: function(count, isSelf = false) {
let cell = this.document.createElement("label");
_createAllocationsCell: function(doc, count, isSelf = false) {
let cell = doc.createElement("label");
cell.className = "plain call-tree-cell";
cell.setAttribute("type", isSelf ? "self-allocations" : "allocations");
cell.setAttribute("crop", "end");
cell.setAttribute("value", count || 0);
return cell;
},
_createSamplesCell: function(count) {
let cell = this.document.createElement("label");
_createSamplesCell: function(doc, count) {
let cell = doc.createElement("label");
cell.className = "plain call-tree-cell";
cell.setAttribute("type", "samples");
cell.setAttribute("crop", "end");
cell.setAttribute("value", count || "");
return cell;
},
_createFunctionCell: function(arrowNode, frameName, frameInfo, frameLevel) {
let cell = this.document.createElement("hbox");
_createFunctionCell: function(doc, arrowNode, frameName, frameInfo, frameLevel) {
let cell = doc.createElement("hbox");
cell.className = "call-tree-cell";
cell.style.MozMarginStart = (frameLevel * CALL_TREE_INDENTATION) + "px";
cell.setAttribute("type", "function");
@ -258,7 +254,7 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
// Don't render a name label node if there's no function name. A different
// location label node will be rendered instead.
if (frameName) {
let nameNode = this.document.createElement("label");
let nameNode = doc.createElement("label");
nameNode.className = "plain call-tree-name";
nameNode.setAttribute("flex", "1");
nameNode.setAttribute("crop", "end");
@ -268,7 +264,7 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
// Don't render detailed labels for meta category frames
if (!frameInfo.isMetaCategory) {
this._appendFunctionDetailsCells(cell, frameInfo);
this._appendFunctionDetailsCells(doc, cell, frameInfo);
}
// Don't render an expando-arrow for leaf nodes.
@ -279,9 +275,9 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
return cell;
},
_appendFunctionDetailsCells: function(cell, frameInfo) {
_appendFunctionDetailsCells: function(doc, cell, frameInfo) {
if (frameInfo.fileName) {
let urlNode = this.document.createElement("label");
let urlNode = doc.createElement("label");
urlNode.className = "plain call-tree-url";
urlNode.setAttribute("flex", "1");
urlNode.setAttribute("crop", "end");
@ -292,32 +288,32 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
}
if (frameInfo.line) {
let lineNode = this.document.createElement("label");
let lineNode = doc.createElement("label");
lineNode.className = "plain call-tree-line";
lineNode.setAttribute("value", ":" + frameInfo.line);
cell.appendChild(lineNode);
}
if (frameInfo.column) {
let columnNode = this.document.createElement("label");
let columnNode = doc.createElement("label");
columnNode.className = "plain call-tree-column";
columnNode.setAttribute("value", ":" + frameInfo.column);
cell.appendChild(columnNode);
}
if (frameInfo.host) {
let hostNode = this.document.createElement("label");
let hostNode = doc.createElement("label");
hostNode.className = "plain call-tree-host";
hostNode.setAttribute("value", frameInfo.host);
cell.appendChild(hostNode);
}
let spacerNode = this.document.createElement("spacer");
let spacerNode = doc.createElement("spacer");
spacerNode.setAttribute("flex", "10000");
cell.appendChild(spacerNode);
if (frameInfo.categoryData.label) {
let categoryNode = this.document.createElement("label");
let categoryNode = doc.createElement("label");
categoryNode.className = "plain call-tree-category";
categoryNode.style.color = frameInfo.categoryData.color;
categoryNode.setAttribute("value", frameInfo.categoryData.label);
@ -402,3 +398,5 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
this.root.emit("link", this);
}
});
exports.CallView = CallView;

View File

@ -20,7 +20,7 @@ loader.lazyRequireGetter(this, "L10N",
loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT",
"devtools/performance/global", true);
loader.lazyRequireGetter(this, "RecordingUtils",
"devtools/performance/recording-utils", true);
"devtools/performance/recording-utils");
loader.lazyRequireGetter(this, "RecordingModel",
"devtools/performance/recording-model", true);
loader.lazyRequireGetter(this, "GraphsController",

View File

@ -8,7 +8,7 @@
*/
function test() {
let { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
let RecordingUtils = devtools.require("devtools/performance/recording-utils");
let output = RecordingUtils.getProfileThreadFromAllocations(TEST_DATA);
is(output.toSource(), EXPECTED_OUTPUT.toSource(), "The output is correct.");

View File

@ -5,7 +5,8 @@
* Tests that the call tree up/down events work for js calltree and memory calltree.
*/
const { ThreadNode } = devtools.require("devtools/performance/tree-model");
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils")
const RecordingUtils = devtools.require("devtools/performance/recording-utils")
function spawnTest () {
let focus = 0;
let focusEvent = () => focus++;

View File

@ -7,7 +7,7 @@
* FrameNode, and the returning of that data is as expected.
*/
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
function test() {
let { JITOptimizations } = devtools.require("devtools/performance/jit");

View File

@ -6,7 +6,7 @@
* OptimizationSites methods work as expected.
*/
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
function test() {
let { JITOptimizations, OptimizationSite } = devtools.require("devtools/performance/jit");

View File

@ -6,7 +6,7 @@
* if on, and displays selected frames on focus.
*/
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
Services.prefs.setBoolPref(INVERT_PREF, false);

View File

@ -7,7 +7,7 @@
*/
const { CATEGORY_MASK } = devtools.require("devtools/performance/global");
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
Services.prefs.setBoolPref(INVERT_PREF, false);
Services.prefs.setBoolPref(PLATFORM_DATA_PREF, false);

View File

@ -5,7 +5,7 @@
* Tests if the performance tool can import profiler data from the
* original profiler tool (Performance Recording v1, and Profiler data v2) and the correct views and graphs are loaded.
*/
let { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
let RecordingUtils = devtools.require("devtools/performance/recording-utils");
let TICKS_DATA = (function () {
let ticks = [];

View File

@ -7,44 +7,44 @@
*/
function test() {
let { FrameNode } = devtools.require("devtools/performance/tree-model");
let FrameUtils = devtools.require("devtools/performance/frame-utils");
ok(FrameNode.isContent({ location: "http://foo" }),
ok(FrameUtils.isContent({ location: "http://foo" }),
"Verifying content/chrome frames is working properly.");
ok(FrameNode.isContent({ location: "https://foo" }),
ok(FrameUtils.isContent({ location: "https://foo" }),
"Verifying content/chrome frames is working properly.");
ok(FrameNode.isContent({ location: "file://foo" }),
ok(FrameUtils.isContent({ location: "file://foo" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "chrome://foo" }),
ok(!FrameUtils.isContent({ location: "chrome://foo" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "resource://foo" }),
ok(!FrameUtils.isContent({ location: "resource://foo" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "chrome://foo -> http://bar" }),
ok(!FrameUtils.isContent({ location: "chrome://foo -> http://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "chrome://foo -> https://bar" }),
ok(!FrameUtils.isContent({ location: "chrome://foo -> https://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "chrome://foo -> file://bar" }),
ok(!FrameUtils.isContent({ location: "chrome://foo -> file://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "resource://foo -> http://bar" }),
ok(!FrameUtils.isContent({ location: "resource://foo -> http://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "resource://foo -> https://bar" }),
ok(!FrameUtils.isContent({ location: "resource://foo -> https://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ location: "resource://foo -> file://bar" }),
ok(!FrameUtils.isContent({ location: "resource://foo -> file://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ category: 1, location: "chrome://foo" }),
ok(!FrameUtils.isContent({ category: 1, location: "chrome://foo" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ category: 1, location: "resource://foo" }),
ok(!FrameUtils.isContent({ category: 1, location: "resource://foo" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ category: 1, location: "file://foo -> http://bar" }),
ok(!FrameUtils.isContent({ category: 1, location: "file://foo -> http://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ category: 1, location: "file://foo -> https://bar" }),
ok(!FrameUtils.isContent({ category: 1, location: "file://foo -> https://bar" }),
"Verifying content/chrome frames is working properly.");
ok(!FrameNode.isContent({ category: 1, location: "file://foo -> file://bar" }),
ok(!FrameUtils.isContent({ category: 1, location: "file://foo -> file://bar" }),
"Verifying content/chrome frames is working properly.");
finish();

View File

@ -6,13 +6,14 @@
*/
function test() {
let FrameUtils = devtools.require("devtools/performance/frame-utils");
let { FrameNode } = devtools.require("devtools/performance/tree-model");
let { CATEGORY_OTHER } = devtools.require("devtools/performance/global");
let frame1 = new FrameNode("hello/<.world (http://foo/bar.js:123:987)", {
location: "hello/<.world (http://foo/bar.js:123:987)",
line: 456,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "hello/<.world (http://foo/bar.js:123:987)"
})
}, false);
@ -39,7 +40,7 @@ function test() {
let frame2 = new FrameNode("hello/<.world (http://foo/bar.js#baz:123:987)", {
location: "hello/<.world (http://foo/bar.js#baz:123:987)",
line: 456,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "hello/<.world (http://foo/bar.js#baz:123:987)"
})
}, false);
@ -66,7 +67,7 @@ function test() {
let frame3 = new FrameNode("hello/<.world (http://foo/#bar:123:987)", {
location: "hello/<.world (http://foo/#bar:123:987)",
line: 456,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "hello/<.world (http://foo/#bar:123:987)"
})
}, false);
@ -93,7 +94,7 @@ function test() {
let frame4 = new FrameNode("hello/<.world (http://foo/:123:987)", {
location: "hello/<.world (http://foo/:123:987)",
line: 456,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "hello/<.world (http://foo/:123:987)"
})
}, false);
@ -120,7 +121,7 @@ function test() {
let frame5 = new FrameNode("hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)", {
location: "hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)",
line: 456,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)"
})
}, false);
@ -148,7 +149,7 @@ function test() {
location: "Foo::Bar::Baz",
line: 456,
category: CATEGORY_OTHER,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "Foo::Bar::Baz",
category: CATEGORY_OTHER
})
@ -173,7 +174,7 @@ function test() {
let frame7 = new FrameNode("EnterJIT", {
location: "EnterJIT",
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "EnterJIT"
})
}, false);
@ -217,7 +218,7 @@ function test() {
let frame10 = new FrameNode("main (http://localhost:8888/file.js:123:987)", {
location: "main (http://localhost:8888/file.js:123:987)",
line: 123,
isContent: FrameNode.isContent({
isContent: FrameUtils.isContent({
location: "main (http://localhost:8888/file.js:123:987)"
})
}, false);

View File

@ -6,7 +6,7 @@
* the FrameNodes have the correct optimization data after iterating over samples.
*/
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
let gUniqueStacks = new RecordingUtils.UniqueStacks();

View File

@ -557,7 +557,7 @@ function getFrameNodePath(root, path) {
* Synthesize a profile for testing.
*/
function synthesizeProfileForTest(samples) {
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
samples.unshift({
time: 0,

View File

@ -21,6 +21,8 @@ let MemoryCallTreeView = Heritage.extend(DetailsSubview, {
DetailsSubview.initialize.call(this);
this._onLink = this._onLink.bind(this);
this.container = $("#memory-calltree-view > .call-tree-cells-container");
},
/**
@ -35,10 +37,11 @@ let MemoryCallTreeView = Heritage.extend(DetailsSubview, {
*
* @param object interval [optional]
* The { startTime, endTime }, in milliseconds.
* @param object options [optional]
* Additional options for new the call tree.
*/
render: function (interval={}, options={}) {
render: function (interval={}) {
let options = {
invertTree: PerformanceController.getOption("invert-call-tree")
};
let recording = PerformanceController.getCurrentRecording();
let allocations = recording.getAllocations();
let threadNode = this._prepareCallTree(allocations, interval, options);
@ -66,33 +69,30 @@ let MemoryCallTreeView = Heritage.extend(DetailsSubview, {
*/
_prepareCallTree: function (allocations, { startTime, endTime }, options) {
let thread = RecordingUtils.getProfileThreadFromAllocations(allocations);
let invertTree = PerformanceController.getOption("invert-call-tree");
let { invertTree } = options;
let threadNode = new ThreadNode(thread,
{ startTime, endTime, invertTree });
// If we have an empty profile (no samples), then don't invert the tree, as
// it would hide the root node and a completely blank call tree space can be
// mis-interpreted as an error.
options.inverted = invertTree && threadNode.samples > 0;
return threadNode;
return new ThreadNode(thread, { startTime, endTime, invertTree });
},
/**
* Renders the call tree.
*/
_populateCallTree: function (frameNode, options={}) {
// If we have an empty profile (no samples), then don't invert the tree, as
// it would hide the root node and a completely blank call tree space can be
// mis-interpreted as an error.
let inverted = options.invertTree && frameNode.samples > 0;
let root = new CallView({
frame: frameNode,
inverted: options.inverted,
inverted: inverted,
// Root nodes are hidden in inverted call trees.
hidden: options.inverted,
hidden: inverted,
// Memory call trees should be sorted by allocations.
sortingPredicate: (a, b) => a.frame.allocations < b.frame.allocations ? 1 : -1,
// Call trees should only auto-expand when not inverted. Passing undefined
// will default to the CALL_TREE_AUTO_EXPAND depth.
autoExpandDepth: options.inverted ? 0 : undefined,
autoExpandDepth: inverted ? 0 : undefined,
// Some cells like the time duration and cost percentage don't make sense
// for a memory allocations call tree.
visibleCells: {
@ -109,9 +109,8 @@ let MemoryCallTreeView = Heritage.extend(DetailsSubview, {
root.on("focus", () => this.emit("focus"));
// Clear out other call trees.
let container = $("#memory-calltree-view > .call-tree-cells-container");
container.innerHTML = "";
root.attachTo(container);
this.container.innerHTML = "";
root.attachTo(this.container);
// Memory allocation samples don't contain cateogry labels.
root.toggleCategories(false);

View File

@ -250,7 +250,7 @@ function* openAndCloseToolbox(nbOfTimes, usageTime, toolId) {
* Synthesize a profile for testing.
*/
function synthesizeProfileForTest(samples) {
const { RecordingUtils } = devtools.require("devtools/performance/recording-utils");
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
samples.unshift({
time: 0,

View File

@ -235,27 +235,6 @@ this.TelemetryController = Object.freeze({
return Impl.getCurrentPingData(aSubsession);
},
/**
* Add the ping to the pending ping list and save all pending pings.
*
* @param {String} aType The type of the ping.
* @param {Object} aPayload The actual data payload for the ping.
* @param {Object} [aOptions] Options object.
* @param {Boolean} [aOptions.addClientId=false] true if the ping should contain the client
* id, false otherwise.
* @param {Boolean} [aOptions.addEnvironment=false] true if the ping should contain the
* environment data.
* @param {Object} [aOptions.overrideEnvironment=null] set to override the environment data.
* @returns {Promise} A promise that resolves when the pings are saved.
*/
savePendingPings: function(aType, aPayload, aOptions = {}) {
let options = aOptions;
options.addClientId = aOptions.addClientId || false;
options.addEnvironment = aOptions.addEnvironment || false;
return Impl.savePendingPings(aType, aPayload, options);
},
/**
* Save a ping to disk.
*
@ -659,28 +638,6 @@ let Impl = {
return promise;
},
/**
* Saves all the pending pings, plus the passed one, to disk.
*
* @param {String} aType The type of the ping.
* @param {Object} aPayload The actual data payload for the ping.
* @param {Object} aOptions Options object.
* @param {Boolean} aOptions.addClientId true if the ping should contain the client id,
* false otherwise.
* @param {Boolean} aOptions.addEnvironment true if the ping should contain the
* environment data.
* @param {Object} [aOptions.overrideEnvironment=null] set to override the environment data.
*
* @returns {Promise} A promise that resolves when all the pings are saved to disk.
*/
savePendingPings: function savePendingPings(aType, aPayload, aOptions) {
this._log.trace("savePendingPings - Type " + aType + ", Server " + this._server +
", aOptions " + JSON.stringify(aOptions));
let pingData = this.assemblePing(aType, aPayload, aOptions);
return TelemetryStorage.savePendingPings(pingData);
},
/**
* Save a ping to disk.
*

View File

@ -1620,42 +1620,44 @@ let Impl = {
cpmm.sendAsyncMessage(MESSAGE_TELEMETRY_PAYLOAD, payload);
},
/**
* Save both the "saved-session" and the "shutdown" pings to disk.
*/
savePendingPings: function savePendingPings() {
this._log.trace("savePendingPings");
/**
* Save both the "saved-session" and the "shutdown" pings to disk.
*/
saveShutdownPings: Task.async(function*() {
this._log.trace("saveShutdownPings");
if (!IS_UNIFIED_TELEMETRY) {
return this.savePendingPingsClassic();
if (IS_UNIFIED_TELEMETRY) {
try {
let shutdownPayload = this.getSessionPayload(REASON_SHUTDOWN, false);
let options = {
addClientId: true,
addEnvironment: true,
overwrite: true,
};
yield TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options);
} catch (ex) {
this._log.error("saveShutdownPings - failed to submit shutdown ping", ex);
}
}
// As a temporary measure, we want to submit saved-session too if extended Telemetry is enabled
// to keep existing performance analysis working.
if (Telemetry.canRecordExtended) {
try {
let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
let options = {
addClientId: true,
addEnvironment: true,
};
yield TelemetryController.addPendingPing(getPingType(payload), payload, options);
} catch (ex) {
this._log.error("saveShutdownPings - failed to submit saved-session ping", ex);
}
}
}),
let options = {
addClientId: true,
addEnvironment: true,
overwrite: true,
};
let shutdownPayload = this.getSessionPayload(REASON_SHUTDOWN, false);
// Make sure we try to save the pending pings, even though we failed saving the shutdown
// ping.
return TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options)
.then(() => this.savePendingPingsClassic(),
() => this.savePendingPingsClassic());
},
/**
* Save the "saved-session" ping and make TelemetryController save all the pending pings to disk.
*/
savePendingPingsClassic: function savePendingPingsClassic() {
this._log.trace("savePendingPingsClassic");
let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
let options = {
addClientId: true,
addEnvironment: true,
};
return TelemetryController.savePendingPings(getPingType(payload), payload, options);
},
testSaveHistograms: function testSaveHistograms(file) {
this._log.trace("testSaveHistograms - Path: " + file.path);
@ -1844,7 +1846,7 @@ let Impl = {
if (Telemetry.isOfficialTelemetry || testing) {
return Task.spawn(function*() {
yield this.savePendingPings();
yield this.saveShutdownPings();
yield this._stateSaveSerializer.flushTasks();
if (IS_UNIFIED_TELEMETRY) {

View File

@ -217,16 +217,6 @@ this.TelemetryStorage = {
return TelemetryStorageImpl.savePing(ping, overwrite);
},
/**
* Save all pending pings.
*
* @param {object} sessionPing The additional session ping.
* @returns {promise}
*/
savePendingPings: function(sessionPing) {
return TelemetryStorageImpl.savePendingPings(sessionPing);
},
/**
* Add a ping to the saved pings directory so that it gets saved
* and sent along with other pings.
@ -460,6 +450,7 @@ let TelemetryStorageImpl = {
shutdown: Task.async(function*() {
this._shutdown = true;
yield this._abortedSessionSerializer.flushTasks();
yield this.savePendingPings();
// If the archive cleaning task is running, block on it. It should bail out as soon
// as possible.
yield this._archiveCleanTask;
@ -758,17 +749,12 @@ let TelemetryStorageImpl = {
/**
* Save all pending pings.
*
* @param {object} sessionPing The additional session ping.
* @returns {promise}
*/
savePendingPings: function(sessionPing) {
let p = pendingPings.reduce((p, ping) => {
// Restore the files with the previous pings if for some reason they have
// been deleted, don't overwrite them otherwise.
p.push(this.savePing(ping, false));
return p;}, [this.savePing(sessionPing, true)]);
pendingPings = [];
savePendingPings: function() {
let p = [for (ping of pendingPings) this.savePing(ping, false).catch(ex => {
this._log.error("savePendingPings - failed to save pending pings.");
})];
return Promise.all(p);
},