當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ILaunchService.getMainProcessInfo方法代碼示例

本文整理匯總了TypeScript中vs/platform/launch/electron-main/launchService.ILaunchService.getMainProcessInfo方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ILaunchService.getMainProcessInfo方法的具體用法?TypeScript ILaunchService.getMainProcessInfo怎麽用?TypeScript ILaunchService.getMainProcessInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/platform/launch/electron-main/launchService.ILaunchService的用法示例。


在下文中一共展示了ILaunchService.getMainProcessInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getDiagnostics

	async getDiagnostics(launchService: ILaunchService): Promise<string> {
		const output: string[] = [];
		const info = await launchService.getMainProcessInfo();
		return listProcesses(info.mainPID).then(async rootProcess => {

			// Environment Info
			output.push('');
			output.push(this.formatEnvironment(info));

			// Process List
			output.push('');
			output.push(this.formatProcessList(info, rootProcess));

			// Workspace Stats
			if (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0 && !window.remoteAuthority)) {
				output.push('');
				output.push('Workspace Stats: ');
				output.push(await this.formatWorkspaceMetadata(info));
			}

			try {
				const data = await launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true });
				data.forEach(diagnostics => {
					if (isRemoteDiagnosticError(diagnostics)) {
						output.push(`\n${diagnostics.errorMessage}`);
					} else {
						output.push('\n\n');
						output.push(`Remote:           ${diagnostics.hostName}`);
						output.push(this.formatMachineInfo(diagnostics.machineInfo));

						if (diagnostics.processes) {
							output.push(this.formatProcessList(info, diagnostics.processes));
						}

						if (diagnostics.workspaceMetadata) {
							for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
								const metadata = diagnostics.workspaceMetadata[folder];

								let countMessage = `${metadata.fileCount} files`;
								if (metadata.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}

								output.push(`Folder (${folder}): ${countMessage}`);
								output.push(this.formatWorkspaceStats(metadata));
							}
						}
					}
				});
			} catch (e) {
				output.push('\n\n');
				output.push(`Fetching status information from remotes failed: ${e.message}`);
			}

			output.push('');
			output.push('');

			return output.join('\n');
		});
	}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:60,代碼來源:diagnosticsService.ts

示例2: getPerformanceInfo

	async getPerformanceInfo(launchService: ILaunchService): Promise<PerformanceInfo> {
		const info = await launchService.getMainProcessInfo();
		return Promise.all<ProcessItem, string>([listProcesses(info.mainPID), this.formatWorkspaceMetadata(info)]).then(async result => {
			let [rootProcess, workspaceInfo] = result;
			let processInfo = this.formatProcessList(info, rootProcess);

			try {
				const remoteData = await launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true });
				remoteData.forEach(diagnostics => {
					if (isRemoteDiagnosticError(diagnostics)) {
						processInfo += `\n${diagnostics.errorMessage}`;
						workspaceInfo += `\n${diagnostics.errorMessage}`;
					} else {
						processInfo += `\n\nRemote: ${diagnostics.hostName}`;
						if (diagnostics.processes) {
							processInfo += `\n${this.formatProcessList(info, diagnostics.processes)}`;
						}

						if (diagnostics.workspaceMetadata) {
							workspaceInfo += `\n|  Remote: ${diagnostics.hostName}`;
							for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
								const metadata = diagnostics.workspaceMetadata[folder];

								let countMessage = `${metadata.fileCount} files`;
								if (metadata.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}

								workspaceInfo += `|    Folder (${folder}): ${countMessage}`;
								workspaceInfo += this.formatWorkspaceStats(metadata);
							}
						}
					}
				});
			} catch (e) {
				processInfo += `\nFetching remote data failed: ${e}`;
				workspaceInfo += `\nFetching remote data failed: ${e}`;
			}

			return {
				processInfo,
				workspaceInfo
			};
		});
	}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:45,代碼來源:diagnosticsService.ts

示例3: getSystemInfo

	async getSystemInfo(launchService: ILaunchService): Promise<SystemInfo> {
		const info = await launchService.getMainProcessInfo();
		const { memory, vmHint, os, cpus } = getMachineInfo();
		const systemInfo: SystemInfo = {
			os,
			memory,
			cpus,
			vmHint,
			processArgs: `${info.mainArguments.join(' ')}`,
			gpuStatus: app.getGPUFeatureStatus(),
			screenReader: `${app.isAccessibilitySupportEnabled() ? 'yes' : 'no'}`,
			remoteData: (await launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })).filter((x): x is IRemoteDiagnosticInfo => !(x instanceof Error))
		};


		if (!isWindows) {
			systemInfo.load = `${osLib.loadavg().map(l => Math.round(l)).join(', ')}`;
		}

		return Promise.resolve(systemInfo);
	}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:21,代碼來源:diagnosticsService.ts


注:本文中的vs/platform/launch/electron-main/launchService.ILaunchService.getMainProcessInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。