Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
c8e58015
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,发现更多精彩内容 >>
提交
c8e58015
编写于
9月 25, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove profiling hint as it isn't reliable/valuable enough
上级
67626121
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
122 deletion
+0
-122
src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts
.../performance/electron-browser/performance.contribution.ts
+0
-122
未找到文件。
src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts
浏览文件 @
c8e58015
...
...
@@ -5,16 +5,12 @@
'
use strict
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITimerService
}
from
'
vs/workbench/services/timer/common/timerService
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkbenchContributionsRegistry
,
IWorkbenchContribution
,
Extensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ReportPerformanceIssueAction
}
from
'
vs/workbench/electron-browser/actions
'
;
...
...
@@ -22,125 +18,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
join
}
from
'
path
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
toPromise
,
filterEvent
}
from
'
vs/base/common/event
'
;
import
{
platform
,
Platform
}
from
'
vs/base/common/platform
'
;
import
{
readdir
}
from
'
vs/base/node/pfs
'
;
import
{
release
}
from
'
os
'
;
import
{
stopProfiling
}
from
'
vs/base/node/profiler
'
;
import
{
virtualMachineHint
}
from
'
vs/base/node/id
'
;
class
ProfilingHint
implements
IWorkbenchContribution
{
// p95 to p95 by os&release
static
readonly
_percentiles
:
{
[
key
:
string
]:
[
number
,
number
]
}
=
{
[
'
Windows_6.3.9600
'
]:
[
35782
,
35782
],
[
'
Windows_6.1.7601
'
]:
[
11160
,
18366
],
[
'
Windows_10.0.16199
'
]:
[
10423
,
17222
],
[
'
Windows_10.0.16193
'
]:
[
7503
,
11033
],
[
'
Windows_10.0.16188
'
]:
[
8544
,
8807
],
[
'
Windows_10.0.15063
'
]:
[
11085
,
16837
],
[
'
Windows_10.0.14393
'
]:
[
12585
,
32662
],
[
'
Windows_10.0.10586
'
]:
[
7047
,
10944
],
[
'
Windows_10.0.10240
'
]:
[
16176
,
16176
],
[
'
Mac_16.7.0
'
]:
[
2192
,
4050
],
[
'
Mac_16.6.0
'
]:
[
8043
,
10608
],
[
'
Mac_16.5.0
'
]:
[
4912
,
11348
],
[
'
Mac_16.4.0
'
]:
[
3900
,
4200
],
[
'
Mac_16.3.0
'
]:
[
7327
,
7327
],
[
'
Mac_16.1.0
'
]:
[
6090
,
6555
],
[
'
Mac_16.0.0
'
]:
[
32574
,
32574
],
[
'
Mac_15.6.0
'
]:
[
16082
,
17469
],
[
'
Linux_4.9.0-3-amd64
'
]:
[
2092
,
2197
],
[
'
Linux_4.9.0-2-amd64
'
]:
[
9779
,
9779
],
[
'
Linux_4.8.0-52-generic
'
]:
[
12803
,
13257
],
[
'
Linux_4.8.0-51-generic
'
]:
[
2670
,
2797
],
[
'
Linux_4.8.0-040800-generic
'
]:
[
3954
,
3954
],
[
'
Linux_4.4.0-78-generic
'
]:
[
4218
,
5891
],
[
'
Linux_4.4.0-77-generic
'
]:
[
6166
,
6166
],
[
'
Linux_4.11.2
'
]:
[
1323
,
1323
],
[
'
Linux_4.10.15-200.fc25.x86_64
'
]:
[
9270
,
9480
],
[
'
Linux_4.10.13-1-ARCH
'
]:
[
7116
,
8511
],
[
'
Linux_4.10.11-100.fc24.x86_64
'
]:
[
1845
,
1845
],
[
'
Linux_4.10.0-21-generic
'
]:
[
14805
,
16050
],
[
'
Linux_3.19.0-84-generic
'
]:
[
4840
,
4840
],
[
'
Linux_3.11.10-29-desktop
'
]:
[
1637
,
2891
],
};
private
static
readonly
_myPercentiles
=
ProfilingHint
.
_percentiles
[
`
${
Platform
[
platform
]}
_
${
release
()}
`
];
constructor
(
@
IWindowsService
private
readonly
_windowsService
:
IWindowsService
,
@
ITimerService
private
readonly
_timerService
:
ITimerService
,
@
IMessageService
private
readonly
_messageService
:
IMessageService
,
@
IEnvironmentService
private
readonly
_envService
:
IEnvironmentService
,
@
IStorageService
private
readonly
_storageService
:
IStorageService
,
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
,
)
{
setTimeout
(()
=>
this
.
_checkTimersAndSuggestToProfile
(),
5000
);
}
getId
():
string
{
return
'
performance.ProfilingHint
'
;
}
private
_checkTimersAndSuggestToProfile
()
{
// Only initial startups, not when already profiling
if
(
!
this
.
_timerService
.
isInitialStartup
||
this
.
_envService
.
args
[
'
prof-startup
'
])
{
return
;
}
// Check that we have some data about this
// OS version to which we can compare this startup.
// Then only go for startups between the 90 and
// 95th percentile.
if
(
!
Array
.
isArray
(
ProfilingHint
.
_myPercentiles
))
{
return
;
}
const
[
p80
,
p90
]
=
ProfilingHint
.
_myPercentiles
;
const
{
ellapsed
}
=
this
.
_timerService
.
startupMetrics
;
if
(
ellapsed
<
p80
||
ellapsed
>
p90
)
{
return
;
}
// Ignore virtual machines and only ask users
// to profile with a certain propability
if
(
virtualMachineHint
.
value
()
>=
.
5
||
Math
.
ceil
(
Math
.
random
()
*
1000
)
!==
1
)
{
return
;
}
// Don't ask for the stable version, only
// ask once per version/build
if
(
this
.
_envService
.
appQuality
===
'
stable
'
)
{
// don't ask in stable
return
;
}
const
mementoKey
=
`performance.didPromptToProfile.
${
product
.
commit
}
`
;
const
value
=
this
.
_storageService
.
get
(
mementoKey
,
StorageScope
.
GLOBAL
,
undefined
);
if
(
value
!==
undefined
)
{
// only ask once per version
return
;
}
const
profile
=
this
.
_messageService
.
confirm
({
type
:
'
info
'
,
message
:
localize
(
'
slow
'
,
"
Slow startup detected
"
),
detail
:
localize
(
'
slow.detail
'
,
"
Sorry that you just had a slow startup. Please restart '{0}' with profiling enabled, share the profiles with us, and we will work hard to make startup great again.
"
,
this
.
_envService
.
appNameLong
),
primaryButton
:
'
Restart and profile
'
});
this
.
_telemetryService
.
publicLog
(
'
profileStartupInvite
'
,
{
acceptedInvite
:
profile
});
if
(
profile
)
{
this
.
_storageService
.
store
(
mementoKey
,
'
didProfile
'
,
StorageScope
.
GLOBAL
);
this
.
_windowsService
.
relaunch
({
addArgs
:
[
'
--prof-startup
'
]
});
}
else
{
this
.
_storageService
.
store
(
mementoKey
,
'
didReject
'
,
StorageScope
.
GLOBAL
);
}
}
}
class
StartupProfiler
implements
IWorkbenchContribution
{
...
...
@@ -214,5 +93,4 @@ class StartupProfiler implements IWorkbenchContribution {
}
const
registry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
Extensions
.
Workbench
);
registry
.
registerWorkbenchContribution
(
ProfilingHint
);
registry
.
registerWorkbenchContribution
(
StartupProfiler
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录