Bug 913953 - Part k: Remove unused GetCommittedKBytes function; r=ehsan

This commit is contained in:
Ms2ger 2013-09-10 09:03:34 +02:00
parent bb54c2d552
commit be763b7b6a
2 changed files with 0 additions and 51 deletions

View File

@ -267,18 +267,6 @@ class NamedProcessIterator {
DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator);
};
// Committed (resident + paged) memory usage broken down by
// private: These pages cannot be shared with any other process.
// mapped: These pages are mapped into the view of a section (backed by
// pagefile.sys)
// image: These pages are mapped into the view of an image section (backed by
// file system)
struct CommittedKBytes {
size_t priv;
size_t mapped;
size_t image;
};
// Free memory (Megabytes marked as free) in the 2G process address space.
// total : total amount in megabytes marked as free. Maximum value is 2048.
// largest : size of the largest contiguous amount of memory found. It is
@ -313,9 +301,6 @@ class ProcessMetrics {
// of memory currently allocated to a process that cannot be shared.
// Note: returns 0 on unsupported OSes: prior to XP SP2.
size_t GetPrivateBytes() const;
// Fills a CommittedKBytes with both resident and paged
// memory usage as per definition of CommittedBytes.
void GetCommittedKBytes(CommittedKBytes* usage) const;
// Returns the CPU usage in percent since the last time this method was
// called. The first time this method is called it returns 0 and will return

View File

@ -508,42 +508,6 @@ size_t ProcessMetrics::GetPrivateBytes() const {
return 0;
}
void ProcessMetrics::GetCommittedKBytes(CommittedKBytes* usage) const {
MEMORY_BASIC_INFORMATION mbi = {0};
size_t committed_private = 0;
size_t committed_mapped = 0;
size_t committed_image = 0;
void* base_address = NULL;
while (VirtualQueryEx(process_, base_address, &mbi, sizeof(mbi)) ==
sizeof(mbi)) {
if (mbi.State == MEM_COMMIT) {
if (mbi.Type == MEM_PRIVATE) {
committed_private += mbi.RegionSize;
} else if (mbi.Type == MEM_MAPPED) {
committed_mapped += mbi.RegionSize;
} else if (mbi.Type == MEM_IMAGE) {
committed_image += mbi.RegionSize;
} else {
NOTREACHED();
}
}
void* new_base = (static_cast<BYTE*>(mbi.BaseAddress)) + mbi.RegionSize;
// Avoid infinite loop by weird MEMORY_BASIC_INFORMATION.
// If we query 64bit processes in a 32bit process, VirtualQueryEx()
// returns such data.
if (new_base <= base_address) {
usage->image = 0;
usage->mapped = 0;
usage->priv = 0;
return;
}
base_address = new_base;
}
usage->image = committed_image / 1024;
usage->mapped = committed_mapped / 1024;
usage->priv = committed_private / 1024;
}
static uint64_t FileTimeToUTC(const FILETIME& ftime) {
LARGE_INTEGER li;
li.LowPart = ftime.dwLowDateTime;