mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
69
webGl/my-threejs-test/node_modules/@parcel/profiler/lib/SamplingProfiler.js
generated
vendored
Normal file
69
webGl/my-threejs-test/node_modules/@parcel/profiler/lib/SamplingProfiler.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _assert() {
|
||||
const data = _interopRequireDefault(require("assert"));
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _diagnostic() {
|
||||
const data = _interopRequireDefault(require("@parcel/diagnostic"));
|
||||
_diagnostic = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
// https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-Profile
|
||||
// https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ProfileNode
|
||||
// https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-CallFrame
|
||||
// https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-PositionTickInfo
|
||||
class SamplingProfiler {
|
||||
startProfiling() {
|
||||
let inspector;
|
||||
try {
|
||||
inspector = require('inspector');
|
||||
} catch (err) {
|
||||
throw new (_diagnostic().default)({
|
||||
diagnostic: {
|
||||
message: `The inspector module isn't available`,
|
||||
origin: '@parcel/workers',
|
||||
hints: ['Disable build profiling']
|
||||
}
|
||||
});
|
||||
}
|
||||
this.session = new inspector.Session();
|
||||
this.session.connect();
|
||||
return Promise.all([this.sendCommand('Profiler.setSamplingInterval', {
|
||||
interval: 100
|
||||
}), this.sendCommand('Profiler.enable'), this.sendCommand('Profiler.start')]);
|
||||
}
|
||||
sendCommand(method, params) {
|
||||
(0, _assert().default)(this.session != null);
|
||||
return new Promise((resolve, reject) => {
|
||||
this.session.post(method, params, (err, p) => {
|
||||
if (err == null) {
|
||||
resolve(p);
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
destroy() {
|
||||
if (this.session != null) {
|
||||
this.session.disconnect();
|
||||
}
|
||||
}
|
||||
async stopProfiling() {
|
||||
let res = await this.sendCommand('Profiler.stop');
|
||||
this.destroy();
|
||||
return res.profile;
|
||||
}
|
||||
}
|
||||
exports.default = SamplingProfiler;
|
Reference in New Issue
Block a user