博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Webkit statistics of Android
阅读量:6884 次
发布时间:2019-06-27

本文共 3020 字,大约阅读时间需要 10 分钟。

Introduction

1.Statistics Macro

 "ANDROID_INSTRUMENT"

2.Classes for statistics

a.TimeCounter

b.TimeCounterAuto

3. method for statistics

a. counting the time used for a single function.
b. counting the total time used by a kind of Timer.
TimerCounter
1.TimerCounter type.
One counter type stands for one type of operation.
    "css parsing", 
    "javascript",
    "javascript init",
    "javascript parsing",
    "javascript execution",
    "calculate style", 
    "Java callback (frame bridge)",
    "parsing (may include calcStyle, Java callback or inline script execution)",
    "layout", 
    "native 1 (frame bridge)",
    "native 2 (resource load)", 
    "native 3 (shared timer)", 
    "build nav (webview core)",
    "record content (webview core)",
    "native 4 (webview core)",
    "draw content (webview ui)",
    enum Type {
        // function base counters
        CSSParseTimeCounter,
        JavaScriptTimeCounter,
        JavaScriptInitTimeCounter,
        JavaScriptParseTimeCounter,
        JavaScriptExecuteTimeCounter,
        CalculateStyleTimeCounter,
        JavaCallbackTimeCounter,
        ParsingTimeCounter,
        LayoutTimeCounter,
        // file base counters
        NativeCallbackTimeCounter,  // WebCoreFrameBridge.cpp
        ResourceTimeCounter,        // WebCoreResourceLoader.cpp
        SharedTimerTimeCounter,     // JavaBridge.cpp
        WebViewCoreBuildNavTimeCounter,
        WebViewCoreRecordTimeCounter,
        WebViewCoreTimeCounter,     // WebViewCore.cpp
        WebViewUIDrawTimeCounter,
        TotalTimeCounterCount
    };
2.Array for holding the variables
uint32_t TimeCounter::sTotalTimeUsed[TimeCounter::TotalTimeCounterCount];
//the total time used for the kind of operation.
uint32_t TimeCounter::sLastTimeUsed[TimeCounter::TotalTimeCounterCount];
uint32_t TimeCounter::sCounter[TimeCounter::TotalTimeCounterCount];
//the total times of the kind of operation.
uint32_t TimeCounter::sLastCounter[TimeCounter::TotalTimeCounterCount];
uint32_t TimeCounter::sStartTime[TimeCounter::TotalTimeCounterCount];
3.function of the TimerCounter
a.void TimeCounter::start(enum Type type)
record the current time and store it in the "sStartTime" array.
b.void TimeCounter::record(enum Type type, const char* functionName)
calculate the elapsed time after start, and print it if the elapsed time is more than 1000ms
c.void TimeCounter::report(const KURL& url, int live, int dead, size_t arenaSize)
out put all the result of the statistics.
d.void TimeCounter::reportNow()
compare the current with the last.
4.usage
a.TimeCounter::start() at the start of the function
b.TimeCounter::record() at the end of the function.
TimeCounterAuto
1.variable
it has a membership "uint32_t m_startTime", as it was created, the current time is stored in the variable.
2.function 
a.TimeCounterAuto()
constructure function, store the current time in the "m_startTime".
b.~TimeCounterAuto()
get the elapsed time with the current time and "m_startTime" and record it the 
"sTotalTimeUsed" and "sCounter" as "TimeCounter" does.
3.usage
a.construct a local object of "TimeCounterAuto" at the beginning of the function.
b.the destructure function will be called automaticlly.

转载于:https://www.cnblogs.com/elfylin/archive/2012/05/30/2527159.html

你可能感兴趣的文章
R.java檔重建
查看>>
Java注解Annotation详解
查看>>
ejb事务
查看>>
node环境搭建
查看>>
Speed ScrollView
查看>>
BJImageCropper
查看>>
android handler总结
查看>>
2. ASIHttpRequest-发送数据
查看>>
[应用模板]移动应用界面
查看>>
嵌入式Linux C编程 02
查看>>
sql server支持连接管理功能
查看>>
java的强制类型转换想到的
查看>>
简要介绍cookie与session的区别与联系
查看>>
mysql flush用法
查看>>
response.setHeader()的用法
查看>>
一位前辈的经验,给正在思考的自己
查看>>
分享一篇关于lucene原理的文章
查看>>
基于 HTML5 结合互联网+ 的 3D 隧道
查看>>
Win10下 80端口被system(pid=4)占用的解决方法
查看>>
使用SubVersion+TortoiseSVN多仓库方式进行版本控制
查看>>