Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f2bf5fc8
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f2bf5fc8
编写于
2月 05, 2018
作者:
R
Rachel Macfarlane
提交者:
Ramya Rao
2月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue reporter: Loading process information takes a long time, #42860 (#42983)
上级
e34fe5aa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
50 deletion
+92
-50
src/vs/code/electron-browser/issue/issueReporterMain.ts
src/vs/code/electron-browser/issue/issueReporterMain.ts
+46
-16
src/vs/code/electron-main/diagnostics.ts
src/vs/code/electron-main/diagnostics.ts
+26
-28
src/vs/platform/issue/electron-main/issueService.ts
src/vs/platform/issue/electron-main/issueService.ts
+20
-6
未找到文件。
src/vs/code/electron-browser/issue/issueReporterMain.ts
浏览文件 @
f2bf5fc8
...
...
@@ -54,6 +54,8 @@ export class IssueReporter extends Disposable {
private
telemetryService
:
ITelemetryService
;
private
issueReporterModel
:
IssueReporterModel
;
private
shouldQueueSearch
=
true
;
private
receivedSystemInfo
=
false
;
private
receivedPerformanceInfo
=
false
;
constructor
(
configuration
:
IssueReporterConfiguration
)
{
super
();
...
...
@@ -74,17 +76,26 @@ export class IssueReporter extends Disposable {
reprosWithoutExtensions
:
false
});
ipcRenderer
.
on
(
'
issueInfoResponse
'
,
(
event
,
info
)
=>
{
ipcRenderer
.
on
(
'
issue
Performance
InfoResponse
'
,
(
event
,
info
)
=>
{
this
.
issueReporterModel
.
update
(
info
);
this
.
receivedPerformanceInfo
=
true
;
this
.
updateAllBlocks
(
this
.
issueReporterModel
.
getData
());
const
state
=
this
.
issueReporterModel
.
getData
();
this
.
updateProcessInfo
(
state
);
this
.
updateWorkspaceInfo
(
state
);
this
.
updatePreviewButtonState
();
});
const
submitButton
=
<
HTMLButtonElement
>
document
.
getElementById
(
'
github-submit-btn
'
);
submitButton
.
disabled
=
false
;
submitButton
.
textContent
=
localize
(
'
previewOnGitHub
'
,
"
Preview on GitHub
"
);
ipcRenderer
.
on
(
'
issueSystemInfoResponse
'
,
(
event
,
info
)
=>
{
this
.
issueReporterModel
.
update
({
systemInfo
:
info
});
this
.
receivedSystemInfo
=
true
;
this
.
updateSystemInfo
(
this
.
issueReporterModel
.
getData
());
this
.
updatePreviewButtonState
();
});
ipcRenderer
.
send
(
'
issueInfoRequest
'
);
ipcRenderer
.
send
(
'
issueSystemInfoRequest
'
);
ipcRenderer
.
send
(
'
issuePerformanceInfoRequest
'
);
if
(
window
.
document
.
documentElement
.
lang
!==
'
en
'
)
{
show
(
document
.
getElementById
(
'
english
'
));
...
...
@@ -211,6 +222,7 @@ export class IssueReporter extends Disposable {
private
setEventHandlers
():
void
{
document
.
getElementById
(
'
issue-type
'
).
addEventListener
(
'
change
'
,
(
event
:
Event
)
=>
{
this
.
issueReporterModel
.
update
({
issueType
:
parseInt
((
<
HTMLInputElement
>
event
.
target
).
value
)
});
this
.
updatePreviewButtonState
();
this
.
render
();
});
...
...
@@ -269,6 +281,34 @@ export class IssueReporter extends Disposable {
}
}
private
updatePreviewButtonState
()
{
const
submitButton
=
<
HTMLButtonElement
>
document
.
getElementById
(
'
github-submit-btn
'
);
if
(
this
.
isPreviewEnabled
())
{
submitButton
.
disabled
=
false
;
submitButton
.
textContent
=
localize
(
'
previewOnGitHub
'
,
"
Preview on GitHub
"
);
}
else
{
submitButton
.
disabled
=
true
;
submitButton
.
textContent
=
localize
(
'
loadingData
'
,
"
Loading data...
"
);
}
}
private
isPreviewEnabled
()
{
const
issueType
=
this
.
issueReporterModel
.
getData
().
issueType
;
if
(
issueType
===
IssueType
.
Bug
&&
this
.
receivedSystemInfo
)
{
return
true
;
}
if
(
issueType
===
IssueType
.
PerformanceIssue
&&
this
.
receivedSystemInfo
&&
this
.
receivedPerformanceInfo
)
{
return
true
;
}
if
(
issueType
===
IssueType
.
FeatureRequest
)
{
return
true
;
}
return
false
;
}
@
debounce
(
300
)
private
searchGitHub
(
event
:
Event
):
void
{
const
title
=
(
<
HTMLInputElement
>
event
.
target
).
value
;
...
...
@@ -449,16 +489,6 @@ export class IssueReporter extends Disposable {
return
true
;
}
/**
* Update blocks
*/
private
updateAllBlocks
(
state
)
{
this
.
updateSystemInfo
(
state
);
this
.
updateProcessInfo
(
state
);
this
.
updateWorkspaceInfo
(
state
);
}
private
updateSystemInfo
=
(
state
)
=>
{
const
target
=
document
.
querySelector
(
'
.block-system .block-info
'
);
let
tableHtml
=
''
;
...
...
src/vs/code/electron-main/diagnostics.ts
浏览文件 @
f2bf5fc8
...
...
@@ -38,13 +38,12 @@ export interface ProcessInfo {
name
:
string
;
}
export
interface
DiagnosticInfo
{
systemInfo
?:
SystemInfo
;
export
interface
PerformanceInfo
{
processInfo
?:
ProcessInfo
[];
workspaceInfo
?:
string
;
}
export
function
buildDiagnostics
(
info
:
IMainProcessInfo
):
Promise
<
Diagnostic
Info
>
{
export
function
getPerformanceInfo
(
info
:
IMainProcessInfo
):
Promise
<
Performance
Info
>
{
return
listProcesses
(
info
.
mainPID
).
then
(
rootProcess
=>
{
const
workspaceInfoMessages
=
[];
...
...
@@ -79,13 +78,36 @@ export function buildDiagnostics(info: IMainProcessInfo): Promise<DiagnosticInfo
}
return
{
systemInfo
:
getSystemInfo
(
info
),
processInfo
:
getProcessList
(
info
,
rootProcess
),
workspaceInfo
:
workspaceInfoMessages
.
join
(
'
\n
'
)
};
});
}
export
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
;
}
export
function
printDiagnostics
(
info
:
IMainProcessInfo
):
Promise
<
any
>
{
return
listProcesses
(
info
.
mainPID
).
then
(
rootProcess
=>
{
...
...
@@ -186,30 +208,6 @@ function formatLaunchConfigs(configs: WorkspaceStatItem[]): string {
return
output
.
join
(
'
\n
'
);
}
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
;
}
function
getProcessList
(
info
:
IMainProcessInfo
,
rootProcess
:
ProcessItem
):
ProcessInfo
[]
{
const
mapPidToWindowTitle
=
new
Map
<
number
,
string
>
();
info
.
windows
.
forEach
(
window
=>
mapPidToWindowTitle
.
set
(
window
.
pid
,
window
.
title
));
...
...
src/vs/platform/issue/electron-main/issueService.ts
浏览文件 @
f2bf5fc8
...
...
@@ -12,7 +12,7 @@ import { parseArgs } from 'vs/platform/environment/node/argv';
import
{
IIssueService
,
IssueReporterData
}
from
'
vs/platform/issue/common/issue
'
;
import
{
BrowserWindow
,
ipcMain
,
screen
}
from
'
electron
'
;
import
{
ILaunchService
}
from
'
vs/code/electron-main/launch
'
;
import
{
buildDiagnostics
,
Diagnostic
Info
}
from
'
vs/code/electron-main/diagnostics
'
;
import
{
getPerformanceInfo
,
PerformanceInfo
,
getSystemInfo
,
System
Info
}
from
'
vs/code/electron-main/diagnostics
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
...
...
@@ -30,9 +30,15 @@ export class IssueService implements IIssueService {
)
{
}
openReporter
(
data
:
IssueReporterData
):
TPromise
<
void
>
{
ipcMain
.
on
(
'
issueInfoRequest
'
,
event
=>
{
this
.
getStatusInfo
().
then
(
msg
=>
{
event
.
sender
.
send
(
'
issueInfoResponse
'
,
msg
);
ipcMain
.
on
(
'
issueSystemInfoRequest
'
,
event
=>
{
this
.
getSystemInformation
().
then
(
msg
=>
{
event
.
sender
.
send
(
'
issueSystemInfoResponse
'
,
msg
);
});
});
ipcMain
.
on
(
'
issuePerformanceInfoRequest
'
,
event
=>
{
this
.
getPerformanceInfo
().
then
(
msg
=>
{
event
.
sender
.
send
(
'
issuePerformanceInfoResponse
'
,
msg
);
});
});
...
...
@@ -100,10 +106,18 @@ export class IssueService implements IIssueService {
return
state
;
}
private
getStatusInfo
():
TPromise
<
DiagnosticInfo
>
{
private
getSystemInformation
():
TPromise
<
SystemInfo
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
launchService
.
getMainProcessInfo
().
then
(
info
=>
{
resolve
(
getSystemInfo
(
info
));
});
});
}
private
getPerformanceInfo
():
TPromise
<
PerformanceInfo
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
launchService
.
getMainProcessInfo
().
then
(
info
=>
{
buildDiagnostics
(
info
)
getPerformanceInfo
(
info
)
.
then
(
diagnosticInfo
=>
{
resolve
(
diagnosticInfo
);
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录