}
-void GCPrintSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size)
+void GCPrintSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_allocated_size, DWORD_PTR &total_committed_size)
{
DWORD_PTR dwAddrSeg;
DacpHeapSegmentData segment;
dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].start_segment;
- total_size = 0;
+ total_allocated_size = 0;
+ total_committed_size = 0;
// the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments
while (dwAddrSeg != (DWORD_PTR)heap.generation_table[0].start_segment)
{
ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg));
return;
}
- ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg),
- SOS_PTR(segment.mem), SOS_PTR(segment.allocated),
- (ULONG_PTR)(segment.allocated - segment.mem),
- (ULONG_PTR)(segment.allocated - segment.mem));
- total_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ ExtOut("%p %p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE"d) 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n",
+ SOS_PTR(dwAddrSeg),
+ SOS_PTR(segment.mem), SOS_PTR(segment.allocated), SOS_PTR(segment.committed),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem));
+ total_allocated_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ total_committed_size += (DWORD_PTR) (segment.committed - segment.mem);
dwAddrSeg = (DWORD_PTR)segment.next;
}
}
DWORD_PTR end = (DWORD_PTR)heap.alloc_allocated;
- ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg),
- SOS_PTR(segment.mem), SOS_PTR(end),
- (ULONG_PTR)(end - (DWORD_PTR)segment.mem),
- (ULONG_PTR)(end - (DWORD_PTR)segment.mem));
-
- total_size += end - (DWORD_PTR)segment.mem;
-
+ ExtOut("%p %p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE"d) 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n",
+ SOS_PTR(dwAddrSeg),
+ SOS_PTR(segment.mem), SOS_PTR(end), SOS_PTR(segment.committed),
+ (ULONG_PTR)(end - (DWORD_PTR)segment.mem),
+ (ULONG_PTR)(end - (DWORD_PTR)segment.mem),
+ (ULONG_PTR)(segment.committed - (DWORD_PTR)segment.mem),
+ (ULONG_PTR)(segment.committed - (DWORD_PTR)segment.mem));
+
+ total_allocated_size += end - (DWORD_PTR)segment.mem;
+ total_committed_size += (DWORD_PTR)(segment.committed - segment.mem);
}
-void GCPrintLargeHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size)
+void GCPrintLargeHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_allocated_size, DWORD_PTR &total_committed_size)
{
DWORD_PTR dwAddrSeg;
DacpHeapSegmentData segment;
ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg));
return;
}
- ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg),
- SOS_PTR(segment.mem), SOS_PTR(segment.allocated),
- (ULONG_PTR)(segment.allocated - segment.mem),
- (ULONG_PTR)(segment.allocated - segment.mem));
- total_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ ExtOut("%p %p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE"d) 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n",
+ SOS_PTR(dwAddrSeg),
+ SOS_PTR(segment.mem),
+ SOS_PTR(segment.allocated),
+ SOS_PTR(segment.committed),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem));
+ total_allocated_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ total_committed_size += (DWORD_PTR) (segment.committed - segment.mem);
dwAddrSeg = (DWORD_PTR)segment.next;
}
}
-void GCPrintPinnedHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size)
+void GCPrintPinnedHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_allocated_size, DWORD_PTR total_committed_size)
{
DWORD_PTR dwAddrSeg;
DacpHeapSegmentData segment;
dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration() + 2].start_segment;
- // total_size = 0;
// the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments
while (dwAddrSeg != NULL)
{
ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg));
return;
}
- ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg),
- SOS_PTR(segment.mem), SOS_PTR(segment.allocated),
- (ULONG_PTR)(segment.allocated - segment.mem),
- (ULONG_PTR)(segment.allocated - segment.mem));
- total_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ ExtOut("%p %p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE"d) 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n",
+ SOS_PTR(dwAddrSeg),
+ SOS_PTR(segment.mem),
+ SOS_PTR(segment.allocated),
+ SOS_PTR(segment.committed),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.allocated - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem),
+ (ULONG_PTR)(segment.committed - segment.mem));
+ total_allocated_size += (DWORD_PTR) (segment.allocated - segment.mem);
+ total_committed_size += (DWORD_PTR) (segment.committed - segment.mem);
dwAddrSeg = (DWORD_PTR)segment.next;
}
}
-void GCHeapInfo(const GCHeapDetails &heap, DWORD_PTR &total_size)
+void GCHeapInfo(const GCHeapDetails &heap, DWORD_PTR &total_allocated_size, DWORD_PTR &total_committed_size)
{
GCPrintGenerationInfo(heap);
- ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "size");
- GCPrintSegmentInfo(heap, total_size);
+ ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "committed", "allocated size", "committed size");
+ GCPrintSegmentInfo(heap, total_allocated_size, total_committed_size);
ExtOut("Large object heap starts at 0x%p\n",
SOS_PTR(heap.generation_table[GetMaxGeneration() + 1].allocation_start));
- ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "size");
- GCPrintLargeHeapSegmentInfo(heap, total_size);
+ ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "committed", "allocated size", "committed size");
+ GCPrintLargeHeapSegmentInfo(heap, total_allocated_size, total_committed_size);
if (heap.has_poh)
{
ExtOut("Pinned object heap starts at 0x%p\n",
SOS_PTR(heap.generation_table[GetMaxGeneration() + 2].allocation_start));
- GCPrintPinnedHeapSegmentInfo(heap, total_size);
+ GCPrintPinnedHeapSegmentInfo(heap, total_allocated_size, total_committed_size);
}
}
*outWasted += wasted;
return toReturn;
-}
+}
\ No newline at end of file
}
ExtOut("Number of GC Heaps: %d\n", dwNHeaps);
- DWORD_PTR totalSize = 0;
+ DWORD_PTR totalAllocatedSize = 0;
+ DWORD_PTR totalCommittedSize = 0;
if (!gcheap.bServerMode)
{
DacpGcHeapDetails heapDetails;
return Status;
}
- GCHeapInfo (heapDetails, totalSize);
- ExtOut("Total Size: ");
- PrintHeapSize(totalSize, 0);
+ GCHeapInfo (heapDetails, totalAllocatedSize, totalCommittedSize);
+ ExtOut("Total Allocated Size: ");
+ PrintHeapSize(totalAllocatedSize, 0);
+ ExtOut("Total Committed Size: ");
+ PrintHeapSize(totalCommittedSize, 0);
}
else
{
}
ExtOut("------------------------------\n");
ExtOut("Heap %d (%p)\n", n, SOS_PTR(heapAddrs[n]));
- DWORD_PTR heapSize = 0;
+ DWORD_PTR heapAllocSize = 0;
+ DWORD_PTR heapCommitSize = 0;
GCHeapDetails heapDetails(dacHeapDetails, heapAddrs[n]);
- GCHeapInfo (heapDetails, heapSize);
- totalSize += heapSize;
- ExtOut("Heap Size: " WIN86_8SPACES);
- PrintHeapSize(heapSize, 0);
+ GCHeapInfo (heapDetails, heapAllocSize, heapCommitSize);
+ totalAllocatedSize += heapAllocSize;
+ totalCommittedSize += heapCommitSize;
+ ExtOut("Allocated Heap Size: " WIN86_8SPACES);
+ PrintHeapSize(heapAllocSize, 0);
+ ExtOut("Committed Heap Size: " WIN86_8SPACES);
+ PrintHeapSize(heapCommitSize, 0);
}
}
ExtOut("------------------------------\n");
- ExtOut("GC Heap Size: " WIN86_8SPACES);
- PrintHeapSize(totalSize, 0);
+ ExtOut("GC Allocated Heap Size: " WIN86_8SPACES);
+ PrintHeapSize(totalAllocatedSize, 0);
+ ExtOut("GC Committed Heap Size: " WIN86_8SPACES);
+ PrintHeapSize(totalCommittedSize, 0);
}
return Status;
}
}
return S_OK;
-}
+}
\ No newline at end of file