Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
051ba112
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,发现更多精彩内容 >>
提交
051ba112
编写于
5月 18, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
c6ad876e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
62 deletion
+54
-62
src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts
.../performance/electron-browser/performance.contribution.ts
+54
-62
未找到文件。
src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts
浏览文件 @
051ba112
...
...
@@ -11,7 +11,6 @@ import { Registry } from 'vs/platform/platform';
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
ITimerService
}
from
'
vs/workbench/services/timer/common/timerService
'
;
import
{
IWorkbenchContributionsRegistry
,
IWorkbenchContribution
,
Extensions
}
from
'
vs/workbench/common/contributions
'
;
...
...
@@ -19,63 +18,58 @@ import product from 'vs/platform/node/product';
import
{
platform
,
Platform
}
from
'
vs/base/common/platform
'
;
import
{
release
}
from
'
os
'
;
const
percentiles
:
{
[
key
:
string
]:
[
number
,
number
]
}
=
{
// 80th - 90th percentiles
[
'
Linux_4.10.0-20-generic
'
]:
[
3474
,
6300
],
[
'
Linux_4.10.0-21-generic
'
]:
[
5342
,
12022
],
[
'
Linux_4.10.13-1-ARCH
'
]:
[
3047
,
4248
],
[
'
Linux_4.10.13-200.fc25.x86_64
'
]:
[
2380
,
2895
],
[
'
Linux_4.10.14-200.fc25.x86_64
'
]:
[
5164
,
14042
],
[
'
Linux_4.4.0-21-generic
'
]:
[
3777
,
8160
],
[
'
Linux_4.4.0-72-generic
'
]:
[
6173
,
10730
],
[
'
Linux_4.4.0-75-generic
'
]:
[
4769
,
8560
],
[
'
Linux_4.4.0-77-generic
'
]:
[
3834
,
7343
],
[
'
Linux_4.4.0-78-generic
'
]:
[
3115
,
7078
],
[
'
Linux_4.8.0-49-generic
'
]:
[
7174
,
10362
],
[
'
Linux_4.8.0-51-generic
'
]:
[
3906
,
7385
],
[
'
Linux_4.8.0-52-generic
'
]:
[
6757
,
13741
],
[
'
Linux_4.9.0-2-amd64
'
]:
[
4348
,
8754
],
[
'
Mac_14.5.0
'
]:
[
4403
,
7216
],
[
'
Mac_15.4.0
'
]:
[
3831
,
4946
],
[
'
Mac_15.5.0
'
]:
[
5080
,
8296
],
[
'
Mac_15.6.0
'
]:
[
4621
,
7160
],
[
'
Mac_16.0.0
'
]:
[
4748
,
11248
],
[
'
Mac_16.1.0
'
]:
[
4309
,
6106
],
[
'
Mac_16.3.0
'
]:
[
2756
,
3674
],
[
'
Mac_16.4.0
'
]:
[
3625
,
5463
],
[
'
Mac_16.5.0
'
]:
[
3617
,
5288
],
[
'
Mac_16.6.0
'
]:
[
3655
,
5279
],
[
'
Mac_16.7.0
'
]:
[
4415
,
6624
],
[
'
Windows_10.0.10240
'
]:
[
8284
,
14438
],
[
'
Windows_10.0.10586
'
]:
[
5903
,
9224
],
[
'
Windows_10.0.14393
'
]:
[
6065
,
10567
],
[
'
Windows_10.0.15063
'
]:
[
5521
,
8696
],
[
'
Windows_10.0.16184
'
]:
[
5604
,
10671
],
[
'
Windows_10.0.16188
'
]:
[
7028
,
12852
],
[
'
Windows_10.0.16193
'
]:
[
6431
,
9628
],
[
'
Windows_6.1.7601
'
]:
[
7794
,
15194
],
[
'
Windows_6.3.9600
'
]:
[
6129
,
10188
],
};
const
myPercentiles
=
percentiles
[
`
${
Platform
[
platform
]}
_
${
release
()}
`
];
class
PerformanceContribution
implements
IWorkbenchContribution
{
class
ProfilingHint
implements
IWorkbenchContribution
{
// p80 to p90 by os&release
static
readonly
_percentiles
:
{
[
key
:
string
]:
[
number
,
number
]
}
=
{
[
'
Linux_4.10.0-20-generic
'
]:
[
3474
,
6300
],
[
'
Linux_4.10.0-21-generic
'
]:
[
5342
,
12022
],
[
'
Linux_4.10.13-1-ARCH
'
]:
[
3047
,
4248
],
[
'
Linux_4.10.13-200.fc25.x86_64
'
]:
[
2380
,
2895
],
[
'
Linux_4.10.14-200.fc25.x86_64
'
]:
[
5164
,
14042
],
[
'
Linux_4.4.0-21-generic
'
]:
[
3777
,
8160
],
[
'
Linux_4.4.0-72-generic
'
]:
[
6173
,
10730
],
[
'
Linux_4.4.0-75-generic
'
]:
[
4769
,
8560
],
[
'
Linux_4.4.0-77-generic
'
]:
[
3834
,
7343
],
[
'
Linux_4.4.0-78-generic
'
]:
[
3115
,
7078
],
[
'
Linux_4.8.0-49-generic
'
]:
[
7174
,
10362
],
[
'
Linux_4.8.0-51-generic
'
]:
[
3906
,
7385
],
[
'
Linux_4.8.0-52-generic
'
]:
[
6757
,
13741
],
[
'
Linux_4.9.0-2-amd64
'
]:
[
4348
,
8754
],
[
'
Mac_14.5.0
'
]:
[
4403
,
7216
],
[
'
Mac_15.4.0
'
]:
[
3831
,
4946
],
[
'
Mac_15.5.0
'
]:
[
5080
,
8296
],
[
'
Mac_15.6.0
'
]:
[
4621
,
7160
],
[
'
Mac_16.0.0
'
]:
[
4748
,
11248
],
[
'
Mac_16.1.0
'
]:
[
4309
,
6106
],
[
'
Mac_16.3.0
'
]:
[
2756
,
3674
],
[
'
Mac_16.4.0
'
]:
[
3625
,
5463
],
[
'
Mac_16.5.0
'
]:
[
3617
,
5288
],
[
'
Mac_16.6.0
'
]:
[
3655
,
5279
],
[
'
Mac_16.7.0
'
]:
[
4415
,
6624
],
[
'
Windows_10.0.10240
'
]:
[
8284
,
14438
],
[
'
Windows_10.0.10586
'
]:
[
5903
,
9224
],
[
'
Windows_10.0.14393
'
]:
[
6065
,
10567
],
[
'
Windows_10.0.15063
'
]:
[
5521
,
8696
],
[
'
Windows_10.0.16184
'
]:
[
5604
,
10671
],
[
'
Windows_10.0.16188
'
]:
[
7028
,
12852
],
[
'
Windows_10.0.16193
'
]:
[
6431
,
9628
],
[
'
Windows_6.1.7601
'
]:
[
7794
,
15194
],
[
'
Windows_6.3.9600
'
]:
[
6129
,
10188
],
};
private
static
readonly
_myPercentiles
=
ProfilingHint
.
_percentiles
[
`
${
Platform
[
platform
]}
_
${
release
()}
`
];
constructor
(
@
IWindowsService
private
_windowsService
:
IWindowsService
,
@
ITimerService
private
_timerService
:
ITimerService
,
@
IMessageService
private
_messageService
:
IMessageService
,
@
IEnvironmentService
private
_envService
:
IEnvironmentService
,
@
IStorageService
private
_storageService
:
IStorageService
,
@
IExtensionService
extensionService
:
IExtensionService
,
@
IStorageService
private
_storageService
:
IStorageService
)
{
if
(
!
_envService
.
args
[
'
prof-startup
'
])
{
// notify user of slow start
setTimeout
(()
=>
{
this
.
_checkTimersAndSuggestToProfile
();
},
5000
);
}
setTimeout
(()
=>
this
.
_checkTimersAndSuggestToProfile
(),
5000
);
}
getId
():
string
{
...
...
@@ -84,33 +78,31 @@ class PerformanceContribution implements IWorkbenchContribution {
private
_checkTimersAndSuggestToProfile
()
{
if
(
!
this
.
_timerService
.
isInitialStartup
)
{
// Only initial startups, not when already profiling
if
(
!
this
.
_timerService
.
isInitialStartup
||
this
.
_envService
.
args
[
'
prof-startup
'
])
{
return
;
}
//
1:
Check that we have some data about this
// Check that we have some data about this
// OS version to which we can compare this startup.
// Then only go for startups between the 80th and
// 90th percentile.
if
(
!
Array
.
isArray
(
myPercentiles
))
{
if
(
!
Array
.
isArray
(
ProfilingHint
.
_
myPercentiles
))
{
return
;
}
const
[
from
,
to
]
=
myPercentiles
;
const
[
p80
,
p90
]
=
ProfilingHint
.
_
myPercentiles
;
const
{
ellapsed
}
=
this
.
_timerService
.
startupMetrics
;
if
(
ellapsed
<
from
||
ellapsed
>
to
)
{
if
(
ellapsed
<
p80
||
ellapsed
>
p90
)
{
return
;
}
//
2:
Ignore virtual machines and only ask users
// Ignore virtual machines and only ask users
// to profile with a certain propability
if
(
virtualMachineHint
.
value
()
>=
.
5
)
{
return
;
}
if
(
Math
.
ceil
(
Math
.
random
()
*
50
)
!==
1
)
{
if
(
virtualMachineHint
.
value
()
>=
.
5
||
Math
.
ceil
(
Math
.
random
()
*
50
)
!==
1
)
{
return
;
}
//
3:
Don't ask for the stable version, only
// Don't ask for the stable version, only
// ask once per version/build
if
(
this
.
_envService
.
appQuality
===
'
stable
'
)
{
// don't ask in stable
...
...
@@ -140,4 +132,4 @@ class PerformanceContribution implements IWorkbenchContribution {
}
const
registry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
Extensions
.
Workbench
);
registry
.
registerWorkbenchContribution
(
P
erformanceContribution
);
registry
.
registerWorkbenchContribution
(
P
rofilingHint
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录