Reviewers: Yang,

Message:
PTAL

Description:
Add flag to trace the amount of external memory.

[email protected]


Please review this at https://chromiumcodereview.appspot.com/10824196/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/flag-definitions.h
  M src/heap-inl.h


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 714bd8b952443e2e3545f6e6480384f0ebe44867..de9e6eb638548ab34f269bbb144d1da13ff6c8eb 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -370,6 +370,9 @@ DEFINE_bool(trace_gc_verbose, false,
             "print more details following each garbage collection")
 DEFINE_bool(trace_fragmentation, false,
             "report fragmentation for old pointer and data pages")
+DEFINE_bool(trace_external_memory, false,
+            "print amount of external allocated memory after each time "
+            "it is adjusted.")
 DEFINE_bool(collect_maps, true,
             "garbage collect maps from which no objects can be reached")
 DEFINE_bool(flush_code, true,
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index d5b0f50ea449e54f9afb24cda5b6ff20340805c1..4a827fef176fd57cafb2c929bb834cd229737aaa 100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -487,6 +487,13 @@ intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
       amount_of_external_allocated_memory_at_last_global_gc_ = 0;
     }
   }
+  if (FLAG_trace_external_memory) {
+    PrintPID("%8.0f ms: ", isolate()->time_millis_since_init());
+ PrintF("Adjust amount of external memory: delta=%6" V8_PTR_PREFIX "d KB, " + " amount=%6" V8_PTR_PREFIX "d KB, isolate=0x%08" V8PRIxPTR ".\n", + change_in_bytes / 1024, amount_of_external_allocated_memory_ / 1024,
+           reinterpret_cast<intptr_t>(isolate()));
+  }
   ASSERT(amount_of_external_allocated_memory_ >= 0);
   return amount_of_external_allocated_memory_;
 }


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

Reply via email to