()
| 78 | } |
| 79 | |
| 80 | startProfiling() { |
| 81 | if (this.inspector === undefined) { |
| 82 | return Promise.resolve(); |
| 83 | } |
| 84 | |
| 85 | try { |
| 86 | this.session = new /** @type {Inspector} */ (inspector).Session(); |
| 87 | /** @type {Session} */ |
| 88 | (this.session).connect(); |
| 89 | } catch (_) { |
| 90 | this.session = undefined; |
| 91 | return Promise.resolve(); |
| 92 | } |
| 93 | |
| 94 | const hrtime = process.hrtime(); |
| 95 | this._startTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); |
| 96 | |
| 97 | return Promise.all([ |
| 98 | this.sendCommand("Profiler.setSamplingInterval", { |
| 99 | interval: 100 |
| 100 | }), |
| 101 | this.sendCommand("Profiler.enable"), |
| 102 | this.sendCommand("Profiler.start") |
| 103 | ]); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Returns promise for the result. |
no test coverage detected