当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript id.virtualMachineHint类代码示例

本文整理汇总了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;
}
开发者ID:PKRoma,项目名称:vscode,代码行数:17,代码来源:diagnosticsService.ts

示例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');
}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:20,代码来源:diagnostics.ts

示例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;
}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:23,代码来源:diagnostics.ts

示例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;
		}
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:66,代码来源:timerService.ts

示例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;
		}
	}
开发者ID:AllureFer,项目名称:vscode,代码行数:70,代码来源:timerService.ts


注:本文中的vs/base/node/id.virtualMachineHint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。