Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
08d0aa59
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,发现更多精彩内容 >>
提交
08d0aa59
编写于
11月 13, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
store marks and measurements flat, only create objects when needed
上级
0cb6309c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
38 deletion
+43
-38
src/vs/base/common/performance.d.ts
src/vs/base/common/performance.d.ts
+5
-5
src/vs/base/common/performance.js
src/vs/base/common/performance.js
+36
-31
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+2
-2
未找到文件。
src/vs/base/common/performance.d.ts
浏览文件 @
08d0aa59
...
...
@@ -21,9 +21,9 @@ export function time(name: string): { stop(): void };
/**
* All entries filtered by type and sorted by `startTime`.
*/
export
function
getEntries
(
type
?
:
'
mark
'
|
'
measure
'
):
PerformanceEntry
[];
export
function
getEntries
(
type
:
'
mark
'
|
'
measure
'
):
PerformanceEntry
[];
/**
* Import entries
*/
export
function
importEntries
(
entries
:
PerformanceEntry
[]):
void
;
type
ExportData
=
any
[];
export
function
importEntries
(
data
:
ExportData
):
void
;
export
function
exportEntries
():
ExportData
;
src/vs/base/common/performance.js
浏览文件 @
08d0aa59
...
...
@@ -10,6 +10,7 @@
// This module can be loaded in an amd and commonjs-context.
// Because we want both instances to use the same perf-data
// we store them globally
// stores data as 'type','name','startTime','duration'
global
.
_performanceEntries
=
global
.
_performanceEntries
||
[];
if
(
typeof
define
!==
"
function
"
&&
typeof
module
===
"
object
"
&&
typeof
module
.
exports
===
"
object
"
)
{
...
...
@@ -25,42 +26,35 @@ define([], function () {
// const _now = global.performance && performance.now ? performance.now : Date.now
const
_now
=
Date
.
now
;
class
PerformanceEntry
{
constructor
(
type
,
name
,
startTime
,
duration
)
{
this
.
type
=
type
;
this
.
name
=
name
;
this
.
startTime
=
startTime
;
this
.
duration
=
duration
;
}
function
importEntries
(
entries
)
{
global
.
_performanceEntries
.
splice
(
0
,
0
,
...
entries
);
}
function
_getEntry
(
type
,
name
)
{
for
(
let
i
=
global
.
_performanceEntries
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
(
type
===
undefined
||
global
.
_performanceEntries
[
i
].
type
===
type
)
&&
(
name
===
undefined
||
global
.
_performanceEntries
[
i
].
name
===
name
)
)
{
return
global
.
_performanceEntries
[
i
];
}
}
function
exportEntries
()
{
return
global
.
_performanceEntries
.
splice
(
0
);
}
function
importEntries
(
entries
)
{
global
.
_performanceEntries
.
splice
(
0
,
0
,
...
entries
);
}
function
getEntries
(
type
)
{
const
result
=
[];
const
entries
=
global
.
_performanceEntries
;
for
(
let
i
=
0
;
i
<
entries
.
length
;
i
+=
4
)
{
if
(
entries
[
i
]
===
type
)
{
result
.
push
({
type
:
entries
[
i
],
name
:
entries
[
i
+
1
],
startTime
:
entries
[
i
+
2
],
duration
:
entries
[
i
+
3
],
});
}
}
function
getEntries
(
type
,
name
)
{
return
global
.
_performanceEntries
.
filter
(
entry
=>
{
return
(
type
===
undefined
||
entry
.
type
===
type
)
&&
(
name
===
undefined
||
entry
.
name
===
name
);
}).
sort
((
a
,
b
)
=>
{
return
result
.
sort
((
a
,
b
)
=>
{
return
a
.
startTime
-
b
.
startTime
;
});
}
function
mark
(
name
)
{
const
entry
=
new
PerformanceEntry
(
'
mark
'
,
name
,
_now
(),
0
);
global
.
_performanceEntries
.
push
(
entry
);
global
.
_performanceEntries
.
push
(
'
mark
'
,
name
,
_now
(),
0
);
if
(
typeof
console
.
timeStamp
===
'
function
'
)
{
console
.
timeStamp
(
name
);
}
...
...
@@ -81,17 +75,27 @@ define([], function () {
if
(
!
from
)
{
startTime
=
now
;
}
else
{
startTime
=
_get
Entry
(
undefined
,
from
).
startTime
;
startTime
=
_get
LastStartTime
(
from
)
;
}
if
(
!
to
)
{
duration
=
now
-
startTime
;
}
else
{
duration
=
_getEntry
(
undefined
,
to
).
startTime
-
startTime
;
duration
=
_getLastStartTime
(
to
)
-
startTime
;
}
global
.
_performanceEntries
.
push
(
'
measure
'
,
name
,
startTime
,
duration
);
}
function
_getLastStartTime
(
name
)
{
const
entries
=
global
.
_performanceEntries
;
for
(
let
i
=
entries
.
length
-
1
;
i
>=
0
;
i
-=
4
)
{
if
(
entries
[
i
-
2
]
===
name
)
{
return
entries
[
i
-
1
];
}
}
const
entry
=
new
PerformanceEntry
(
'
measure
'
,
name
,
startTime
,
duration
);
global
.
_performanceEntries
.
push
(
entry
);
throw
new
Error
(
name
+
'
not found
'
);
}
var
exports
=
{
...
...
@@ -99,7 +103,8 @@ define([], function () {
measure
:
measure
,
time
:
time
,
getEntries
:
getEntries
,
importEntries
:
importEntries
importEntries
:
importEntries
,
exportEntries
:
exportEntries
};
return
exports
;
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
08d0aa59
...
...
@@ -26,7 +26,7 @@ import { ICodeWindow } from 'vs/platform/windows/electron-main/windows';
import
{
IWorkspaceIdentifier
,
IWorkspacesMainService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IBackupMainService
}
from
'
vs/platform/backup/common/backup
'
;
import
{
ICommandAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
mark
,
ge
tEntries
}
from
'
vs/base/common/performance
'
;
import
{
mark
,
expor
tEntries
}
from
'
vs/base/common/performance
'
;
export
interface
IWindowState
{
width
?:
number
;
...
...
@@ -580,7 +580,7 @@ export class CodeWindow implements ICodeWindow {
windowConfiguration
.
backgroundColor
=
this
.
getBackgroundColor
();
// Perf Counters
windowConfiguration
.
perfEntries
=
ge
tEntries
();
windowConfiguration
.
perfEntries
=
expor
tEntries
();
windowConfiguration
.
perfStartTime
=
global
.
perfStartTime
;
windowConfiguration
.
perfAppReady
=
global
.
perfAppReady
;
windowConfiguration
.
perfWindowLoadTime
=
Date
.
now
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录