Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
8708c716
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,发现更多精彩内容 >>
提交
8708c716
编写于
1月 25, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #42144
上级
be07c3cc
变更
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
浏览文件 @
8708c716
...
@@ -48,6 +48,10 @@ class MockExtensionService implements IExtensionService {
...
@@ -48,6 +48,10 @@ class MockExtensionService implements IExtensionService {
throw
new
Error
(
'
Not implemented
'
);
throw
new
Error
(
'
Not implemented
'
);
}
}
public
canProfileExtensionHost
()
{
return
false
;
}
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
throw
new
Error
(
'
Not implemented
'
);
throw
new
Error
(
'
Not implemented
'
);
}
}
...
...
src/vs/platform/commands/test/commandService.test.ts
浏览文件 @
8708c716
...
@@ -40,6 +40,9 @@ class SimpleExtensionService implements IExtensionService {
...
@@ -40,6 +40,9 @@ class SimpleExtensionService implements IExtensionService {
getExtensions
():
TPromise
<
IExtensionDescription
[]
>
{
getExtensions
():
TPromise
<
IExtensionDescription
[]
>
{
return
TPromise
.
wrap
([]);
return
TPromise
.
wrap
([]);
}
}
canProfileExtensionHost
()
{
return
false
;
}
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
throw
new
Error
(
'
Not implemented
'
);
throw
new
Error
(
'
Not implemented
'
);
}
}
...
...
src/vs/platform/extensions/common/extensions.ts
浏览文件 @
8708c716
...
@@ -168,6 +168,11 @@ export interface IExtensionService {
...
@@ -168,6 +168,11 @@ export interface IExtensionService {
*/
*/
getExtensionsStatus
():
{
[
id
:
string
]:
IExtensionsStatus
};
getExtensionsStatus
():
{
[
id
:
string
]:
IExtensionsStatus
};
/**
* Check if the extension host can be profiled.
*/
canProfileExtensionHost
():
boolean
;
/**
/**
* Begin an extension host process profile session.
* Begin an extension host process profile session.
*/
*/
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionProfileService.ts
浏览文件 @
8708c716
...
@@ -16,6 +16,7 @@ import { StatusbarAlignment, IStatusbarRegistry, StatusbarItemDescriptor, Extens
...
@@ -16,6 +16,7 @@ import { StatusbarAlignment, IStatusbarRegistry, StatusbarItemDescriptor, Extens
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IExtensionHostProfileService
,
ProfileSessionState
,
RuntimeExtensionsInput
}
from
'
vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor
'
;
import
{
IExtensionHostProfileService
,
ProfileSessionState
,
RuntimeExtensionsInput
}
from
'
vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
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
{
export
class
ExtensionHostProfileService
extends
Disposable
implements
IExtensionHostProfileService
{
...
@@ -38,6 +39,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
...
@@ -38,6 +39,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
,
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
,
@
IWorkbenchEditorService
private
readonly
_editorService
:
IWorkbenchEditorService
,
@
IWorkbenchEditorService
private
readonly
_editorService
:
IWorkbenchEditorService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IMessageService
private
readonly
_messageService
:
IMessageService
)
{
)
{
super
();
super
();
this
.
_profile
=
null
;
this
.
_profile
=
null
;
...
@@ -67,6 +69,12 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
...
@@ -67,6 +69,12 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
if
(
this
.
_state
!==
ProfileSessionState
.
None
)
{
if
(
this
.
_state
!==
ProfileSessionState
.
None
)
{
return
;
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
.
_setState
(
ProfileSessionState
.
Starting
);
this
.
_extensionService
.
startExtensionHostProfile
().
then
((
value
)
=>
{
this
.
_extensionService
.
startExtensionHostProfile
().
then
((
value
)
=>
{
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
浏览文件 @
8708c716
...
@@ -276,6 +276,8 @@ export class ExtensionHostProcessWorker {
...
@@ -276,6 +276,8 @@ export class ExtensionHostProcessWorker {
let
startPort
=
9333
;
let
startPort
=
9333
;
if
(
typeof
this
.
_environmentService
.
debugExtensionHost
.
port
===
'
number
'
)
{
if
(
typeof
this
.
_environmentService
.
debugExtensionHost
.
port
===
'
number
'
)
{
startPort
=
expected
=
this
.
_environmentService
.
debugExtensionHost
.
port
;
startPort
=
expected
=
this
.
_environmentService
.
debugExtensionHost
.
port
;
}
else
{
return
TPromise
.
as
({
expected
:
undefined
,
actual
:
0
});
}
}
return
new
TPromise
((
c
,
e
)
=>
{
return
new
TPromise
((
c
,
e
)
=>
{
return
findFreePort
(
startPort
,
10
/* try 10 ports */
,
5000
/* try up to 5 seconds */
).
then
(
port
=>
{
return
findFreePort
(
startPort
,
10
/* try 10 ports */
,
5000
/* try up to 5 seconds */
).
then
(
port
=>
{
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts
浏览文件 @
8708c716
...
@@ -7,15 +7,8 @@
...
@@ -7,15 +7,8 @@
import
{
IExtensionService
,
IExtensionDescription
,
ProfileSession
,
IExtensionHostProfile
,
ProfileSegmentId
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtensionService
,
IExtensionDescription
,
ProfileSession
,
IExtensionHostProfile
,
ProfileSegmentId
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
realpathSync
}
from
'
vs/base/node/extfs
'
;
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
'
;
import
{
Profile
,
ProfileNode
}
from
'
v8-inspect-profiler
'
;
export
class
ExtensionHostProfiler
{
export
class
ExtensionHostProfiler
{
...
@@ -128,27 +121,3 @@ 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
浏览文件 @
8708c716
...
@@ -370,6 +370,10 @@ export class ExtensionService extends Disposable implements IExtensionService {
...
@@ -370,6 +370,10 @@ export class ExtensionService extends Disposable implements IExtensionService {
return
result
;
return
result
;
}
}
public
canProfileExtensionHost
():
boolean
{
return
this
.
_extensionHostProcessWorker
&&
Boolean
(
this
.
_extensionHostProcessWorker
.
getInspectPort
());
}
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
public
startExtensionHostProfile
():
TPromise
<
ProfileSession
>
{
if
(
this
.
_extensionHostProcessWorker
)
{
if
(
this
.
_extensionHostProcessWorker
)
{
let
port
=
this
.
_extensionHostProcessWorker
.
getInspectPort
();
let
port
=
this
.
_extensionHostProcessWorker
.
getInspectPort
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录