Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
fb757bcc
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,发现更多精彩内容 >>
提交
fb757bcc
编写于
11月 02, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add extension host heart beat and log telemetry event when ext host goes dark, #14758
上级
f62a5db2
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
116 addition
and
2 deletion
+116
-2
src/vs/base/common/watchDog.ts
src/vs/base/common/watchDog.ts
+55
-0
src/vs/base/test/common/watchDog.test.ts
src/vs/base/test/common/watchDog.test.ts
+21
-0
src/vs/workbench/electron-browser/extensionHost.ts
src/vs/workbench/electron-browser/extensionHost.ts
+33
-1
src/vs/workbench/node/extensionHostProcess.ts
src/vs/workbench/node/extensionHostProcess.ts
+7
-1
未找到文件。
src/vs/base/common/watchDog.ts
0 → 100644
浏览文件 @
fb757bcc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
export
class
WatchDog
{
private
_timeout
:
number
;
private
_threshold
:
number
;
private
_onAlert
=
new
Emitter
<
this
>
();
private
_handle
:
number
;
private
_missed
:
number
;
private
_lastSignal
:
number
;
constructor
(
timeout
:
number
,
threshold
:
number
)
{
this
.
_timeout
=
timeout
;
this
.
_threshold
=
threshold
;
}
dispose
():
void
{
this
.
stop
();
}
get
onAlert
():
Event
<
this
>
{
return
this
.
_onAlert
.
event
;
}
start
():
void
{
this
.
reset
();
this
.
_handle
=
setInterval
(
this
.
_check
.
bind
(
this
),
this
.
_timeout
*
1.5
);
}
stop
():
void
{
clearInterval
(
this
.
_handle
);
}
reset
():
void
{
this
.
_lastSignal
=
Date
.
now
();
this
.
_missed
=
0
;
}
private
_check
():
void
{
if
((
Date
.
now
()
-
this
.
_lastSignal
)
>
this
.
_timeout
)
{
this
.
_missed
+=
1
;
if
(
this
.
_missed
>
this
.
_threshold
)
{
this
.
_onAlert
.
fire
(
this
);
this
.
_missed
=
0
;
}
}
}
}
src/vs/base/test/common/watchDog.test.ts
0 → 100644
浏览文件 @
fb757bcc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
WatchDog
}
from
'
vs/base/common/watchDog
'
;
suite
(
'
WatchDog
'
,
function
()
{
test
(
'
start/stop
'
,
function
(
done
)
{
const
dog
=
new
WatchDog
(
10
,
1
);
dog
.
onAlert
(
e
=>
{
dog
.
stop
();
assert
.
ok
(
e
===
dog
);
done
();
});
dog
.
start
();
});
});
src/vs/workbench/electron-browser/extensionHost.ts
浏览文件 @
fb757bcc
...
...
@@ -25,6 +25,7 @@ import { ReloadWindowAction } from 'vs/workbench/electron-browser/actions';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
WatchDog
}
from
'
vs/base/common/watchDog
'
;
import
{
createQueuedSender
,
IQueuedSender
}
from
'
vs/base/node/processes
'
;
import
{
IInitData
,
IInitConfiguration
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
MainProcessExtensionService
}
from
'
vs/workbench/api/node/mainThreadExtensionService
'
;
...
...
@@ -55,6 +56,8 @@ export class ExtensionHostProcessWorker {
private
isExtensionDevelopmentTestFromCli
:
boolean
;
private
isExtensionDevelopmentDebugging
:
boolean
;
private
extHostWatchDog
=
new
WatchDog
(
250
,
4
);
private
_onMessage
=
new
Emitter
<
any
>
();
public
get
onMessage
():
Event
<
any
>
{
return
this
.
_onMessage
.
event
;
...
...
@@ -110,6 +113,29 @@ export class ExtensionHostProcessWorker {
// Initialize extension host process with hand shakes
this
.
initializeExtensionHostProcess
=
this
.
doInitializeExtensionHostProcess
(
opts
);
// Check how well the extension host is doing
if
(
this
.
environmentService
.
isBuilt
)
{
this
.
initializeExtensionHostProcess
.
done
(()
=>
{
this
.
extHostWatchDog
.
start
();
this
.
extHostWatchDog
.
onAlert
(()
=>
{
this
.
extHostWatchDog
.
stop
();
// log the identifiers of those extensions that
// have code and are loaded in the extension host
this
.
extensionService
.
getExtensions
().
then
(
extensions
=>
{
const
ids
:
string
[]
=
[];
for
(
const
ext
of
extensions
)
{
if
(
ext
.
main
)
{
ids
.
push
(
ext
.
id
);
}
}
this
.
telemetryService
.
publicLog
(
'
extHostUnresponsive
'
,
ids
);
});
});
});
}
}
public
get
messagingProtocol
():
IMessagePassingProtocol
{
...
...
@@ -191,6 +217,12 @@ export class ExtensionHostProcessWorker {
return
true
;
}
// Heartbeat message
if
(
msg
===
'
__$heartbeat
'
)
{
this
.
extHostWatchDog
.
reset
();
return
false
;
}
// Support logging from extension host
if
(
msg
&&
(
<
ILogEntry
>
msg
).
type
===
'
__$console
'
)
{
this
.
logExtensionHostMessage
(
<
ILogEntry
>
msg
);
...
...
src/vs/workbench/node/extensionHostProcess.ts
浏览文件 @
fb757bcc
...
...
@@ -106,6 +106,12 @@ function connectToRenderer(): TPromise<IRendererConnection> {
stats
.
length
=
0
;
},
1000
);
// Send heartbeat
setInterval
(
function
()
{
queuedSender
.
send
(
'
__$heartbeat
'
);
},
250
);
// Tell the outside that we are initialized
queuedSender
.
send
(
'
initialized
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录