diff --git a/src/components/network-chart/index.js b/src/components/network-chart/index.js index bc419dd8c2..2307d9474d 100644 --- a/src/components/network-chart/index.js +++ b/src/components/network-chart/index.js @@ -196,8 +196,8 @@ function _getVirtualListItems(props: Props): NetworkChartRowProps[] { }; } // Compute the positioning of the network markers. - const startPosition = _timeToCssPixels(props, networkPayload.startTime); - const endPosition = _timeToCssPixels(props, networkPayload.endTime); + const startPosition = _timeToCssPixels(props, marker.start); + const endPosition = _timeToCssPixels(props, marker.start + marker.dur); // Set min-width for marker bar. let markerWidth = endPosition - startPosition; diff --git a/src/profile-logic/marker-data.js b/src/profile-logic/marker-data.js index 6a088205ce..f67f520b09 100644 --- a/src/profile-logic/marker-data.js +++ b/src/profile-logic/marker-data.js @@ -9,7 +9,7 @@ import type { IndexIntoStringTable, } from '../types/profile'; import type { Marker } from '../types/profile-derived'; -import type { BailoutPayload } from '../types/markers'; +import type { BailoutPayload, NetworkPayload } from '../types/markers'; import type { UniqueStringArray } from '../utils/unique-string-array'; import { getNumberPropertyOrNull } from '../utils/flow'; @@ -473,9 +473,14 @@ export function mergeStartAndEndNetworkMarker(markers: Marker[]): Marker[] { marker.data.status === 'STATUS_START' ? [marker, markerNext] : [markerNext, marker]; + const startData: NetworkPayload = (startMarker.data: any); + const endData: NetworkPayload = (endMarker.data: any); const mergedMarker = { - data: endMarker.data, - dur: endMarker.dur, + data: { + ...endData, + startTime: startData.startTime, + }, + dur: startMarker.dur + endMarker.dur, name: endMarker.name, title: endMarker.title, start: startMarker.start, diff --git a/src/test/components/NetworkChart.test.js b/src/test/components/NetworkChart.test.js index 8156282c2b..5eb61aa24f 100644 --- a/src/test/components/NetworkChart.test.js +++ b/src/test/components/NetworkChart.test.js @@ -15,15 +15,18 @@ import mockCanvasContext from '../fixtures/mocks/canvas-context'; import { storeWithProfile } from '../fixtures/stores'; import { getProfileWithMarkers, - getNetworkMarker, + getNetworkMarkers, } from '../fixtures/profiles/processed-profile'; import { getBoundingBox } from '../fixtures/utils'; import mockRaf from '../fixtures/mocks/request-animation-frame'; import { type NetworkPayload } from '../../types/markers'; -const NETWORK_MARKERS = Array(10) - .fill() - .map((_, i) => getNetworkMarker(3 + 0.1 * i, i)); +const NETWORK_MARKERS = (function() { + const arrayOfNetworkMarkers = Array(10) + .fill() + .map((_, i) => getNetworkMarkers(3 + 0.1 * i, i)); + return [].concat(...arrayOfNetworkMarkers); +})(); function setupWithProfile(profile) { const flushRafCalls = mockRaf(); diff --git a/src/test/components/__snapshots__/NetworkChart.test.js.snap b/src/test/components/__snapshots__/NetworkChart.test.js.snap index cccc99d9a0..8a6b2349a1 100644 --- a/src/test/components/__snapshots__/NetworkChart.test.js.snap +++ b/src/test/components/__snapshots__/NetworkChart.test.js.snap @@ -67,7 +67,7 @@ exports[`NetworkChart renders NetworkChart correctly 1`] = ` >
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
+
+ + + https:// + + + mozilla.org + + + / + + +
+
+ +   + + +   + + +   + +
+
+
getNetworkMarker(3 + 0.1 * i, i)) - ); + const arrayOfNetworkMarkers = Array(10) + .fill() + .map((_, i) => getNetworkMarkers(3 + 0.1 * i, i)); + const profile = getProfileWithMarkers([].concat(...arrayOfNetworkMarkers)); const docShellId = '{c03a6ebd-2430-7949-b25b-95ba9776bdbf}'; const docshellHistoryId = 1; diff --git a/src/test/store/__snapshots__/profile-view.test.js.snap b/src/test/store/__snapshots__/profile-view.test.js.snap index 1ee199870b..0ea9f1b41d 100644 --- a/src/test/store/__snapshots__/profile-view.test.js.snap +++ b/src/test/store/__snapshots__/profile-view.test.js.snap @@ -236,55 +236,10 @@ Object { }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -433,25 +388,45 @@ Object { Object { "RedirectURI": "https://mozilla.org", "URI": "https://mozilla.org", - "endTime": 7, + "endTime": 6.5, "id": 6, "pri": 0, "startTime": 6, - "status": "STOP", + "status": "STATUS_START", "type": "Network", }, Object { "RedirectURI": "https://mozilla.org", "URI": "https://mozilla.org", - "endTime": 8, + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7.5, "id": 7, "pri": 0, "startTime": 7, - "status": "STOP", + "status": "STATUS_START", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 8, + "id": 7, + "pri": 0, + "startTime": 7.5, + "status": "STATUS_STOP", "type": "Network", }, ], - "length": 8, + "length": 10, "name": Array [ 0, 1, @@ -461,6 +436,8 @@ Object { 5, 6, 6, + 7, + 7, ], "time": Array [ 0, @@ -470,7 +447,9 @@ Object { 4, 5, 6, + 6.5, 7, + 7.5, ], }, "name": "Thread with markers", @@ -516,7 +495,8 @@ Object { "D", "E", "F", - "Load 123: https://mozilla.org", + "Load 6: https://mozilla.org", + "Load 7: https://mozilla.org", ], "_stringToIndex": Map { "A" => 0, @@ -525,7 +505,8 @@ Object { "D" => 3, "E" => 4, "F" => 5, - "Load 123: https://mozilla.org" => 6, + "Load 6: https://mozilla.org" => 6, + "Load 7: https://mozilla.org" => 7, }, }, "tid": 0, @@ -711,55 +692,10 @@ Array [ }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -908,25 +844,45 @@ Array [ Object { "RedirectURI": "https://mozilla.org", "URI": "https://mozilla.org", - "endTime": 7, + "endTime": 6.5, "id": 6, "pri": 0, "startTime": 6, - "status": "STOP", + "status": "STATUS_START", "type": "Network", }, Object { "RedirectURI": "https://mozilla.org", "URI": "https://mozilla.org", - "endTime": 8, + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7.5, "id": 7, "pri": 0, "startTime": 7, - "status": "STOP", + "status": "STATUS_START", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 8, + "id": 7, + "pri": 0, + "startTime": 7.5, + "status": "STATUS_STOP", "type": "Network", }, ], - "length": 8, + "length": 10, "name": Array [ 0, 1, @@ -936,6 +892,8 @@ Array [ 5, 6, 6, + 7, + 7, ], "time": Array [ 0, @@ -945,7 +903,9 @@ Array [ 4, 5, 6, + 6.5, 7, + 7.5, ], }, "name": "Thread with markers", @@ -991,7 +951,8 @@ Array [ "D", "E", "F", - "Load 123: https://mozilla.org", + "Load 6: https://mozilla.org", + "Load 7: https://mozilla.org", ], "_stringToIndex": Map { "A" => 0, @@ -1000,7 +961,8 @@ Array [ "D" => 3, "E" => 4, "F" => 5, - "Load 123: https://mozilla.org" => 6, + "Load 6: https://mozilla.org" => 6, + "Load 7: https://mozilla.org" => 7, }, }, "tid": 0, @@ -1009,90 +971,499 @@ Array [ ] `; -exports[`snapshots of selectors/profile matches the last stored run of selectedNodeSelectors.getTimingsForSidebar 1`] = ` -Object { - "forFunc": Object { - "selfTime": Object { - "breakdownByCategory": null, - "breakdownByImplementation": null, - "value": 0, - }, - "totalTime": Object { - "breakdownByCategory": Array [ - 0, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - ], - "breakdownByImplementation": Object { - "native": 2, - }, - "value": 2, - }, +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getCommittedRangeFilteredMarkers 1`] = ` +Array [ + Object { + "data": null, + "dur": 0, + "name": "D", + "start": 3, + "title": null, }, - "forPath": Object { - "selfTime": Object { - "breakdownByCategory": null, - "breakdownByImplementation": null, - "value": 0, + Object { + "data": null, + "dur": 0, + "name": "E", + "start": 4, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "F", + "start": 5, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 6.5, + "id": 6, + "pri": 0, + "startTime": 6, + "status": "STATUS_START", + "type": "Network", }, - "totalTime": Object { - "breakdownByCategory": Array [ - 0, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - ], - "breakdownByImplementation": Object { - "native": 2, - }, - "value": 2, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", }, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6.5, + "title": null, }, - "rootTime": 2, -} +] `; -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getCallNodeInfo 1`] = ` -Object { - "callNodeTable": Object { - "category": Int32Array [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - ], - "depth": Array [ - 0, - 1, - 2, - 3, - 2, - 3, - 2, - 3, - ], - "func": Int32Array [ - 0, - 1, - 3, - 4, - 5, - 6, - 7, - 8, +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getCommittedRangeFilteredMarkersForHeader 1`] = ` +Array [ + Object { + "data": null, + "dur": 0, + "name": "D", + "start": 3, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "E", + "start": 4, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "F", + "start": 5, + "title": null, + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getMarkerChartTiming 1`] = ` +Array [ + Object { + "end": Array [ + 3, + ], + "index": Array [ + 0, + ], + "label": Array [ + "", + ], + "length": 1, + "name": "D", + "start": Array [ + 3, + ], + }, + Object { + "end": Array [ + 4, + ], + "index": Array [ + 1, + ], + "label": Array [ + "", + ], + "length": 1, + "name": "E", + "start": Array [ + 4, + ], + }, + Object { + "end": Array [ + 5, + ], + "index": Array [ + 2, + ], + "label": Array [ + "", + ], + "length": 1, + "name": "F", + "start": Array [ + 5, + ], + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getNetworkChartTiming 1`] = ` +Array [ + Object { + "end": Array [ + 6.5, + 7, + ], + "index": Array [ + 0, + 1, + ], + "label": Array [ + "", + "", + ], + "length": 2, + "name": "Load 6: https://mozilla.org", + "start": Array [ + 6, + 6.5, + ], + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getProcessedRawMarkerTable 1`] = ` +Object { + "data": Array [ + null, + null, + null, + null, + null, + null, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 6.5, + "id": 6, + "pri": 0, + "startTime": 6, + "status": "STATUS_START", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7.5, + "id": 7, + "pri": 0, + "startTime": 7, + "status": "STATUS_START", + "type": "Network", + }, + Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 8, + "id": 7, + "pri": 0, + "startTime": 7.5, + "status": "STATUS_STOP", + "type": "Network", + }, + ], + "length": 10, + "name": Array [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 6, + 7, + 7, + ], + "time": Array [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 6.5, + 7, + 7.5, + ], +} +`; + +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getReferenceMarkerTable 1`] = ` +Array [ + Object { + "data": null, + "dur": 0, + "name": "A", + "start": 0, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "B", + "start": 1, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "C", + "start": 2, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "D", + "start": 3, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "E", + "start": 4, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "F", + "start": 5, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 6.5, + "id": 6, + "pri": 0, + "startTime": 6, + "status": "STATUS_START", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6.5, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7.5, + "id": 7, + "pri": 0, + "startTime": 7, + "status": "STATUS_START", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 7: https://mozilla.org", + "start": 7, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 8, + "id": 7, + "pri": 0, + "startTime": 7.5, + "status": "STATUS_STOP", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 7: https://mozilla.org", + "start": 7.5, + "title": null, + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of markerThreadSelectors.getSearchFilteredMarkers 1`] = ` +Array [ + Object { + "data": null, + "dur": 0, + "name": "D", + "start": 3, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "E", + "start": 4, + "title": null, + }, + Object { + "data": null, + "dur": 0, + "name": "F", + "start": 5, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 6.5, + "id": 6, + "pri": 0, + "startTime": 6, + "status": "STATUS_START", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6, + "title": null, + }, + Object { + "data": Object { + "RedirectURI": "https://mozilla.org", + "URI": "https://mozilla.org", + "endTime": 7, + "id": 6, + "pri": 0, + "startTime": 6.5, + "status": "STATUS_STOP", + "type": "Network", + }, + "dur": 0.5, + "name": "Load 6: https://mozilla.org", + "start": 6.5, + "title": null, + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of selectedNodeSelectors.getTimingsForSidebar 1`] = ` +Object { + "forFunc": Object { + "selfTime": Object { + "breakdownByCategory": null, + "breakdownByImplementation": null, + "value": 0, + }, + "totalTime": Object { + "breakdownByCategory": Array [ + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + ], + "breakdownByImplementation": Object { + "native": 2, + }, + "value": 2, + }, + }, + "forPath": Object { + "selfTime": Object { + "breakdownByCategory": null, + "breakdownByImplementation": null, + "value": 0, + }, + "totalTime": Object { + "breakdownByCategory": Array [ + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + ], + "breakdownByImplementation": Object { + "native": 2, + }, + "value": 2, + }, + }, + "rootTime": 2, +} +`; + +exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getCallNodeInfo 1`] = ` +Object { + "callNodeTable": Object { + "category": Int32Array [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + "depth": Array [ + 0, + 1, + 2, + 3, + 2, + 3, + 2, + 3, + ], + "func": Int32Array [ + 0, + 1, + 3, + 4, + 5, + 6, + 7, + 8, ], "length": 8, "prefix": Int32Array [ @@ -1343,97 +1714,22 @@ CallTree { "E", "F", "G", - "H", - "I", - ], - "_stringToIndex": Map { - "A" => 0, - "B" => 1, - "C" => 2, - "D" => 3, - "E" => 4, - "F" => 5, - "G" => 6, - "H" => 7, - "I" => 8, - }, - }, -} -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getCommittedRangeFilteredMarkers 1`] = ` -Array [ - Object { - "data": null, - "dur": 100, - "name": "Jank", - "start": -96, - "title": "100.00ms event processing delay", - }, - Object { - "data": null, - "dur": 0, - "name": "D", - "start": 3, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "E", - "start": 4, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "F", - "start": 5, - "title": null, - }, - Object { - "data": Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - "dur": 1, - "name": "G", - "start": 6, - "title": null, - }, -] -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getCommittedRangeFilteredMarkersForHeader 1`] = ` -Array [ - Object { - "data": null, - "dur": 0, - "name": "D", - "start": 3, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "E", - "start": 4, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "F", - "start": 5, - "title": null, + "H", + "I", + ], + "_stringToIndex": Map { + "A" => 0, + "B" => 1, + "C" => 2, + "D" => 3, + "E" => 4, + "F" => 5, + "G" => 6, + "H" => 7, + "I" => 8, + }, }, -] +} `; exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getFilteredThread 1`] = ` @@ -1611,55 +1907,10 @@ Object { }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -1771,243 +2022,67 @@ Array [ "selfTimeRelative": Array [ 0, ], - "start": Array [ - 0, - ], - }, - Object { - "callNode": Array [ - 1, - ], - "end": Array [ - 1, - ], - "length": 1, - "selfTimeRelative": Array [ - 0, - ], - "start": Array [ - 0, - ], - }, - Object { - "callNode": Array [ - 4, - ], - "end": Array [ - 1, - ], - "length": 1, - "selfTimeRelative": Array [ - 0, - ], - "start": Array [ - 0, - ], - }, - Object { - "callNode": Array [ - 5, - ], - "end": Array [ - 1, - ], - "length": 1, - "selfTimeRelative": Array [ - 1, - ], - "start": Array [ - 0, - ], - }, -] -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getJankMarkersForHeader 1`] = ` -Array [ - Object { - "data": null, - "dur": 100, - "name": "Jank", - "start": -96, - "title": "100.00ms event processing delay", - }, -] -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getMarkerChartTiming 1`] = ` -Array [ - Object { - "end": Array [ - 4, - ], - "index": Array [ - 0, - ], - "label": Array [ - "", - ], - "length": 1, - "name": "Jank", - "start": Array [ - -96, - ], - }, - Object { - "end": Array [ - 3, - ], - "index": Array [ - 1, - ], - "label": Array [ - "", - ], - "length": 1, - "name": "D", - "start": Array [ - 3, - ], - }, - Object { - "end": Array [ - 4, - ], - "index": Array [ - 2, - ], - "label": Array [ - "", - ], - "length": 1, - "name": "E", - "start": Array [ - 4, - ], - }, - Object { - "end": Array [ - 5, - ], - "index": Array [ - 3, - ], - "label": Array [ - "", - ], - "length": 1, - "name": "F", - "start": Array [ - 5, - ], - }, -] -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getMarkers 1`] = ` -Array [ - Object { - "data": null, - "dur": 100, - "name": "Jank", - "start": -96, - "title": "100.00ms event processing delay", - }, - Object { - "data": null, - "dur": 0, - "name": "A", - "start": 0, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "B", - "start": 1, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "C", - "start": 2, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "D", - "start": 3, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "E", - "start": 4, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "F", - "start": 5, - "title": null, - }, - Object { - "data": Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - "dur": 1, - "name": "G", - "start": 6, - "title": null, - }, - Object { - "data": Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - "dur": 1, - "name": "G", - "start": 7, - "title": null, + "start": Array [ + 0, + ], }, -] -`; - -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getNetworkChartTiming 1`] = ` -Array [ Object { + "callNode": Array [ + 1, + ], "end": Array [ - 7, + 1, ], - "index": Array [ + "length": 1, + "selfTimeRelative": Array [ 0, ], - "label": Array [ - "", + "start": Array [ + 0, + ], + }, + Object { + "callNode": Array [ + 4, + ], + "end": Array [ + 1, ], "length": 1, - "name": "G", + "selfTimeRelative": Array [ + 0, + ], "start": Array [ - 6, + 0, ], }, + Object { + "callNode": Array [ + 5, + ], + "end": Array [ + 1, + ], + "length": 1, + "selfTimeRelative": Array [ + 1, + ], + "start": Array [ + 0, + ], + }, +] +`; + +exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getJankMarkersForHeader 1`] = ` +Array [ + Object { + "data": null, + "dur": 100, + "name": "Jank", + "start": -96, + "title": "100.00ms event processing delay", + }, ] `; @@ -2186,55 +2261,10 @@ Object { }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -2327,60 +2357,6 @@ Object { } `; -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getProcessedRawMarkerTable 1`] = ` -Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], -} -`; - exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getRangeAndTransformFilteredThread 1`] = ` Object { "frameTable": Object { @@ -2556,55 +2532,10 @@ Object { }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -2878,55 +2809,10 @@ Object { }, "libs": Array [], "markers": Object { - "data": Array [ - null, - null, - null, - null, - null, - null, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 8, - "id": 7, - "pri": 0, - "startTime": 7, - "status": "STOP", - "type": "Network", - }, - ], - "length": 8, - "name": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 6, - ], - "time": Array [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], + "data": Array [], + "length": 0, + "name": Array [], + "time": Array [], }, "name": "Thread with samples", "pausedRanges": Array [], @@ -3028,55 +2914,6 @@ Object { } `; -exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getSearchFilteredMarkers 1`] = ` -Array [ - Object { - "data": null, - "dur": 100, - "name": "Jank", - "start": -96, - "title": "100.00ms event processing delay", - }, - Object { - "data": null, - "dur": 0, - "name": "D", - "start": 3, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "E", - "start": 4, - "title": null, - }, - Object { - "data": null, - "dur": 0, - "name": "F", - "start": 5, - "title": null, - }, - Object { - "data": Object { - "RedirectURI": "https://mozilla.org", - "URI": "https://mozilla.org", - "endTime": 7, - "id": 6, - "pri": 0, - "startTime": 6, - "status": "STOP", - "type": "Network", - }, - "dur": 1, - "name": "G", - "start": 6, - "title": null, - }, -] -`; - exports[`snapshots of selectors/profile matches the last stored run of selectedThreadSelector.getThreadProcessDetails 1`] = ` "thread: \\"Thread with samples\\" (0) process: \\"default\\" (0)" diff --git a/src/test/store/app.test.js b/src/test/store/app.test.js index fb80fffa64..71a60c5e68 100644 --- a/src/test/store/app.test.js +++ b/src/test/store/app.test.js @@ -13,7 +13,7 @@ import { getProfileWithNiceTracks } from '../fixtures/profiles/tracks'; import { getProfileFromTextSamples, getProfileWithMarkers, - getNetworkMarker, + getNetworkMarkers, getProfileWithJsTracerEvents, } from '../fixtures/profiles/processed-profile'; @@ -78,7 +78,7 @@ describe('app actions', function() { }); it('shows the network chart when network markers are present in the thread', function() { - const profile = getProfileWithMarkers([getNetworkMarker(10, 0)]); + const profile = getProfileWithMarkers(getNetworkMarkers(10, 0)); const { getState } = storeWithProfile(profile); expect(AppSelectors.getVisibleTabs(getState())).toEqual([ 'calltree', diff --git a/src/test/store/profile-view.test.js b/src/test/store/profile-view.test.js index 3c85d1b39f..327f05e74a 100644 --- a/src/test/store/profile-view.test.js +++ b/src/test/store/profile-view.test.js @@ -11,7 +11,7 @@ import { getProfileWithMarkers, getNetworkTrackProfile, getScreenshotTrackProfile, - getNetworkMarker, + getNetworkMarkers, getCounterForThread, } from '../fixtures/profiles/processed-profile'; import { @@ -945,14 +945,13 @@ describe('snapshots of selectors/profile', function() { ['D', 3, null], ['E', 4, null], ['F', 5, null], - getNetworkMarker(6, 6), - getNetworkMarker(7, 7), + ...getNetworkMarkers(6, 6), + ...getNetworkMarkers(7, 7), ]); profile.threads.push(markersThread); const { getState, dispatch } = storeWithProfile(profile); samplesThread.name = 'Thread with samples'; markersThread.name = 'Thread with markers'; - samplesThread.markers = markersThread.markers; // This is a jank sample: samplesThread.samples.responsiveness[4] = 100; const mergeFunction = { @@ -972,7 +971,16 @@ describe('snapshots of selectors/profile', function() { selectionEnd: 6, }) ); - return { getState, dispatch, samplesThread, mergeFunction, A, B, C }; + return { + getState, + dispatch, + samplesThread, + mergeFunction, + markerThreadSelectors: getThreadSelectors(1), + A, + B, + C, + }; } it('matches the last stored run of getProfile', function() { const { getState } = setupStore(); @@ -1043,40 +1051,40 @@ describe('snapshots of selectors/profile', function() { selectedThreadSelectors.getJankMarkersForHeader(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getProcessedRawMarkerTable', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getProcessedRawMarkerTable', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getProcessedRawMarkerTable(getState()) + markerThreadSelectors.getProcessedRawMarkerTable(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getMarkers', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getReferenceMarkerTable', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getReferenceMarkerTable(getState()) + markerThreadSelectors.getReferenceMarkerTable(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getMarkerChartTiming', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getMarkerChartTiming', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getMarkerChartTiming(getState()) + markerThreadSelectors.getMarkerChartTiming(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getNetworkChartTiming', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getNetworkChartTiming', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getNetworkChartTiming(getState()) + markerThreadSelectors.getNetworkChartTiming(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getCommittedRangeFilteredMarkers', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getCommittedRangeFilteredMarkers', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getCommittedRangeFilteredMarkers(getState()) + markerThreadSelectors.getCommittedRangeFilteredMarkers(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getCommittedRangeFilteredMarkersForHeader', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getCommittedRangeFilteredMarkersForHeader', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getCommittedRangeFilteredMarkersForHeader( + markerThreadSelectors.getCommittedRangeFilteredMarkersForHeader( getState() ) ).toMatchSnapshot(); @@ -1150,10 +1158,10 @@ describe('snapshots of selectors/profile', function() { selectedThreadSelectors.getThreadProcessDetails(getState()) ).toMatchSnapshot(); }); - it('matches the last stored run of selectedThreadSelector.getSearchFilteredMarkers', function() { - const { getState } = setupStore(); + it('matches the last stored run of markerThreadSelectors.getSearchFilteredMarkers', function() { + const { getState, markerThreadSelectors } = setupStore(); expect( - selectedThreadSelectors.getSearchFilteredMarkers(getState()) + markerThreadSelectors.getSearchFilteredMarkers(getState()) ).toMatchSnapshot(); }); it('matches the last stored run of selectedThreadSelector.unfilteredSamplesRange', function() {