Reviewers: Søren Gjesse,

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

Please review this at http://codereview.chromium.org/27213

Affected files:
   M src/log.cc
   M tools/tickprocessor.py


Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index  
283530358494d80187095668aeb0f24defbb387c..ea81b817c69798f4c5d039b4c50990fe2e6f2591
  
100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -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);
    }
  }
Index: tools/tickprocessor.py
diff --git a/tools/tickprocessor.py b/tools/tickprocessor.py
index  
bce30279d54764f675f4c6ac9e7267e8765ca21d..dcb8b2e88bd1a0a130c522c6c808e881564253c6
  
100644
--- a/tools/tickprocessor.py
+++ b/tools/tickprocessor.py
@@ -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
@@ -308,11 +314,12 @@ class TickProcessor(object):
        entry.Tick(pc, self.ProcessStack(stack))

    def PrintResults(self):
-    print('Statistical profiling result from %s, (%d ticks, %d  
unaccounted, %d excluded).' %
+    print('Statistical profiling result from %s, (%d ticks, %d  
unaccounted, %d excluded, %d GC).' %
            (self.log_file,
             self.total_number_of_ticks,
             self.unaccounted_number_of_ticks,
-           self.excluded_number_of_ticks))
+           self.excluded_number_of_ticks,
+           self.number_of_gc_ticks))
      if self.total_number_of_ticks > 0:
        js_entries = self.js_entries.ExportValueList()
        js_entries.extend(self.deleted_code)
@@ -418,13 +425,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"):



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

Reply via email to