當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。