Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
8633293b
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8633293b
编写于
9月 11, 2015
作者:
C
Chinmay Garde
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Instrument basic metrics within the compositor
上级
d9cde931
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
116 addition
and
4 deletion
+116
-4
sky/compositor/BUILD.gn
sky/compositor/BUILD.gn
+2
-0
sky/compositor/instrumentation.cc
sky/compositor/instrumentation.cc
+15
-0
sky/compositor/instrumentation.h
sky/compositor/instrumentation.h
+68
-0
sky/compositor/paint_context.cc
sky/compositor/paint_context.cc
+3
-0
sky/compositor/paint_context.h
sky/compositor/paint_context.h
+4
-0
sky/compositor/picture_rasterizer.cc
sky/compositor/picture_rasterizer.cc
+15
-4
sky/compositor/picture_rasterizer.h
sky/compositor/picture_rasterizer.h
+9
-0
未找到文件。
sky/compositor/BUILD.gn
浏览文件 @
8633293b
...
...
@@ -18,6 +18,8 @@ source_set("compositor") {
"compositor_options.h",
"container_layer.cc",
"container_layer.h",
"instrumentation.cc",
"instrumentation.h",
"layer.cc",
"layer.h",
"layer_tree.cc",
...
...
sky/compositor/instrumentation.cc
0 → 100644
浏览文件 @
8633293b
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/compositor/instrumentation.h"
namespace
sky
{
namespace
compositor
{
namespace
instrumentation
{
//
}
// namespace instrumentation
}
// namespace compositor
}
// namespace sky
sky/compositor/instrumentation.h
0 → 100644
浏览文件 @
8633293b
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_COMPOSITOR_INSTRUMENTATION_H_
#define SKY_COMPOSITOR_INSTRUMENTATION_H_
#include "base/macros.h"
#include "base/time/time.h"
namespace
sky
{
namespace
compositor
{
namespace
instrumentation
{
class
Stopwatch
{
public:
class
ScopedLap
{
public:
explicit
ScopedLap
(
Stopwatch
&
stopwatch
)
:
_stopwatch
(
stopwatch
)
{
_stopwatch
.
start
();
}
~
ScopedLap
()
{
_stopwatch
.
stop
();
}
private:
Stopwatch
&
_stopwatch
;
DISALLOW_COPY_AND_ASSIGN
(
ScopedLap
);
};
explicit
Stopwatch
()
:
_start
(
base
::
TimeTicks
::
Now
()),
_lastLap
()
{}
const
base
::
TimeDelta
&
lastLap
()
const
{
return
_lastLap
;
}
base
::
TimeDelta
currentLap
()
const
{
return
base
::
TimeTicks
::
Now
()
-
_start
;
}
void
start
()
{
_start
=
base
::
TimeTicks
::
Now
();
}
void
stop
()
{
_lastLap
=
base
::
TimeTicks
::
Now
()
-
_start
;
}
private:
base
::
TimeTicks
_start
;
base
::
TimeDelta
_lastLap
;
DISALLOW_COPY_AND_ASSIGN
(
Stopwatch
);
};
class
Counter
{
public:
explicit
Counter
()
:
_count
(
0
)
{}
size_t
count
()
const
{
return
_count
;
}
void
reset
(
size_t
count
=
0
)
{
_count
=
count
;
}
void
increment
(
size_t
count
=
1
)
{
_count
+=
count
;
}
private:
size_t
_count
;
DISALLOW_COPY_AND_ASSIGN
(
Counter
);
};
}
// namespace instrumentation
}
// namespace compositor
}
// namespace sky
#endif // SKY_COMPOSITOR_INSTRUMENTATION_H_
sky/compositor/paint_context.cc
浏览文件 @
8633293b
...
...
@@ -12,10 +12,13 @@ PaintContext::PaintContext() {
}
void
PaintContext
::
beginFrame
()
{
frame_count_
.
increment
();
frame_time_
.
start
();
}
void
PaintContext
::
endFrame
()
{
rasterizer_
.
PurgeCache
();
frame_time_
.
stop
();
}
PaintContext
::
ScopedFrame
PaintContext
::
AcquireFrame
(
SkCanvas
&
canvas
,
...
...
sky/compositor/paint_context.h
浏览文件 @
8633293b
...
...
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/logging.h"
#include "sky/compositor/compositor_options.h"
#include "sky/compositor/instrumentation.h"
#include "sky/compositor/picture_rasterizer.h"
namespace
sky
{
...
...
@@ -58,6 +59,9 @@ class PaintContext {
PictureRasterzier
rasterizer_
;
CompositorOptions
options_
;
instrumentation
::
Counter
frame_count_
;
instrumentation
::
Stopwatch
frame_time_
;
void
beginFrame
();
void
endFrame
();
...
...
sky/compositor/picture_rasterizer.cc
浏览文件 @
8633293b
...
...
@@ -38,7 +38,7 @@ PictureRasterzier::Value::Value()
PictureRasterzier
::
Value
::~
Value
()
{
}
static
RefPtr
<
SkImage
>
ImageFromPicture
(
PaintContext
&
context
,
RefPtr
<
SkImage
>
PictureRasterzier
::
ImageFromPicture
(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
)
{
...
...
@@ -94,6 +94,11 @@ static RefPtr<SkImage> ImageFromPicture(PaintContext& context,
RefPtr
<
SkImage
>
image
=
adoptRef
(
SkImage
::
NewFromTexture
(
gr_context
,
backendDesc
,
kPremul_SkAlphaType
,
&
ImageReleaseProc
,
texture
));
if
(
image
)
{
cache_fills_
.
increment
();
}
return
image
;
}
...
...
@@ -123,6 +128,10 @@ RefPtr<SkImage> PictureRasterzier::GetCachedImageIfPresent(
value
.
image
=
ImageFromPicture
(
context
,
gr_context
,
picture
,
size
);
}
if
(
value
.
image
)
{
cache_hits_
.
increment
();
}
return
value
.
image
;
}
...
...
@@ -136,6 +145,8 @@ void PictureRasterzier::PurgeCache() {
}
}
cache_evictions_
.
increment
(
keys_to_purge
.
size
());
for
(
const
auto
&
key
:
keys_to_purge
)
{
cache_
.
erase
(
key
);
}
...
...
sky/compositor/picture_rasterizer.h
浏览文件 @
8633293b
...
...
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkImage.h"
#include "sky/compositor/instrumentation.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefPtr.h"
...
...
@@ -66,6 +67,14 @@ class PictureRasterzier {
using
Cache
=
std
::
unordered_map
<
Key
,
Value
,
KeyHash
,
KeyEqual
>
;
Cache
cache_
;
instrumentation
::
Counter
cache_fills_
;
instrumentation
::
Counter
cache_hits_
;
instrumentation
::
Counter
cache_evictions_
;
RefPtr
<
SkImage
>
ImageFromPicture
(
PaintContext
&
context
,
GrContext
*
gr_context
,
SkPicture
*
picture
,
const
SkISize
&
size
);
DISALLOW_COPY_AND_ASSIGN
(
PictureRasterzier
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录