@parcel/workers 2.0.0-nightly.140 → 2.0.0-nightly.1400
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +23 -0
- package/lib/Handle.js +16 -58
- package/lib/Worker.js +88 -53
- package/lib/WorkerFarm.js +240 -188
- package/lib/backend.js +0 -6
- package/lib/bus.js +8 -10
- package/lib/child.js +128 -114
- package/lib/childState.js +1 -2
- package/lib/cpuCount.js +25 -22
- package/lib/index.js +34 -30
- package/lib/process/ProcessChild.js +18 -24
- package/lib/process/ProcessWorker.js +27 -38
- package/lib/threads/ThreadsChild.js +26 -28
- package/lib/threads/ThreadsWorker.js +25 -31
- package/package.json +19 -8
- package/src/Handle.js +10 -39
- package/src/Worker.js +82 -15
- package/src/WorkerFarm.js +228 -55
- package/src/bus.js +1 -1
- package/src/child.js +83 -24
- package/src/cpuCount.js +9 -4
- package/src/index.js +8 -2
- package/src/process/ProcessChild.js +2 -1
- package/src/process/ProcessWorker.js +1 -1
- package/src/threads/ThreadsWorker.js +2 -2
- package/test/cpuCount.test.js +1 -1
- package/test/integration/workerfarm/console.js +1 -1
- package/test/integration/workerfarm/logging.js +1 -1
- package/test/integration/workerfarm/reverse-handle.js +2 -2
- package/test/workerfarm.js +5 -5
- package/lib/Profiler.js +0 -70
- package/lib/Trace.js +0 -126
- package/src/Profiler.js +0 -93
- package/src/Trace.js +0 -121
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
|
-
}
|