HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode.com/node_modules/@pm2/io/build/main/features/profiling.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfilingFeature = exports.ProfilingConfig = void 0;
const addonProfiler_1 = require("../profilers/addonProfiler");
const inspectorProfiler_1 = require("../profilers/inspectorProfiler");
const constants_1 = require("../constants");
const Debug = require("debug");
class ProfilingConfig {
}
exports.ProfilingConfig = ProfilingConfig;
const defaultProfilingConfig = {
    cpuJS: true,
    heapSnapshot: true,
    heapSampling: true,
    implementation: 'both'
};
const disabledProfilingConfig = {
    cpuJS: false,
    heapSnapshot: false,
    heapSampling: false,
    implementation: 'none'
};
class ProfilingFeature {
    constructor() {
        this.logger = Debug('axm:features:profiling');
    }
    init(config) {
        if (config === true) {
            config = defaultProfilingConfig;
        }
        else if (config === false) {
            config = disabledProfilingConfig;
        }
        else if (config === undefined) {
            config = defaultProfilingConfig;
        }
        if (process.env.PM2_PROFILING_FORCE_FALLBACK === 'true') {
            config.implementation = 'addon';
        }
        if (config.implementation === undefined || config.implementation === 'both') {
            config.implementation = (0, constants_1.canUseInspector)() === true ? 'inspector' : 'addon';
        }
        switch (config.implementation) {
            case 'inspector': {
                this.logger('using inspector implementation');
                this.profiler = new inspectorProfiler_1.default();
                break;
            }
            case 'addon': {
                this.logger('using addon implementation');
                this.profiler = new addonProfiler_1.default();
                break;
            }
            default: {
                return this.logger(`Invalid profiler implementation choosen: ${config.implementation}`);
            }
        }
        this.logger('init');
        this.profiler.init();
    }
    destroy() {
        this.logger('destroy');
        if (this.profiler === undefined)
            return;
        this.profiler.destroy();
    }
}
exports.ProfilingFeature = ProfilingFeature;