Skip to content

Commit 1af2edd

Browse files
committed
core(tracehouse): modify files for move to tracehouse
1 parent 9f80524 commit 1af2edd

23 files changed

+280
-105
lines changed

docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ driver.sendCommand('Security.enable');
3939

4040
## Understanding a Trace
4141

42-
`lighthouse-core/computed/trace-of-tab.js` and `lighthouse-core/lib/traces/tracing-processor.js` provide the core transformation of a trace into more meaningful objects. Each raw trace event has a monotonically increasing timestamp in microseconds, a thread ID, a process ID, a duration in microseconds (potentially), and other applicable metadata properties such as the event type, the task name, the frame, etc. [Learn more about trace events](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview).
42+
`lighthouse-core/lib/tracehouse/trace-of-tab.js` and `lighthouse-core/lib/tracehouse/tracing-processor.js` provide the core transformation of a trace into more meaningful objects. Each raw trace event has a monotonically increasing timestamp in microseconds, a thread ID, a process ID, a duration in microseconds (potentially), and other applicable metadata properties such as the event type, the task name, the frame, etc. [Learn more about trace events](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview).
4343

4444
### Example Trace Event
4545
```js

lighthouse-core/audits/bootup-time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
const Audit = require('./audit.js');
99
const NetworkRequest = require('../lib/network-request.js');
10-
const {taskGroups} = require('../lib/task-groups.js');
10+
const {taskGroups} = require('../lib/tracehouse/task-groups.js');
1111
const i18n = require('../lib/i18n/i18n.js');
1212
const NetworkRecords = require('../computed/network-records.js');
1313
const MainThreadTasks = require('../computed/main-thread-tasks.js');

lighthouse-core/audits/mainthread-work-breakdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'use strict';
1212

1313
const Audit = require('./audit.js');
14-
const {taskGroups} = require('../lib/task-groups.js');
14+
const {taskGroups} = require('../lib/tracehouse/task-groups.js');
1515
const i18n = require('../lib/i18n/i18n.js');
1616
const MainThreadTasks = require('../computed/main-thread-tasks.js');
1717

@@ -29,7 +29,7 @@ const UIStrings = {
2929

3030
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
3131

32-
/** @typedef {import('../lib/task-groups.js').TaskGroupIds} TaskGroupIds */
32+
/** @typedef {import('../lib/tracehouse/task-groups.js').TaskGroupIds} TaskGroupIds */
3333

3434
class MainThreadWorkBreakdown extends Audit {
3535
/**
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @license Copyright 2019 Google Inc. All Rights Reserved.
3+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5+
*/
6+
'use strict';
7+
8+
const makeComputedArtifact = require('./computed-artifact.js');
9+
const MainThreadTasks_ = require('../lib/tracehouse/main-thread-tasks.js');
10+
const TraceOfTab = require('./trace-of-tab.js');
11+
12+
class MainThreadTasks {
13+
/**
14+
* @param {LH.Trace} trace
15+
* @param {LH.Audit.Context} context
16+
* @return {Promise<Array<LH.Artifacts.TaskNode>>}
17+
*/
18+
static async compute_(trace, context) {
19+
const {mainThreadEvents, timestamps} = await TraceOfTab.request(trace, context);
20+
return MainThreadTasks_.getMainThreadTasks(mainThreadEvents, timestamps.traceEnd);
21+
}
22+
}
23+
24+
module.exports = makeComputedArtifact(MainThreadTasks);

lighthouse-core/computed/metrics/estimated-input-latency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
const makeComputedArtifact = require('../computed-artifact.js');
99
const ComputedMetric = require('./metric.js');
1010
const LHError = require('../../lib/lh-error.js');
11-
const TracingProcessor = require('../../lib/traces/tracing-processor.js');
11+
const TracingProcessor = require('../../lib/tracehouse/tracing-processor.js');
1212
const LanternEstimatedInputLatency = require('./lantern-estimated-input-latency.js');
1313

1414
const ROLLING_WINDOW_SIZE = 5000;

lighthouse-core/computed/metrics/first-cpu-idle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
const makeComputedArtifact = require('../computed-artifact.js');
99
const ComputedMetric = require('./metric.js');
10-
const TracingProcessor = require('../../lib/traces/tracing-processor.js');
10+
const TracingProcessor = require('../../lib/tracehouse/tracing-processor.js');
1111
const LHError = require('../../lib/lh-error.js');
1212
const LanternFirstCPUIdle = require('./lantern-first-cpu-idle.js');
1313

lighthouse-core/computed/metrics/interactive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const ComputedMetric = require('./metric.js');
1010
const LanternInteractive = require('./lantern-interactive.js');
1111

1212
const NetworkRecorder = require('../../lib/network-recorder.js');
13-
const TracingProcessor = require('../../lib/traces/tracing-processor.js');
13+
const TracingProcessor = require('../../lib/tracehouse/tracing-processor.js');
1414
const LHError = require('../../lib/lh-error.js');
1515

1616
const REQUIRED_QUIET_WINDOW = 5000;

lighthouse-core/computed/metrics/max-potential-fid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const makeComputedArtifact = require('../computed-artifact.js');
99
const MetricArtifact = require('./metric.js');
1010
const LanternMaxPotentialFID = require('./lantern-max-potential-fid.js');
1111
const LHError = require('../../lib/lh-error.js');
12-
const TracingProcessor = require('../../lib/traces/tracing-processor.js');
12+
const TracingProcessor = require('../../lib/tracehouse/tracing-processor.js');
1313

1414
class MaxPotentialFID extends MetricArtifact {
1515
/**

lighthouse-core/computed/metrics/metric.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
'use strict';
77

8-
const TracingProcessor = require('../../lib/traces/tracing-processor.js');
8+
const TracingProcessor = require('../../lib/tracehouse/tracing-processor.js');
99
const TraceOfTab = require('../trace-of-tab.js');
1010
const NetworkRecords = require('../network-records.js');
1111

lighthouse-core/computed/page-dependency-graph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const makeComputedArtifact = require('./computed-artifact.js');
99
const NetworkNode = require('../lib/dependency-graph/network-node.js');
1010
const CPUNode = require('../lib/dependency-graph/cpu-node.js');
1111
const NetworkAnalyzer = require('../lib/dependency-graph/simulator/network-analyzer.js');
12-
const TracingProcessor = require('../lib/traces/tracing-processor.js');
12+
const TracingProcessor = require('../lib/tracehouse/tracing-processor.js');
1313
const NetworkRequest = require('../lib/network-request.js');
1414
const TraceOfTab = require('./trace-of-tab.js');
1515
const NetworkRecords = require('./network-records.js');

0 commit comments

Comments
 (0)