Revision: 5261
Author: [email protected]
Date: Fri Aug 13 04:11:36 2010
Log: Add last OS error into heap stats.

That could allow us to understand why commit of from space sometimes fails.
Another option would be start a separate structure with OS-related info, but
as it's a single field, let's put it into HeapStats, at least for now.

Review URL: http://codereview.chromium.org/3118013
http://code.google.com/p/v8/source/detail?r=5261

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/platform-nullos.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc
 /branches/bleeding_edge/src/platform.h

=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Aug 10 03:05:18 2010
+++ /branches/bleeding_edge/src/api.cc  Fri Aug 13 04:11:36 2010
@@ -174,6 +174,8 @@
   heap_stats.objects_per_type = objects_per_type;
   int size_per_type[LAST_TYPE + 1] = {0};
   heap_stats.size_per_type = size_per_type;
+  int os_error;
+  heap_stats.os_error = &os_error;
   int end_marker;
   heap_stats.end_marker = &end_marker;
   i::Heap::RecordStats(&heap_stats, take_snapshot);
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Aug 11 07:30:14 2010
+++ /branches/bleeding_edge/src/heap.cc Fri Aug 13 04:11:36 2010
@@ -4076,6 +4076,7 @@
   *stats->memory_allocator_size = MemoryAllocator::Size();
   *stats->memory_allocator_capacity =
       MemoryAllocator::Size() + MemoryAllocator::Available();
+  *stats->os_error = OS::GetLastError();
   if (take_snapshot) {
     HeapIterator iterator;
     for (HeapObject* obj = iterator.next();
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Aug 11 07:30:14 2010
+++ /branches/bleeding_edge/src/heap.h  Fri Aug 13 04:11:36 2010
@@ -1345,7 +1345,8 @@
   int* memory_allocator_capacity;       // 20
   int* objects_per_type;                // 21
   int* size_per_type;                   // 22
-  int* end_marker;                      // 23
+  int* os_error;                        // 23
+  int* end_marker;                      // 24
 };


=======================================
--- /branches/bleeding_edge/src/platform-nullos.cc      Fri Nov 13 04:32:57 2009
+++ /branches/bleeding_edge/src/platform-nullos.cc      Fri Aug 13 04:11:36 2010
@@ -98,6 +98,12 @@
   UNIMPLEMENTED();
   return 0;
 }
+
+
+int OS::GetLastError() {
+  UNIMPLEMENTED();
+  return 0;
+}


 // Returns the local time offset in milliseconds east of UTC without
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Thu Aug 12 04:43:10 2010
+++ /branches/bleeding_edge/src/platform-posix.cc       Fri Aug 13 04:11:36 2010
@@ -106,6 +106,11 @@
   if (NULL == t) return nan_value();
   return t->tm_isdst > 0 ? 3600 * msPerSecond : 0;
 }
+
+
+int OS::GetLastError() {
+  return errno;
+}


// ----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc       Mon Aug  2 08:27:25 2010
+++ /branches/bleeding_edge/src/platform-win32.cc       Fri Aug 13 04:11:36 2010
@@ -649,6 +649,11 @@
   int64_t offset = Time(time).DaylightSavingsOffset();
   return static_cast<double>(offset);
 }
+
+
+int OS::GetLastError() {
+  return ::GetLastError();
+}


// ----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/platform.h      Fri May 21 22:27:19 2010
+++ /branches/bleeding_edge/src/platform.h      Fri Aug 13 04:11:36 2010
@@ -165,6 +165,9 @@
   // Returns the daylight savings offset for the given time.
   static double DaylightSavingsOffset(double time);

+  // Returns last OS error.
+  static int GetLastError();
+
   static FILE* FOpen(const char* path, const char* mode);

   // Log file open mode is platform-dependent due to line ends issues.

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

Reply via email to