@parcel/workers 2.8.3 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +10 -9
- package/lib/Handle.js +4 -15
- package/lib/Worker.js +6 -43
- package/lib/WorkerFarm.js +35 -128
- package/lib/backend.js +0 -6
- package/lib/bus.js +0 -10
- package/lib/child.js +29 -65
- package/lib/childState.js +0 -1
- package/lib/cpuCount.js +2 -20
- package/lib/index.js +12 -24
- package/lib/process/ProcessChild.js +0 -17
- package/lib/process/ProcessWorker.js +0 -22
- package/lib/threads/ThreadsChild.js +0 -20
- package/lib/threads/ThreadsWorker.js +0 -18
- package/package.json +8 -8
- package/src/Worker.js +2 -0
- package/src/WorkerFarm.js +20 -7
- package/src/child.js +13 -3
- package/src/index.js +7 -1
- package/lib/Profiler.js +0 -80
- package/lib/Trace.js +0 -131
- package/src/Profiler.js +0 -93
- package/src/Trace.js +0 -125
package/src/Trace.js
DELETED
@@ -1,125 +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
|
-
}
|
16
|
-
|
17
|
-
getEventId(): number {
|
18
|
-
return this.eventId++;
|
19
|
-
}
|
20
|
-
|
21
|
-
init(ts: number) {
|
22
|
-
this.tracer.instantEvent({
|
23
|
-
name: 'TracingStartedInPage',
|
24
|
-
id: this.getEventId(),
|
25
|
-
ts,
|
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
|
-
ts,
|
46
|
-
cat: ['disabled-by-default-devtools.timeline'],
|
47
|
-
args: {
|
48
|
-
data: {
|
49
|
-
sessionId: '-1',
|
50
|
-
},
|
51
|
-
},
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
55
|
-
addCPUProfile(name: string, profile: Profile) {
|
56
|
-
if (this.eventId === 0) {
|
57
|
-
this.init(profile.startTime);
|
58
|
-
}
|
59
|
-
const trace = this.tracer;
|
60
|
-
const tid = this.tid;
|
61
|
-
this.tid++;
|
62
|
-
|
63
|
-
const cpuStartTime = profile.startTime;
|
64
|
-
const cpuEndTime = profile.endTime;
|
65
|
-
|
66
|
-
trace.instantEvent({
|
67
|
-
tid,
|
68
|
-
id: this.getEventId(),
|
69
|
-
cat: ['toplevel'],
|
70
|
-
name: 'TaskQueueManager::ProcessTaskFromWorkQueue',
|
71
|
-
args: {
|
72
|
-
src_file: '../../ipc/ipc_moji_bootstrap.cc',
|
73
|
-
src_func: 'Accept',
|
74
|
-
},
|
75
|
-
ts: cpuStartTime,
|
76
|
-
});
|
77
|
-
|
78
|
-
trace.completeEvent({
|
79
|
-
tid,
|
80
|
-
name: 'EvaluateScript',
|
81
|
-
id: this.getEventId(),
|
82
|
-
cat: ['devtools.timeline'],
|
83
|
-
ts: cpuStartTime,
|
84
|
-
dur: cpuEndTime - cpuStartTime,
|
85
|
-
args: {
|
86
|
-
data: {
|
87
|
-
url: 'parcel',
|
88
|
-
lineNumber: 1,
|
89
|
-
columnNumber: 1,
|
90
|
-
frame: '0xFFF',
|
91
|
-
},
|
92
|
-
},
|
93
|
-
});
|
94
|
-
|
95
|
-
trace.instantEvent({
|
96
|
-
tid,
|
97
|
-
ts: 0,
|
98
|
-
ph: 'M',
|
99
|
-
cat: ['__metadata'],
|
100
|
-
name: 'thread_name',
|
101
|
-
args: {name},
|
102
|
-
});
|
103
|
-
|
104
|
-
trace.instantEvent({
|
105
|
-
tid,
|
106
|
-
name: 'CpuProfile',
|
107
|
-
id: this.getEventId(),
|
108
|
-
cat: ['disabled-by-default-devtools.timeline'],
|
109
|
-
ts: cpuEndTime,
|
110
|
-
args: {
|
111
|
-
data: {
|
112
|
-
cpuProfile: profile,
|
113
|
-
},
|
114
|
-
},
|
115
|
-
});
|
116
|
-
}
|
117
|
-
|
118
|
-
pipe(writable: Writable): stream$Writable {
|
119
|
-
return this.tracer.pipe(writable);
|
120
|
-
}
|
121
|
-
|
122
|
-
flush() {
|
123
|
-
this.tracer.push(null);
|
124
|
-
}
|
125
|
-
}
|