Commit 7e4e34bb authored by cbruni's avatar cbruni Committed by Commit bot

[counters] Use separate counters for background parsing

BUG=

Review-Url: https://codereview.chromium.org/2509683002
Cr-Commit-Position: refs/heads/master@{#41047}
parent d3231f51
...@@ -728,11 +728,16 @@ class RuntimeCallTimer { ...@@ -728,11 +728,16 @@ class RuntimeCallTimer {
V(Object_DeleteProperty) \ V(Object_DeleteProperty) \
V(OptimizeCode) \ V(OptimizeCode) \
V(ParseArrowFunctionLiteral) \ V(ParseArrowFunctionLiteral) \
V(ParseBackgroundArrowFunctionLiteral) \
V(ParseBackgroundFunctionLiteral) \
V(ParseEval) \ V(ParseEval) \
V(ParseFunction) \ V(ParseFunction) \
V(ParseFunctionLiteral) \ V(ParseFunctionLiteral) \
V(ParseProgram) \ V(ParseProgram) \
V(PreParseArrowFunctionLiteral) \ V(PreParseArrowFunctionLiteral) \
V(PreParseBackgroundArrowFunctionLiteral) \
V(PreParseBackgroundNoVariableResolution) \
V(PreParseBackgroundWithVariableResolution) \
V(PreParseNoVariableResolution) \ V(PreParseNoVariableResolution) \
V(PreParseWithVariableResolution) \ V(PreParseWithVariableResolution) \
V(PropertyCallback) \ V(PropertyCallback) \
......
...@@ -192,7 +192,8 @@ class ParserBase { ...@@ -192,7 +192,8 @@ class ParserBase {
ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit, ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
v8::Extension* extension, AstValueFactory* ast_value_factory, v8::Extension* extension, AstValueFactory* ast_value_factory,
RuntimeCallStats* runtime_call_stats) RuntimeCallStats* runtime_call_stats,
bool parsing_on_main_thread = true)
: scope_state_(nullptr), : scope_state_(nullptr),
function_state_(nullptr), function_state_(nullptr),
extension_(extension), extension_(extension),
...@@ -200,6 +201,7 @@ class ParserBase { ...@@ -200,6 +201,7 @@ class ParserBase {
ast_value_factory_(ast_value_factory), ast_value_factory_(ast_value_factory),
ast_node_factory_(ast_value_factory), ast_node_factory_(ast_value_factory),
runtime_call_stats_(runtime_call_stats), runtime_call_stats_(runtime_call_stats),
parsing_on_main_thread_(parsing_on_main_thread),
parsing_module_(false), parsing_module_(false),
stack_limit_(stack_limit), stack_limit_(stack_limit),
zone_(zone), zone_(zone),
...@@ -1421,6 +1423,7 @@ class ParserBase { ...@@ -1421,6 +1423,7 @@ class ParserBase {
AstValueFactory* ast_value_factory_; // Not owned. AstValueFactory* ast_value_factory_; // Not owned.
typename Types::Factory ast_node_factory_; typename Types::Factory ast_node_factory_;
RuntimeCallStats* runtime_call_stats_; RuntimeCallStats* runtime_call_stats_;
bool parsing_on_main_thread_;
bool parsing_module_; bool parsing_module_;
uintptr_t stack_limit_; uintptr_t stack_limit_;
...@@ -3887,10 +3890,14 @@ template <typename Impl> ...@@ -3887,10 +3890,14 @@ template <typename Impl>
typename ParserBase<Impl>::ExpressionT typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseArrowFunctionLiteral( ParserBase<Impl>::ParseArrowFunctionLiteral(
bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) {
const RuntimeCallStats::CounterId counters[2][2] = {
{&RuntimeCallStats::ParseArrowFunctionLiteral,
&RuntimeCallStats::ParseBackgroundArrowFunctionLiteral},
{&RuntimeCallStats::PreParseArrowFunctionLiteral,
&RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral}};
RuntimeCallTimerScope runtime_timer( RuntimeCallTimerScope runtime_timer(
runtime_call_stats_, runtime_call_stats_,
Impl::IsPreParser() ? &RuntimeCallStats::ParseArrowFunctionLiteral counters[Impl::IsPreParser()][parsing_on_main_thread_]);
: &RuntimeCallStats::PreParseArrowFunctionLiteral);
if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) {
// ASI inserts `;` after arrow parameters if a line terminator is found. // ASI inserts `;` after arrow parameters if a line terminator is found.
......
...@@ -582,7 +582,8 @@ Expression* Parser::NewV8Intrinsic(const AstRawString* name, ...@@ -582,7 +582,8 @@ Expression* Parser::NewV8Intrinsic(const AstRawString* name,
Parser::Parser(ParseInfo* info) Parser::Parser(ParseInfo* info)
: ParserBase<Parser>(info->zone(), &scanner_, info->stack_limit(), : ParserBase<Parser>(info->zone(), &scanner_, info->stack_limit(),
info->extension(), info->ast_value_factory(), info->extension(), info->ast_value_factory(),
info->isolate()->counters()->runtime_call_stats()), info->isolate()->counters()->runtime_call_stats(),
true),
scanner_(info->unicode_cache()), scanner_(info->unicode_cache()),
reusable_preparser_(nullptr), reusable_preparser_(nullptr),
original_scope_(nullptr), original_scope_(nullptr),
...@@ -591,7 +592,6 @@ Parser::Parser(ParseInfo* info) ...@@ -591,7 +592,6 @@ Parser::Parser(ParseInfo* info)
compile_options_(info->compile_options()), compile_options_(info->compile_options()),
cached_parse_data_(nullptr), cached_parse_data_(nullptr),
total_preparse_skipped_(0), total_preparse_skipped_(0),
parsing_on_main_thread_(true),
log_(nullptr) { log_(nullptr) {
// Even though we were passed ParseInfo, we should not store it in // Even though we were passed ParseInfo, we should not store it in
// Parser - this makes sure that Isolate is not accidentally accessed via // Parser - this makes sure that Isolate is not accidentally accessed via
...@@ -664,7 +664,6 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { ...@@ -664,7 +664,6 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) {
// It's OK to use the Isolate & counters here, since this function is only // It's OK to use the Isolate & counters here, since this function is only
// called in the main thread. // called in the main thread.
DCHECK(parsing_on_main_thread_); DCHECK(parsing_on_main_thread_);
RuntimeCallTimerScope runtime_timer( RuntimeCallTimerScope runtime_timer(
runtime_call_stats_, info->is_eval() ? &RuntimeCallStats::ParseEval runtime_call_stats_, info->is_eval() ? &RuntimeCallStats::ParseEval
: &RuntimeCallStats::ParseProgram); : &RuntimeCallStats::ParseProgram);
...@@ -2577,8 +2576,11 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ...@@ -2577,8 +2576,11 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
bool is_lazy_top_level_function = bool is_lazy_top_level_function =
can_preparse && impl()->AllowsLazyParsingWithoutUnresolvedVariables(); can_preparse && impl()->AllowsLazyParsingWithoutUnresolvedVariables();
RuntimeCallTimerScope runtime_timer(runtime_call_stats_, RuntimeCallTimerScope runtime_timer(
&RuntimeCallStats::ParseFunctionLiteral); runtime_call_stats_,
parsing_on_main_thread_
? &RuntimeCallStats::ParseFunctionLiteral
: &RuntimeCallStats::ParseBackgroundFunctionLiteral);
// Determine whether we can still lazy parse the inner function. // Determine whether we can still lazy parse the inner function.
// The preconditions are: // The preconditions are:
...@@ -2787,9 +2789,9 @@ Parser::LazyParsingResult Parser::SkipFunction( ...@@ -2787,9 +2789,9 @@ Parser::LazyParsingResult Parser::SkipFunction(
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse");
if (reusable_preparser_ == NULL) { if (reusable_preparser_ == NULL) {
reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), reusable_preparser_ = new PreParser(
&pending_error_handler_, zone(), &scanner_, stack_limit_, ast_value_factory(),
runtime_call_stats_, stack_limit_); &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_);
#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
SET_ALLOW(natives); SET_ALLOW(natives);
SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_do_expressions);
......
...@@ -1145,7 +1145,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -1145,7 +1145,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// parsing. // parsing.
int use_counts_[v8::Isolate::kUseCounterFeatureCount]; int use_counts_[v8::Isolate::kUseCounterFeatureCount];
int total_preparse_skipped_; int total_preparse_skipped_;
bool parsing_on_main_thread_;
bool allow_lazy_; bool allow_lazy_;
ParserLogger* log_; ParserLogger* log_;
}; };
......
...@@ -179,11 +179,14 @@ PreParser::Expression PreParser::ParseFunctionLiteral( ...@@ -179,11 +179,14 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
LanguageMode language_mode, bool* ok) { LanguageMode language_mode, bool* ok) {
// Function :: // Function ::
// '(' FormalParameterList? ')' '{' FunctionBody '}' // '(' FormalParameterList? ')' '{' FunctionBody '}'
const RuntimeCallStats::CounterId counters[2][2] = {
{&RuntimeCallStats::PreParseWithVariableResolution,
&RuntimeCallStats::PreParseBackgroundWithVariableResolution},
{&RuntimeCallStats::PreParseNoVariableResolution,
&RuntimeCallStats::PreParseBackgroundNoVariableResolution}};
RuntimeCallTimerScope runtime_timer( RuntimeCallTimerScope runtime_timer(
runtime_call_stats_, runtime_call_stats_,
track_unresolved_variables_ counters[track_unresolved_variables_][parsing_on_main_thread_]);
? &RuntimeCallStats::PreParseWithVariableResolution
: &RuntimeCallStats::PreParseNoVariableResolution);
// Parse function body. // Parse function body.
PreParserStatementList body; PreParserStatementList body;
......
...@@ -838,11 +838,14 @@ class PreParser : public ParserBase<PreParser> { ...@@ -838,11 +838,14 @@ class PreParser : public ParserBase<PreParser> {
kPreParseSuccess kPreParseSuccess
}; };
PreParser(Zone* zone, Scanner* scanner, AstValueFactory* ast_value_factory, PreParser(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
AstValueFactory* ast_value_factory,
PendingCompilationErrorHandler* pending_error_handler, PendingCompilationErrorHandler* pending_error_handler,
RuntimeCallStats* runtime_call_stats, uintptr_t stack_limit) RuntimeCallStats* runtime_call_stats,
bool parsing_on_main_thread = true)
: ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr,
ast_value_factory, runtime_call_stats), ast_value_factory, runtime_call_stats,
parsing_on_main_thread),
use_counts_(nullptr), use_counts_(nullptr),
track_unresolved_variables_(false), track_unresolved_variables_(false),
pending_error_handler_(pending_error_handler) {} pending_error_handler_(pending_error_handler) {}
......
...@@ -175,8 +175,9 @@ TEST(ScanHTMLEndComments) { ...@@ -175,8 +175,9 @@ TEST(ScanHTMLEndComments) {
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser( i::PreParser preparser(
&zone, &scanner, &ast_value_factory, &pending_error_handler, &zone, &scanner, stack_limit, &ast_value_factory,
CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); &pending_error_handler,
CcTest::i_isolate()->counters()->runtime_call_stats());
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK(!pending_error_handler.has_pending_error()); CHECK(!pending_error_handler.has_pending_error());
...@@ -192,8 +193,9 @@ TEST(ScanHTMLEndComments) { ...@@ -192,8 +193,9 @@ TEST(ScanHTMLEndComments) {
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser( i::PreParser preparser(
&zone, &scanner, &ast_value_factory, &pending_error_handler, &zone, &scanner, stack_limit, &ast_value_factory,
CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); &pending_error_handler,
CcTest::i_isolate()->counters()->runtime_call_stats());
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned. // Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
...@@ -366,8 +368,9 @@ TEST(StandAlonePreParser) { ...@@ -366,8 +368,9 @@ TEST(StandAlonePreParser) {
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser( i::PreParser preparser(
&zone, &scanner, &ast_value_factory, &pending_error_handler, &zone, &scanner, stack_limit, &ast_value_factory,
CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); &pending_error_handler,
CcTest::i_isolate()->counters()->runtime_call_stats());
preparser.set_allow_natives(true); preparser.set_allow_natives(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
...@@ -400,9 +403,9 @@ TEST(StandAlonePreParserNoNatives) { ...@@ -400,9 +403,9 @@ TEST(StandAlonePreParserNoNatives) {
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser( i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&zone, &scanner, &ast_value_factory, &pending_error_handler, &pending_error_handler,
isolate->counters()->runtime_call_stats(), stack_limit); isolate->counters()->runtime_call_stats());
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK(pending_error_handler.has_pending_error()); CHECK(pending_error_handler.has_pending_error());
...@@ -467,10 +470,10 @@ TEST(RegressChromium62639) { ...@@ -467,10 +470,10 @@ TEST(RegressChromium62639) {
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, &ast_value_factory, i::PreParser preparser(&zone, &scanner,
&pending_error_handler, CcTest::i_isolate()->stack_guard()->real_climit(),
isolate->counters()->runtime_call_stats(), &ast_value_factory, &pending_error_handler,
CcTest::i_isolate()->stack_guard()->real_climit()); isolate->counters()->runtime_call_stats());
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned. // Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
...@@ -543,9 +546,9 @@ TEST(PreParseOverflow) { ...@@ -543,9 +546,9 @@ TEST(PreParseOverflow) {
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
i::PendingCompilationErrorHandler pending_error_handler; i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser( i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&zone, &scanner, &ast_value_factory, &pending_error_handler, &pending_error_handler,
isolate->counters()->runtime_call_stats(), stack_limit); isolate->counters()->runtime_call_stats());
i::PreParser::PreParseResult result = preparser.PreParseProgram(); i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseStackOverflow, result); CHECK_EQ(i::PreParser::kPreParseStackOverflow, result);
} }
...@@ -1327,9 +1330,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, ...@@ -1327,9 +1330,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser( i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&zone, &scanner, &ast_value_factory, &pending_error_handler, &pending_error_handler,
isolate->counters()->runtime_call_stats(), stack_limit); isolate->counters()->runtime_call_stats());
SetParserFlags(&preparser, flags); SetParserFlags(&preparser, flags);
scanner.Initialize(stream.get()); scanner.Initialize(stream.get());
i::PreParser::PreParseResult result = i::PreParser::PreParseResult result =
......
...@@ -1365,6 +1365,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -1365,6 +1365,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
Group.groups.get('ic').entry(), Group.groups.get('ic').entry(),
Group.groups.get('optimize').entry(), Group.groups.get('optimize').entry(),
Group.groups.get('compile').entry(), Group.groups.get('compile').entry(),
Group.groups.get('parse-background').entry(),
Group.groups.get('parse').entry(), Group.groups.get('parse').entry(),
Group.groups.get('callback').entry(), Group.groups.get('callback').entry(),
Group.groups.get('api').entry(), Group.groups.get('api').entry(),
...@@ -1554,19 +1555,24 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -1554,19 +1555,24 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
Group.groups = new Map(); Group.groups = new Map();
Group.add = function(name, group) { Group.add = function(name, group) {
this.groups.set(name, group); this.groups.set(name, group);
return group;
} }
Group.add('total', new Group('Total', /.*Total.*/, '#BBB')); Group.add('total', new Group('Total', /.*Total.*/, '#BBB'));
Group.add('ic', new Group('IC', /.*IC.*/, "#3366CC")); Group.add('ic', new Group('IC', /.*IC.*/, "#3366CC"));
Group.add('optimize', new Group('Optimize', Group.add('optimize', new Group('Optimize',
/StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*/, "#DC3912")); /StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*/, "#DC3912"));
Group.add('compile', new Group('Compile', /.*Compile.*/, "#FFAA00")); Group.add('compile', new Group('Compile', /.*Compile.*/, "#FFAA00"));
Group.add('parse-background',
new Group('Parse-Background', /.*ParseBackground.*/, "#af744d"));
Group.add('parse', new Group('Parse', /.*Parse.*/, "#FF6600")); Group.add('parse', new Group('Parse', /.*Parse.*/, "#FF6600"));
Group.add('callback', new Group('Callback', /.*Callback.*/, "#109618")); Group.add('callback', new Group('Callback', /.*Callback.*/, "#109618"));
Group.add('api', new Group('API', /.*API.*/, "#990099")); Group.add('api', new Group('API', /.*API.*/, "#990099"));
Group.add('gc', new Group('GC', /GC|AllocateInTargetSpace/, "#0099C6")); Group.add('gc', new Group('GC', /GC|AllocateInTargetSpace/, "#0099C6"));
Group.add('javascript', new Group('JavaScript', /JS_Execution/, "#DD4477")); Group.add('javascript', new Group('JavaScript', /JS_Execution/, "#DD4477"));
Group.add('runtime', new Group('Runtime', /.*/, "#88BB00")); Group.add('runtime', new Group('Runtime', /.*/, "#88BB00"));
var group =
Group.add('unclassified', new Group('Unclassified', /.*/, "#000")); Group.add('unclassified', new Group('Unclassified', /.*/, "#000"));
group.enabled = false;
class GroupedEntry extends Entry { class GroupedEntry extends Entry {
constructor(group) { constructor(group) {
......
...@@ -347,6 +347,7 @@ def read_stats(path, domain, args): ...@@ -347,6 +347,7 @@ def read_stats(path, domain, args):
('Group-Optimize', ('Group-Optimize',
re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")), re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")),
('Group-Compile', re.compile(".*Compile.*")), ('Group-Compile', re.compile(".*Compile.*")),
('Group-ParseBackground', re.compile(".*ParseBackground.*")),
('Group-Parse', re.compile(".*Parse.*")), ('Group-Parse', re.compile(".*Parse.*")),
('Group-Callback', re.compile(".*Callback.*")), ('Group-Callback', re.compile(".*Callback.*")),
('Group-API', re.compile(".*API.*")), ('Group-API', re.compile(".*API.*")),
...@@ -385,12 +386,19 @@ def read_stats(path, domain, args): ...@@ -385,12 +386,19 @@ def read_stats(path, domain, args):
entries[group_name]['count'] += count entries[group_name]['count'] += count
break break
# Calculate the V8-Total (all groups except Callback) # Calculate the V8-Total (all groups except Callback)
total_v8 = { 'time': 0, 'count': 0 } group_data = { 'time': 0, 'count': 0 }
for group_name, regexp in groups: for group_name, regexp in groups:
if group_name == 'Group-Callback': continue if group_name == 'Group-Callback': continue
total_v8['time'] += entries[group_name]['time'] group_data['time'] += entries[group_name]['time']
total_v8['count'] += entries[group_name]['count'] group_data['count'] += entries[group_name]['count']
entries['Group-Total-V8'] = total_v8 entries['Group-Total-V8'] = group_data
# Calculate the Parse-Total group
group_data = { 'time': 0, 'count': 0 }
for group_name, regexp in groups:
if !group_name.startswith('Group-Parse'): continue
group_data['time'] += entries[group_name]['time']
group_data['count'] += entries[group_name]['count']
entries['Group-Parse-Total'] = group_data
# Append the sums as single entries to domain. # Append the sums as single entries to domain.
for key in entries: for key in entries:
if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment