Author: [email protected]
Date: Thu Feb 26 07:48:32 2009
New Revision: 1380

Modified:
    branches/bleeding_edge/src/log.cc
    branches/bleeding_edge/tools/tickprocessor.py

Log:
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

Modified: branches/bleeding_edge/src/log.cc
==============================================================================
--- branches/bleeding_edge/src/log.cc   (original)
+++ branches/bleeding_edge/src/log.cc   Thu Feb 26 07:48:32 2009
@@ -138,12 +138,14 @@
  //
  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);
    }
  }

Modified: branches/bleeding_edge/tools/tickprocessor.py
==============================================================================
--- branches/bleeding_edge/tools/tickprocessor.py       (original)
+++ branches/bleeding_edge/tools/tickprocessor.py       Thu Feb 26 07:48:32 2009
@@ -147,6 +147,9 @@
      self.regions = []


+VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3 }
+
+
  class TickProcessor(object):

    def __init__(self):
@@ -164,6 +167,7 @@
      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 @@
      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 @@
        # 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 @@
        # 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 @@
      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 @@
        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"):

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to