Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
2776a40e
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2776a40e
编写于
2月 28, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create issue and show profile files
上级
a050410a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
72 addition
and
31 deletion
+72
-31
src/main.js
src/main.js
+3
-1
src/vs/base/node/profiler.ts
src/vs/base/node/profiler.ts
+3
-3
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+5
-2
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+2
-1
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+14
-1
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+13
-8
src/vs/workbench/electron-browser/bootstrap/index.js
src/vs/workbench/electron-browser/bootstrap/index.js
+1
-1
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+31
-14
未找到文件。
src/main.js
浏览文件 @
2776a40e
...
...
@@ -7,7 +7,9 @@
if
(
process
.
argv
.
indexOf
(
'
--performance-startup-profile
'
)
>=
0
)
{
var
profiler
=
require
(
'
v8-profiler
'
);
profiler
.
startProfiling
(
'
startup-main
'
,
true
);
var
prefix
=
require
(
'
crypto
'
).
randomBytes
(
2
).
toString
(
'
hex
'
);
process
.
env
.
VSCODE_PROFILES_PREFIX
=
prefix
;
profiler
.
startProfiling
(
'
main
'
,
true
);
}
// Perf measurements
...
...
src/vs/base/node/profiler.ts
浏览文件 @
2776a40e
...
...
@@ -6,7 +6,6 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
homedir
}
from
'
os
'
;
import
{
join
}
from
'
path
'
;
import
{
writeFile
}
from
'
vs/base/node/pfs
'
;
...
...
@@ -17,7 +16,7 @@ export function startProfiling(name: string): TPromise<boolean> {
});
}
export
function
stopProfiling
(
name
:
string
):
TPromise
<
string
>
{
export
function
stopProfiling
(
dir
:
string
,
prefix
:
string
):
TPromise
<
string
>
{
return
lazyV8Profiler
.
value
.
then
(
profiler
=>
{
return
profiler
.
stopProfiling
();
}).
then
(
profile
=>
{
...
...
@@ -28,7 +27,7 @@ export function stopProfiling(name: string): TPromise<string> {
reject
(
error
);
return
;
}
const
filepath
=
join
(
homedir
(),
`
${
name
}
-
${
Date
.
now
()}
.cpuprofile
`
);
const
filepath
=
join
(
dir
,
`
${
prefix
}
_
${
profile
.
title
}
.cpuprofile.txt
`
);
writeFile
(
filepath
,
result
).
then
(()
=>
resolve
(
filepath
),
reject
);
});
});
...
...
@@ -41,6 +40,7 @@ declare interface Profiler {
}
declare
interface
Profile
{
title
:
string
;
export
(
callback
:
(
err
,
data
)
=>
void
);
delete
();
}
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
2776a40e
...
...
@@ -468,8 +468,11 @@ export class VSCodeWindow {
},
10000
);
}
if
(
this
.
environmentService
.
args
[
'
performance-startup-profile
'
])
{
stopProfiling
(
'
startup-main
'
).
then
(
path
=>
console
.
log
(
`cpu profile stored in
${
path
}
`
),
err
=>
console
.
error
(
err
));
// (--performance-startup-profile) save profile to disk
const
{
performanceStartupProfile
}
=
this
.
environmentService
;
if
(
performanceStartupProfile
)
{
stopProfiling
(
performanceStartupProfile
.
dir
,
performanceStartupProfile
.
prefix
)
.
done
(
undefined
,
err
=>
console
.
error
(
err
));
}
}
...
...
src/vs/platform/environment/common/environment.ts
浏览文件 @
2776a40e
...
...
@@ -22,7 +22,7 @@ export interface ParsedArgs {
locale
?:
string
;
'
user-data-dir
'
?:
string
;
performance
?:
boolean
;
[
'
performance-startup-profile
'
]?:
boolean
;
'
performance-startup-profile
'
?:
string
;
verbose
?:
boolean
;
logExtensionHostCommunication
?:
boolean
;
'
disable-extensions
'
?:
boolean
;
...
...
@@ -76,6 +76,7 @@ export interface IEnvironmentService {
verbose
:
boolean
;
wait
:
boolean
;
performance
:
boolean
;
performanceStartupProfile
:
{
prefix
:
string
,
dir
:
string
}
|
undefined
;
mainIPCHandle
:
string
;
sharedIPCHandle
:
string
;
...
...
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
2776a40e
...
...
@@ -109,9 +109,22 @@ export class EnvironmentService implements IEnvironmentService {
get
isBuilt
():
boolean
{
return
!
process
.
env
[
'
VSCODE_DEV
'
];
}
get
verbose
():
boolean
{
return
this
.
_args
.
verbose
;
}
get
wait
():
boolean
{
return
this
.
_args
.
wait
;
}
get
performance
():
boolean
{
return
this
.
_args
.
performance
;
}
get
logExtensionHostCommunication
():
boolean
{
return
this
.
_args
.
logExtensionHostCommunication
;
}
get
performance
():
boolean
{
return
this
.
_args
.
performance
;
}
@
memoize
get
performanceStartupProfile
():
{
prefix
:
string
,
dir
:
string
}
|
undefined
{
if
(
this
.
_args
[
'
performance-startup-profile
'
])
{
return
{
prefix
:
process
.
env
.
VSCODE_PROFILES_PREFIX
,
dir
:
os
.
homedir
()
};
}
else
{
return
undefined
;
}
}
@
memoize
get
mainIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
main
'
);
}
...
...
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
2776a40e
...
...
@@ -738,9 +738,9 @@ export class ReportPerformanceIssueAction extends Action {
super
(
id
,
label
);
}
public
run
():
TPromise
<
boolean
>
{
public
run
(
appendix
?:
string
):
TPromise
<
boolean
>
{
return
this
.
integrityService
.
isPure
().
then
(
res
=>
{
const
issueUrl
=
this
.
generatePerformanceIssueUrl
(
product
.
reportIssueUrl
,
pkg
.
name
,
pkg
.
version
,
product
.
commit
,
product
.
date
,
res
.
isPure
);
const
issueUrl
=
this
.
generatePerformanceIssueUrl
(
product
.
reportIssueUrl
,
pkg
.
name
,
pkg
.
version
,
product
.
commit
,
product
.
date
,
res
.
isPure
,
appendix
);
window
.
open
(
issueUrl
);
...
...
@@ -748,7 +748,15 @@ export class ReportPerformanceIssueAction extends Action {
});
}
private
generatePerformanceIssueUrl
(
baseUrl
:
string
,
name
:
string
,
version
:
string
,
commit
:
string
,
date
:
string
,
isPure
:
boolean
):
string
{
private
generatePerformanceIssueUrl
(
baseUrl
:
string
,
name
:
string
,
version
:
string
,
commit
:
string
,
date
:
string
,
isPure
:
boolean
,
appendix
?:
string
):
string
{
if
(
!
appendix
)
{
appendix
=
`Additional Steps to Reproduce (if any):
1.
2.`
;
}
let
nodeModuleLoadTime
:
number
;
if
(
this
.
environmentService
.
performance
)
{
nodeModuleLoadTime
=
this
.
computeNodeModulesLoadTime
();
...
...
@@ -775,10 +783,7 @@ ${this.generatePerformanceTable(nodeModuleLoadTime)}
---
Additional Steps to Reproduce (if any):
1.
2.`
${
appendix
}
`
);
return
`
${
baseUrl
}${
queryStringPrefix
}
body=
${
body
}
`
;
...
...
@@ -899,4 +904,4 @@ export class OpenIntroductoryVideosUrlAction extends Action {
window
.
open
(
OpenIntroductoryVideosUrlAction
.
URL
);
return
null
;
}
}
\ No newline at end of file
}
src/vs/workbench/electron-browser/bootstrap/index.js
浏览文件 @
2776a40e
...
...
@@ -9,7 +9,7 @@
if
(
window
.
location
.
search
.
indexOf
(
'
performance-startup-profile
'
)
>=
0
)
{
var
profiler
=
require
(
'
v8-profiler
'
);
profiler
.
startProfiling
(
'
startup-
renderer
'
,
true
);
profiler
.
startProfiling
(
'
renderer
'
,
true
);
}
/*global window,document,define*/
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
2776a40e
...
...
@@ -87,7 +87,7 @@ import { URLChannelClient } from 'vs/platform/url/common/urlIpc';
import
{
IURLService
}
from
'
vs/platform/url/common/url
'
;
import
{
IBackupService
}
from
'
vs/platform/backup/common/backup
'
;
import
{
BackupChannelClient
}
from
'
vs/platform/backup/common/backupIpc
'
;
import
{
ReloadWindowAction
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
ReloadWindowAction
,
ReportPerformanceIssueAction
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
ExtensionHostProcessWorker
}
from
'
vs/workbench/electron-browser/extensionHost
'
;
import
{
ITimerService
}
from
'
vs/workbench/services/timer/common/timerService
'
;
import
{
remote
}
from
'
electron
'
;
...
...
@@ -96,6 +96,8 @@ import { MainProcessTextMateSyntax } from 'vs/editor/electron-browser/textMate/T
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
readFontInfo
}
from
'
vs/editor/browser/config/configuration
'
;
import
SCMPreview
from
'
vs/workbench/parts/scm/browser/scmPreview
'
;
import
{
readdir
}
from
'
vs/base/node/pfs
'
;
import
{
join
}
from
'
path
'
;
import
'
vs/platform/opener/browser/opener.contribution
'
;
/**
...
...
@@ -234,21 +236,36 @@ export class WorkbenchShell {
}
// Profiler: startup cpu profile
if
(
this
.
environmentService
.
args
[
'
performance-startup-profile
'
])
{
stopProfiling
(
'
startup-renderer
'
).
then
(
path
=>
{
console
.
log
(
`cpu profile stored in
${
path
}
`
);
const
restart
=
this
.
messageService
.
confirm
({
type
:
'
info
'
,
message
:
nls
.
localize
(
'
prof.message
'
,
"
Successfully created profiles.
"
),
detail
:
nls
.
localize
(
'
prof.detail
'
,
"
To not lose unsaved work, we strongly recommended to restart '{0}' now.
"
,
this
.
environmentService
.
appNameLong
),
primaryButton
:
nls
.
localize
(
'
prof.restart
'
,
"
&&Restart
"
)
const
{
performanceStartupProfile
}
=
this
.
environmentService
;
if
(
performanceStartupProfile
)
{
stopProfiling
(
performanceStartupProfile
.
dir
,
performanceStartupProfile
.
prefix
).
then
(()
=>
{
readdir
(
performanceStartupProfile
.
dir
).
then
(
files
=>
{
return
files
.
filter
(
value
=>
value
.
indexOf
(
performanceStartupProfile
.
prefix
)
===
0
);
}).
then
(
files
=>
{
const
profileFiles
=
files
.
reduce
((
prev
,
cur
)
=>
`
${
prev
}${
join
(
performanceStartupProfile
.
dir
,
cur
)}
\n`
,
'
\n
'
);
const
primaryButton
=
this
.
messageService
.
confirm
({
type
:
'
info
'
,
message
:
nls
.
localize
(
'
prof.message
'
,
"
Successfully created profiles.
"
),
detail
:
nls
.
localize
(
'
prof.detail
'
,
"
Please create an issue and manually attach the following files:
\n
{0}
"
,
profileFiles
),
primaryButton
:
nls
.
localize
(
'
prof.restartAndFileIssue
'
,
"
Create Issue and Restart
"
),
secondaryButton
:
nls
.
localize
(
'
prof.restart
'
,
"
Restart
"
)
});
let
createIssue
=
TPromise
.
as
(
undefined
);
if
(
primaryButton
)
{
const
action
=
this
.
workbench
.
getInstantiationService
().
createInstance
(
ReportPerformanceIssueAction
,
ReportPerformanceIssueAction
.
ID
,
ReportPerformanceIssueAction
.
LABEL
);
createIssue
=
action
.
run
(
`:warning: Make sure to **attach** these files: :warning:\n
${
files
.
map
(
file
=>
`-
\`
${
join
(
performanceStartupProfile
.
dir
,
file
)}
\`
`
).
join
(
'
\n
'
)}
`
).
then
(()
=>
{
return
this
.
windowsService
.
showItemInFolder
(
performanceStartupProfile
.
dir
);
});
}
createIssue
.
then
(()
=>
this
.
windowsService
.
relaunch
({
removeArgs
:
[
'
--performance-startup-profile
'
]
}));
});
if
(
restart
)
{
this
.
windowsService
.
relaunch
({
removeArgs
:
[
'
--performance-startup-profile
'
]
});
}
},
err
=>
console
.
error
(
err
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录