author | Victor Porof <vporof@mozilla.com> |
Fri, 16 Jan 2015 13:44:24 -0500 | |
changeset 224335 | 62b1908ad41329fe82f2faf9502112bba73095c5 |
parent 224334 | 2234aaa1655a16174d3425733331c9bf16915f58 |
child 224336 | 4bb30ec57818382e86ef1a2e1f9488e597318138 |
push id | 54190 |
push user | kwierso@gmail.com |
push date | Sat, 17 Jan 2015 02:06:29 +0000 |
treeherder | mozilla-inbound@369a8f14ccf8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jsantell |
bugs | 1122172 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/devtools/performance/performance-controller.js +++ b/browser/devtools/performance/performance-controller.js @@ -202,29 +202,29 @@ let PerformanceController = { gFront.off("memory", this._onTimelineData); }, /** * Starts recording with the PerformanceFront. Emits `EVENTS.RECORDING_STARTED` * when the front has started to record. */ startRecording: Task.async(function *() { - let model = this.createNewRecording(); - this.setCurrentRecording(model); - yield model.startRecording(); + let recording = this.createNewRecording(); + this.setCurrentRecording(recording); + yield recording.startRecording(); - this.emit(EVENTS.RECORDING_STARTED, model); + this.emit(EVENTS.RECORDING_STARTED, recording); }), /** * Stops recording with the PerformanceFront. Emits `EVENTS.RECORDING_STOPPED` * when the front has stopped recording. */ stopRecording: Task.async(function *() { - let recording = this._getLatest(); + let recording = this._getLatestRecording(); yield recording.stopRecording(); this.emit(EVENTS.RECORDING_STOPPED, recording); }), /** * Saves the current recording to a file. * @@ -242,136 +242,81 @@ let PerformanceController = { /** * Loads a recording from a file, adding it to the recordings list. * * @param nsILocalFile file * The file to import the data from. */ importRecording: Task.async(function*(_, file) { - let model = this.createNewRecording(); - yield model.importRecording(file); + let recording = this.createNewRecording(); + yield recording.importRecording(file); - this.emit(EVENTS.RECORDING_IMPORTED, model.getAllData(), model); + this.emit(EVENTS.RECORDING_IMPORTED, recording.getAllData(), recording); }), /** * Creates a new RecordingModel, fires events and stores it * internally in the controller. + * + * @return RecordingModel + * The newly created recording model. */ createNewRecording: function () { - let model = new RecordingModel({ + let recording = new RecordingModel({ front: gFront, performance: performance }); - this._recordings.push(model); - this.emit(EVENTS.RECORDING_CREATED, model); - return model; + this._recordings.push(recording); + + this.emit(EVENTS.RECORDING_CREATED, recording); + return recording; }, /** - * Sets the active RecordingModel to `recording`. + * Sets the currently active RecordingModel. + * @param RecordingModel recording */ setCurrentRecording: function (recording) { if (this._currentRecording !== recording) { this._currentRecording = recording; this.emit(EVENTS.RECORDING_SELECTED, recording); } }, /** - * Return the current active RecordingModel. + * Gets the currently active RecordingModel. + * @return RecordingModel */ getCurrentRecording: function () { return this._currentRecording; }, /** - * Gets the amount of time elapsed locally after starting a recording. - */ - getLocalElapsedTime: function () { - return this.getCurrentRecording().getLocalElapsedTime; - }, - - /** - * Gets the time interval for the current recording. - * @return object - */ - getInterval: function() { - return this.getCurrentRecording().getInterval(); - }, - - /** - * Gets the accumulated markers in the current recording. - * @return array - */ - getMarkers: function() { - return this.getCurrentRecording().getMarkers(); - }, - - /** - * Gets the accumulated stack frames in the current recording. - * @return array + * Get most recently added recording that was triggered manually (via UI). + * @return RecordingModel */ - getFrames: function() { - return this.getCurrentRecording().getFrames(); - }, - - /** - * Gets the accumulated memory measurements in this recording. - * @return array - */ - getMemory: function() { - return this.getCurrentRecording().getMemory(); - }, - - /** - * Gets the accumulated refresh driver ticks in this recording. - * @return array - */ - getTicks: function() { - return this.getCurrentRecording().getTicks(); - }, - - /** - * Gets the profiler data in this recording. - * @return array - */ - getProfilerData: function() { - return this.getCurrentRecording().getProfilerData(); - }, - - /** - * Gets all the data in this recording. - */ - getAllData: function() { - return this.getCurrentRecording().getAllData(); - }, - - /** - * Get most recently added profile that was triggered manually (via UI) - */ - _getLatest: function () { + _getLatestRecording: function () { for (let i = this._recordings.length - 1; i >= 0; i--) { return this._recordings[i]; } return null; }, /** * Fired whenever the PerformanceFront emits markers, memory or ticks. */ _onTimelineData: function (...data) { this._recordings.forEach(profile => profile.addTimelineData.apply(profile, data)); this.emit(EVENTS.TIMELINE_DATA, ...data); }, /** - * Fired from RecordingsView, we listen on the PerformanceController - * so we can set it here and re-emit on the controller, where all views can listen. + * Fired from RecordingsView, we listen on the PerformanceController so we can + * set it here and re-emit on the controller, where all views can listen. */ _onRecordingSelectFromView: function (_, recording) { this.setCurrentRecording(recording); } }; /** * Convenient way of emitting events from the controller.
--- a/browser/devtools/performance/test/browser_perf-details-flamegraph-render-01.js +++ b/browser/devtools/performance/test/browser_perf-details-flamegraph-render-01.js @@ -4,17 +4,17 @@ /** * Tests that the flamegraph view renders content after recording. */ function spawnTest () { let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController, FlameGraphView } = panel.panelWin; yield startRecording(panel); - yield waitUntil(() => PerformanceController.getMarkers().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); let rendered = once(FlameGraphView, EVENTS.FLAMEGRAPH_RENDERED); yield stopRecording(panel); yield rendered; ok(true, "FlameGraphView rendered after recording is stopped."); yield teardown(panel);
--- a/browser/devtools/performance/test/browser_perf-details-waterfall-render-01.js +++ b/browser/devtools/performance/test/browser_perf-details-waterfall-render-01.js @@ -4,17 +4,17 @@ /** * Tests that the waterfall view renders content after recording. */ function spawnTest () { let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController, WaterfallView } = panel.panelWin; yield startRecording(panel); - yield waitUntil(() => PerformanceController.getMarkers().length); + yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length); let rendered = once(WaterfallView, EVENTS.WATERFALL_RENDERED); yield stopRecording(panel); yield rendered; ok(true, "WaterfallView rendered after recording is stopped."); yield teardown(panel);
--- a/browser/devtools/performance/test/browser_perf_recordings-io-01.js +++ b/browser/devtools/performance/test/browser_perf_recordings-io-01.js @@ -9,17 +9,17 @@ let test = Task.async(function*() { let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController } = panel.panelWin; yield startRecording(panel); yield stopRecording(panel); // Verify original recording. - let originalData = PerformanceController.getAllData(); + let originalData = PerformanceController.getCurrentRecording().getAllData(); ok(originalData, "The original recording is not empty."); // Save recording. let file = FileUtils.getFile("TmpD", ["tmpprofile.json"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8)); let exported = once(PerformanceController, EVENTS.RECORDING_EXPORTED); @@ -37,17 +37,17 @@ let test = Task.async(function*() { yield imported; ok(true, "The recording data appears to have been successfully imported."); yield rerendered; ok(true, "The imported data was re-rendered."); // Verify imported recording. - let importedData = PerformanceController.getAllData(); + let importedData = PerformanceController.getCurrentRecording().getAllData(); is(importedData.startTime, originalData.startTime, "The impored data is identical to the original data (1)."); is(importedData.endTime, originalData.endTime, "The impored data is identical to the original data (2)."); is(importedData.markers.toSource(), originalData.markers.toSource(), "The impored data is identical to the original data (3).");
--- a/browser/devtools/performance/test/browser_perf_recordings-io-04.js +++ b/browser/devtools/performance/test/browser_perf_recordings-io-04.js @@ -9,17 +9,17 @@ let test = Task.async(function*() { let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL); let { EVENTS, PerformanceController } = panel.panelWin; yield startRecording(panel); yield stopRecording(panel); // Get data from the current profiler - let data = PerformanceController.getAllData(); + let data = PerformanceController.getCurrentRecording().getAllData(); // Create a structure from the data that mimics the old profiler's data. // Different name for `ticks`, different way of storing time, // and no memory, markers data. let oldProfilerData = { recordingDuration: data.interval.endTime - data.interval.startTime, ticksData: data.ticks, profilerData: data.profilerData, @@ -41,17 +41,17 @@ let test = Task.async(function*() { yield imported; ok(true, "The original profiler data appears to have been successfully imported."); yield rerendered; ok(true, "The imported data was re-rendered."); // Verify imported recording. - let importedData = PerformanceController.getAllData(); + let importedData = PerformanceController.getCurrentRecording().getAllData(); is(importedData.startTime, data.startTime, "The imported legacy data was successfully converted for the current tool (1)."); is(importedData.endTime, data.endTime, "The imported legacy data was successfully converted for the current tool (2)."); is(importedData.markers.toSource(), [].toSource(), "The imported legacy data was successfully converted for the current tool (3)."); is(importedData.memory.toSource(), [].toSource(),
--- a/browser/devtools/performance/views/details-call-tree.js +++ b/browser/devtools/performance/views/details-call-tree.js @@ -68,17 +68,18 @@ let CallTreeView = { }, /** * Fired when a range is selected or cleared in the OverviewView. */ _onRangeChange: function (_, params) { // When a range is cleared, we'll have no beginAt/endAt data, // so the rebuild will just render all the data again. - let profilerData = PerformanceController.getProfilerData(); + let recording = PerformanceController.getCurrentRecording(); + let profilerData = recording.getProfilerData(); let { beginAt, endAt } = params || {}; this.render(profilerData, beginAt, endAt); }, /** * Fired on the "link" event for the call tree in this container. */ _onLink: function (_, treeItem) {
--- a/browser/devtools/performance/views/details-waterfall.js +++ b/browser/devtools/performance/views/details-waterfall.js @@ -43,18 +43,19 @@ let WaterfallView = { PerformanceController.off(EVENTS.RECORDING_STOPPED, this._onRecordingStopped); PerformanceController.off(EVENTS.RECORDING_SELECTED, this._onRecordingSelected); }, /** * Method for handling all the set up for rendering a new waterfall. */ render: function() { - let { startTime, endTime } = PerformanceController.getInterval(); - let markers = PerformanceController.getMarkers(); + let recording = PerformanceController.getCurrentRecording(); + let { startTime, endTime } = recording.getInterval(); + let markers = recording.getMarkers(); this.waterfall.setData(markers, startTime, startTime, endTime); this.emit(EVENTS.WATERFALL_RENDERED); }, /** * Called when recording starts. @@ -79,22 +80,21 @@ let WaterfallView = { } }, /** * Called when a marker is selected in the waterfall view, * updating the markers detail view. */ _onMarkerSelected: function (event, marker) { + let recording = PerformanceController.getCurrentRecording(); + let frames = recording.getFrames(); + if (event === "selected") { - this.details.render({ - toolbox: gToolbox, - marker: marker, - frames: PerformanceController.getFrames() - }); + this.details.render({ toolbox: gToolbox, marker, frames }); } if (event === "unselected") { this.details.empty(); } }, /** * Called when the marker details view is resized.
--- a/browser/devtools/performance/views/overview.js +++ b/browser/devtools/performance/views/overview.js @@ -107,20 +107,21 @@ let OverviewView = { /** * Method for handling all the set up for rendering the overview graphs. * * @param number resolution * The fps graph resolution. @see Graphs.jsm */ render: Task.async(function *(resolution) { - let interval = PerformanceController.getInterval(); - let markers = PerformanceController.getMarkers(); - let memory = PerformanceController.getMemory(); - let timestamps = PerformanceController.getTicks(); + let recording = PerformanceController.getCurrentRecording(); + let interval = recording.getInterval(); + let markers = recording.getMarkers(); + let memory = recording.getMemory(); + let timestamps = recording.getTicks(); this.markersOverview.setData({ interval, markers }); this.emit(EVENTS.MARKERS_GRAPH_RENDERED); this.memoryOverview.setData({ interval, memory }); this.emit(EVENTS.MEMORY_GRAPH_RENDERED); yield this.framerateGraph.setDataFromTimestamps(timestamps, resolution);