本文整理汇总了TypeScript中vs/base/node/id.virtualMachineHint类的典型用法代码示例。如果您正苦于以下问题:TypeScript virtualMachineHint类的具体用法?TypeScript virtualMachineHint怎么用?TypeScript virtualMachineHint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了virtualMachineHint类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMachineInfo
export function getMachineInfo(): IMachineInfo {
const MB = 1024 * 1024;
const GB = 1024 * MB;
const machineInfo: IMachineInfo = {
os: `${os.type()} ${os.arch()} ${os.release()}`,
memory: `${(os.totalmem() / GB).toFixed(2)}GB (${(os.freemem() / GB).toFixed(2)}GB free)`,
vmHint: `${Math.round((virtualMachineHint.value() * 100))}%`,
};
const cpus = os.cpus();
if (cpus && cpus.length > 0) {
machineInfo.cpus = `${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`;
}
return machineInfo;
}
示例2: formatEnvironment
function formatEnvironment(info: IMainProcessInfo): string {
const MB = 1024 * 1024;
const GB = 1024 * MB;
const output: string[] = [];
output.push(`Version: ${pkg.name} ${pkg.version} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})`);
output.push(`OS Version: ${os.type()} ${os.arch()} ${os.release()})`);
const cpus = os.cpus();
if (cpus && cpus.length > 0) {
output.push(`CPUs: ${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`);
}
output.push(`Memory (System): ${(os.totalmem() / GB).toFixed(2)}GB (${(os.freemem() / GB).toFixed(2)}GB free)`);
if (!isWindows) {
output.push(`Load (avg): ${os.loadavg().map(l => Math.round(l)).join(', ')}`); // only provided on Linux/macOS
}
output.push(`VM: ${Math.round((virtualMachineHint.value() * 100))}%`);
output.push(`Screen Reader: ${app.isAccessibilitySupportEnabled() ? 'yes' : 'no'}`);
return output.join('\n');
}
示例3: getSystemInfo
function getSystemInfo(info: IMainProcessInfo): SystemInfo {
const MB = 1024 * 1024;
const GB = 1024 * MB;
const systemInfo: SystemInfo = {
'Memory (System)': `${(os.totalmem() / GB).toFixed(2)}GB (${(os.freemem() / GB).toFixed(2)}GB free)`,
VM: `${Math.round((virtualMachineHint.value() * 100))}%`,
'Screen Reader': `${app.isAccessibilitySupportEnabled() ? 'yes' : 'no'}`,
'Process Argv': `${info.mainArguments.join(' ')}`
};
const cpus = os.cpus();
if (cpus && cpus.length > 0) {
systemInfo.CPUs = `${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`;
}
if (!isWindows) {
systemInfo['Load (avg)'] = `${os.loadavg().map(l => Math.round(l)).join(', ')}`;
}
return systemInfo;
}
示例4: _computeStartupMetrics
public _computeStartupMetrics(): void {
const now = Date.now();
const initialStartup = !!this.isInitialStartup;
const start = initialStartup ? this.start : this.windowLoad;
let totalmem: number;
let freemem: number;
let cpus: { count: number; speed: number; model: string; };
let platform: string;
let release: string;
let arch: string;
let loadavg: number[];
let meminfo: IMemoryInfo;
let isVMLikelyhood: number;
try {
totalmem = os.totalmem();
freemem = os.freemem();
platform = os.platform();
release = os.release();
arch = os.arch();
loadavg = os.loadavg();
meminfo = process.getProcessMemoryInfo();
isVMLikelyhood = Math.round((virtualMachineHint.value() * 100));
const rawCpus = os.cpus();
if (rawCpus && rawCpus.length > 0) {
cpus = { count: rawCpus.length, speed: rawCpus[0].speed, model: rawCpus[0].model };
}
} catch (error) {
// ignore, be on the safe side with these hardware method calls
}
this._startupMetrics = {
version: 1,
ellapsed: this.workbenchStarted - start,
timers: {
ellapsedExtensions: this.afterExtensionLoad - this.beforeExtensionLoad,
ellapsedExtensionsReady: this.afterExtensionLoad - start,
ellapsedRequire: this.afterLoadWorkbenchMain - this.beforeLoadWorkbenchMain,
ellapsedViewletRestore: this.restoreViewletDuration,
ellapsedEditorRestore: this.restoreEditorsDuration,
ellapsedWorkbench: this.workbenchStarted - this.beforeWorkbenchOpen,
ellapsedWindowLoadToRequire: this.beforeLoadWorkbenchMain - this.windowLoad,
ellapsedTimersToTimersComputed: Date.now() - now
},
platform,
release,
arch,
totalmem,
freemem,
meminfo,
cpus,
loadavg,
initialStartup,
isVMLikelyhood,
hasAccessibilitySupport: !!this.hasAccessibilitySupport,
emptyWorkbench: this.isEmptyWorkbench
};
if (initialStartup) {
this._startupMetrics.timers.ellapsedAppReady = this.appReady - this.start;
this._startupMetrics.timers.ellapsedWindowLoad = this.windowLoad - this.appReady;
}
}
示例5: _computeStartupMetrics
public _computeStartupMetrics(): void {
const now = Date.now();
const initialStartup = !!this.isInitialStartup;
const start = initialStartup ? this.start : this.windowLoad;
let totalmem: number;
let freemem: number;
let cpus: { count: number; speed: number; model: string; };
let platform: string;
let release: string;
let arch: string;
let loadavg: number[];
let meminfo: IMemoryInfo;
let isVMLikelyhood: number;
try {
totalmem = os.totalmem();
freemem = os.freemem();
platform = os.platform();
release = os.release();
arch = os.arch();
loadavg = os.loadavg();
meminfo = process.getProcessMemoryInfo();
isVMLikelyhood = Math.round((virtualMachineHint.value() * 100));
const rawCpus = os.cpus();
if (rawCpus && rawCpus.length > 0) {
cpus = { count: rawCpus.length, speed: rawCpus[0].speed, model: rawCpus[0].model };
}
} catch (error) {
// ignore, be on the safe side with these hardware method calls
}
let nlsStart = perf.getEntry('mark', 'nlsGeneration:start');
let nlsEnd = perf.getEntry('mark', 'nlsGeneration:end');
let nlsTime = nlsStart && nlsEnd ? nlsEnd.startTime - nlsStart.startTime : 0;
this._startupMetrics = {
version: 1,
ellapsed: perf.getEntry('mark', 'didStartWorkbench').startTime - start,
timers: {
ellapsedExtensions: perf.getDuration('willLoadExtensions', 'didLoadExtensions'),
ellapsedExtensionsReady: perf.getEntry('mark', 'didLoadExtensions').startTime - start,
ellapsedRequire: perf.getDuration('willLoadWorkbenchMain', 'didLoadWorkbenchMain'),
ellapsedEditorRestore: perf.getDuration('willRestoreEditors', 'didRestoreEditors'),
ellapsedViewletRestore: perf.getDuration('willRestoreViewlet', 'didRestoreViewlet'),
ellapsedWorkbench: perf.getDuration('willStartWorkbench', 'didStartWorkbench'),
ellapsedWindowLoadToRequire: perf.getEntry('mark', 'willLoadWorkbenchMain').startTime - this.windowLoad,
ellapsedTimersToTimersComputed: Date.now() - now,
ellapsedNlsGeneration: nlsTime
},
platform,
release,
arch,
totalmem,
freemem,
meminfo,
cpus,
loadavg,
initialStartup,
isVMLikelyhood,
hasAccessibilitySupport: !!this.hasAccessibilitySupport,
emptyWorkbench: this.isEmptyWorkbench
};
if (initialStartup) {
this._startupMetrics.timers.ellapsedAppReady = perf.getDuration('main:started', 'main:appReady');
this._startupMetrics.timers.ellapsedWindowLoad = this.windowLoad - perf.getEntry('mark', 'main:appReady').startTime;
}
}