Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7c4205b5
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,体验更适合开发者的 AI 搜索 >>
提交
7c4205b5
编写于
1月 25, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #42144
上级
554a9c6d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
31 deletion
+26
-31
src/vs/platform/actions/test/common/menuService.test.ts
src/vs/platform/actions/test/common/menuService.test.ts
+4
-0
src/vs/platform/commands/test/commandService.test.ts
src/vs/platform/commands/test/commandService.test.ts
+3
-0
src/vs/platform/extensions/common/extensions.ts
src/vs/platform/extensions/common/extensions.ts
+5
-0
src/vs/workbench/parts/extensions/electron-browser/extensionProfileService.ts
...ts/extensions/electron-browser/extensionProfileService.ts
+8
-0
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
...nch/services/extensions/electron-browser/extensionHost.ts
+2
-0
src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts
...ices/extensions/electron-browser/extensionHostProfiler.ts
+0
-31
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+4
-0
未找到文件。
src/vs/platform/actions/test/common/menuService.test.ts
浏览文件 @
7c4205b5
...
...
@@ -48,6 +48,10 @@ class MockExtensionService implements IExtensionService {
throw
new
Error
(
'
Not implemented
'
);
}
public
canProfileExtensionHost
()
{
return
false
;
}
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
throw
new
Error
(
'
Not implemented
'
);
}
...
...
src/vs/platform/commands/test/commandService.test.ts
浏览文件 @
7c4205b5
...
...
@@ -43,6 +43,9 @@ class SimpleExtensionService implements IExtensionService {
getExtensions
():
TPromise
<
IExtensionDescription
[]
>
{
return
TPromise
.
wrap
([]);
}
canProfileExtensionHost
()
{
return
false
;
}
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
throw
new
Error
(
'
Not implemented
'
);
}
...
...
src/vs/platform/extensions/common/extensions.ts
浏览文件 @
7c4205b5
...
...
@@ -169,6 +169,11 @@ export interface IExtensionService {
*/
getExtensionsStatus
():
{
[
id
:
string
]:
IExtensionsStatus
};
/**
* Check if the extension host can be profiled.
*/
canProfileExtensionHost
():
boolean
;
/**
* Begin an extension host process profile session.
*/
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionProfileService.ts
浏览文件 @
7c4205b5
...
...
@@ -16,6 +16,7 @@ import { StatusbarAlignment, IStatusbarRegistry, StatusbarItemDescriptor, Extens
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IExtensionHostProfileService
,
ProfileSessionState
,
RuntimeExtensionsInput
}
from
'
vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
export
class
ExtensionHostProfileService
extends
Disposable
implements
IExtensionHostProfileService
{
...
...
@@ -38,6 +39,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
,
@
IWorkbenchEditorService
private
readonly
_editorService
:
IWorkbenchEditorService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IMessageService
private
readonly
_messageService
:
IMessageService
)
{
super
();
this
.
_profile
=
null
;
...
...
@@ -67,6 +69,12 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
if
(
this
.
_state
!==
ProfileSessionState
.
None
)
{
return
;
}
if
(
!
this
.
_extensionService
.
canProfileExtensionHost
())
{
this
.
_messageService
.
show
(
Severity
.
Info
,
nls
.
localize
(
'
noPro
'
,
"
To profile extensions, launch with `--inspect-extensions=<port>`.
"
));
return
;
}
this
.
_setState
(
ProfileSessionState
.
Starting
);
this
.
_extensionService
.
startExtensionHostProfile
().
then
((
value
)
=>
{
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
浏览文件 @
7c4205b5
...
...
@@ -275,6 +275,8 @@ export class ExtensionHostProcessWorker {
let
startPort
=
9333
;
if
(
typeof
this
.
_environmentService
.
debugExtensionHost
.
port
===
'
number
'
)
{
startPort
=
expected
=
this
.
_environmentService
.
debugExtensionHost
.
port
;
}
else
{
return
TPromise
.
as
({
expected
:
undefined
,
actual
:
0
});
}
return
new
TPromise
((
c
,
e
)
=>
{
return
findFreePort
(
startPort
,
10
/* try 10 ports */
,
5000
/* try up to 5 seconds */
).
then
(
port
=>
{
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts
浏览文件 @
7c4205b5
...
...
@@ -7,15 +7,8 @@
import
{
IExtensionService
,
IExtensionDescription
,
ProfileSession
,
IExtensionHostProfile
,
ProfileSegmentId
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
realpathSync
}
from
'
vs/base/node/extfs
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IStatusbarService
,
StatusbarAlignment
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
writeFile
}
from
'
vs/base/node/pfs
'
;
import
*
as
path
from
'
path
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
setTimeout
}
from
'
timers
'
;
import
{
Profile
,
ProfileNode
}
from
'
v8-inspect-profiler
'
;
export
class
ExtensionHostProfiler
{
...
...
@@ -128,27 +121,3 @@ export class ExtensionHostProfiler {
};
}
}
CommandsRegistry
.
registerCommand
(
'
exthost.profile.start
'
,
async
accessor
=>
{
const
statusbarService
=
accessor
.
get
(
IStatusbarService
);
const
extensionService
=
accessor
.
get
(
IExtensionService
);
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
handle
=
statusbarService
.
addEntry
({
text
:
localize
(
'
message
'
,
"
$(zap) Profiling Extension Host...
"
)
},
StatusbarAlignment
.
LEFT
);
extensionService
.
startExtensionHostProfile
().
then
(
session
=>
{
setTimeout
(()
=>
{
session
.
stop
().
then
(
result
=>
{
result
.
getAggregatedTimes
().
forEach
((
val
,
index
)
=>
{
console
.
log
(
`
${
index
}
:
${
Math
.
round
(
val
/
1000
)}
ms`
);
});
let
profilePath
=
path
.
join
(
environmentService
.
userHome
,
'
extHostProfile.cpuprofile
'
);
console
.
log
(
`Saving profile at
${
profilePath
}
`
);
return
writeFile
(
profilePath
,
JSON
.
stringify
(
result
.
data
));
}).
then
(()
=>
{
handle
.
dispose
();
});
},
5000
);
});
});
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
7c4205b5
...
...
@@ -337,6 +337,10 @@ export class ExtensionService extends Disposable implements IExtensionService {
return
result
;
}
public
canProfileExtensionHost
():
boolean
{
return
this
.
_extensionHostProcessWorker
&&
Boolean
(
this
.
_extensionHostProcessWorker
.
getInspectPort
());
}
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
if
(
this
.
_extensionHostProcessWorker
)
{
let
port
=
this
.
_extensionHostProcessWorker
.
getInspectPort
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录