Two small changes regarding GC ticks.

1) Don't try to sample the stack if VM is in 'GC' state
2) Show GC ticks in profiler statistics

Review URL: http://codereview.chromium.org/27213

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1380 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2009-02-26 15:48:32 +00:00
parent 0dee6cbab4
commit 0864b2d646
2 changed files with 25 additions and 11 deletions

View File

@ -138,12 +138,14 @@ bool Profiler::paused_ = false;
//
void StackTracer::Trace(TickSample* sample) {
// Assuming that stack grows from lower addresses
if (sample->sp < sample->fp && sample->fp < low_stack_bound_) {
if (sample->state != GC
&& (sample->sp < sample->fp && sample->fp < low_stack_bound_)) {
sample->InitStack(1);
sample->stack[0] = Memory::Address_at(
(Address)(sample->fp + StandardFrameConstants::kCallerPCOffset));
} else {
// FP seems to be in some intermediate state, better discard this sample
// GC runs or FP seems to be in some intermediate state,
// better discard this sample
sample->InitStack(0);
}
}

View File

@ -147,6 +147,9 @@ class Assembler(object):
self.regions = []
VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3 }
class TickProcessor(object):
def __init__(self):
@ -164,6 +167,7 @@ class TickProcessor(object):
self.number_of_library_ticks = 0
self.unaccounted_number_of_ticks = 0
self.excluded_number_of_ticks = 0
self.number_of_gc_ticks = 0
# Flag indicating whether to ignore unaccounted ticks in the report
self.ignore_unknown = False
@ -287,6 +291,8 @@ class TickProcessor(object):
return result
def ProcessTick(self, pc, sp, state, stack):
if state == VMStates['GC']:
self.number_of_gc_ticks += 1
if not self.IncludeTick(pc, sp, state):
self.excluded_number_of_ticks += 1;
return
@ -320,11 +326,7 @@ class TickProcessor(object):
# Print the unknown ticks percentage if they are not ignored.
if not self.ignore_unknown and self.unaccounted_number_of_ticks > 0:
self.PrintHeader('Unknown')
unknown_percentage = self.unaccounted_number_of_ticks * 100.0 / self.total_number_of_ticks
print(' %(ticks)5d %(total)5.1f%%' % {
'ticks' : self.unaccounted_number_of_ticks,
'total' : unknown_percentage,
})
self.PrintCounter(self.unaccounted_number_of_ticks)
# Print the library ticks.
self.PrintHeader('Shared libraries')
self.PrintEntries(cpp_entries, lambda e:e.IsSharedLibraryEntry())
@ -334,6 +336,9 @@ class TickProcessor(object):
# Print the C++ ticks.
self.PrintHeader('C++')
self.PrintEntries(cpp_entries, lambda e:not e.IsSharedLibraryEntry())
# Print the GC ticks.
self.PrintHeader('GC')
self.PrintCounter(self.number_of_gc_ticks)
# Print call profile.
print('\n [Call profile]:')
print(' total call path')
@ -344,6 +349,13 @@ class TickProcessor(object):
print('\n [%s]:' % header_title)
print(' ticks total nonlib name')
def PrintCounter(self, ticks_count):
percentage = ticks_count * 100.0 / self.total_number_of_ticks
print(' %(ticks)5d %(total)5.1f%%' % {
'ticks' : ticks_count,
'total' : percentage,
})
def PrintEntries(self, entries, condition):
# If ignoring unaccounted ticks don't include these in percentage
# calculations
@ -418,13 +430,13 @@ class CmdLineProcessor(object):
self.PrintUsageAndExit()
for key, value in opts:
if key in ("-j", "--js"):
self.state = 0
self.state = VMStates['JS']
if key in ("-g", "--gc"):
self.state = 1
self.state = VMStates['GC']
if key in ("-c", "--compiler"):
self.state = 2
self.state = VMStates['COMPILER']
if key in ("-o", "--other"):
self.state = 3
self.state = VMStates['OTHER']
if key in ("--ignore-unknown"):
self.ignore_unknown = True
if key in ("--separate-ic"):