Webkit statistics of Android

刺骨的言语ヽ痛彻心扉 2022-01-06 20:04 272阅读 0赞

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

发表评论

表情:
评论列表 (有 0 条评论,272人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Update Statistics

    一、Update Statistics的作用   为了提高数据库的效率,INFORMIX提供了一个基于成本的查询优化器,执行update statistics语句的作用就