blob: 0e621fb19f03a3883fb1e30ec4b31f88cf9fc6f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => {
Assert.ok(!Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
let startPromise = Services.profiler.StartProfiler(1000, 10, []);
// Default: Active and not paused.
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
await startPromise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
// Pause everything, implicitly pauses sampling.
let pausePromise = Services.profiler.Pause();
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await pausePromise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
// While fully paused, pause and resume sampling only, no expected changes.
let pauseSamplingPromise = Services.profiler.PauseSampling();
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await pauseSamplingPromise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
let resumeSamplingPromise = Services.profiler.ResumeSampling();
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await resumeSamplingPromise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
// Resume everything.
let resumePromise = Services.profiler.Resume();
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
await resumePromise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
// Pause sampling only.
let pauseSampling2Promise = Services.profiler.PauseSampling();
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await pauseSampling2Promise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
// While sampling is paused, pause everything.
let pause2Promise = Services.profiler.Pause();
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await pause2Promise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
// Resume, but sampling is still paused separately.
let resume2promise = Services.profiler.Resume();
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
await resume2promise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(Services.profiler.IsSamplingPaused());
// Resume sampling only.
let resumeSampling2Promise = Services.profiler.ResumeSampling();
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
await resumeSampling2Promise;
Assert.ok(Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
let stopPromise = Services.profiler.StopProfiler();
Assert.ok(!Services.profiler.IsActive());
// Stopping is not pausing.
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
await stopPromise;
Assert.ok(!Services.profiler.IsActive());
Assert.ok(!Services.profiler.IsPaused());
Assert.ok(!Services.profiler.IsSamplingPaused());
});
|