@parcel/workers 2.0.0-nightly.137 → 2.0.0-nightly.1370

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Trace.js DELETED
@@ -1,121 +0,0 @@
1
- // @flow
2
- import type {Profile} from './Profiler';
3
- import type {Writable} from 'stream';
4
- import {Tracer} from 'chrome-trace-event';
5
-
6
- export default class Trace {
7
- tracer: Tracer;
8
- tid: number;
9
- eventId: number;
10
-
11
- constructor() {
12
- this.tracer = new Tracer();
13
- this.tid = 0;
14
- this.eventId = 0;
15
- this.init();
16
- }
17
-
18
- getEventId() {
19
- return this.eventId++;
20
- }
21
-
22
- init() {
23
- this.tracer.instantEvent({
24
- name: 'TracingStartedInPage',
25
- id: this.getEventId(),
26
- cat: ['disabled-by-default-devtools.timeline'],
27
- args: {
28
- data: {
29
- sessionId: '-1',
30
- page: '0xfff',
31
- frames: [
32
- {
33
- frame: '0xfff',
34
- url: 'parcel',
35
- name: '',
36
- },
37
- ],
38
- },
39
- },
40
- });
41
-
42
- this.tracer.instantEvent({
43
- name: 'TracingStartedInBrowser',
44
- id: this.getEventId(),
45
- cat: ['disabled-by-default-devtools.timeline'],
46
- args: {
47
- data: {
48
- sessionId: '-1',
49
- },
50
- },
51
- });
52
- }
53
-
54
- addCPUProfile(name: string, profile: Profile) {
55
- const trace = this.tracer;
56
- const tid = this.tid;
57
- this.tid++;
58
-
59
- const cpuStartTime = profile.startTime;
60
- const cpuEndTime = profile.endTime;
61
-
62
- trace.instantEvent({
63
- tid,
64
- id: this.getEventId(),
65
- cat: ['toplevel'],
66
- name: 'TaskQueueManager::ProcessTaskFromWorkQueue',
67
- args: {
68
- src_file: '../../ipc/ipc_moji_bootstrap.cc',
69
- src_func: 'Accept',
70
- },
71
- ts: cpuStartTime,
72
- });
73
-
74
- trace.completeEvent({
75
- tid,
76
- name: 'EvaluateScript',
77
- id: this.getEventId(),
78
- cat: ['devtools.timeline'],
79
- ts: cpuStartTime,
80
- dur: cpuEndTime - cpuStartTime,
81
- args: {
82
- data: {
83
- url: 'parcel',
84
- lineNumber: 1,
85
- columnNumber: 1,
86
- frame: '0xFFF',
87
- },
88
- },
89
- });
90
-
91
- trace.instantEvent({
92
- tid,
93
- ts: 0,
94
- ph: 'M',
95
- cat: ['__metadata'],
96
- name: 'thread_name',
97
- args: {name},
98
- });
99
-
100
- trace.instantEvent({
101
- tid,
102
- name: 'CpuProfile',
103
- id: this.getEventId(),
104
- cat: ['disabled-by-default-devtools.timeline'],
105
- ts: cpuEndTime,
106
- args: {
107
- data: {
108
- cpuProfile: profile,
109
- },
110
- },
111
- });
112
- }
113
-
114
- pipe(writable: Writable) {
115
- return this.tracer.pipe(writable);
116
- }
117
-
118
- flush() {
119
- this.tracer.push(null);
120
- }
121
- }