aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2019-06-10 09:38:54 -0700
committerLukas Rusak <lorusak@gmail.com>2019-06-11 20:08:50 -0700
commitde90ed98b23e97af6971985c7a90a4df3cb4b080 (patch)
treef78daad5171456bf0834b9b44348f9abe5b3946b
parent551580dfd34b22d673a2fe38a34ac45fbac0c1cb (diff)
MemUtils: remove unused struct parameters
-rw-r--r--xbmc/platform/darwin/MemUtils.cpp45
-rw-r--r--xbmc/platform/freebsd/MemUtils.cpp6
-rw-r--r--xbmc/platform/linux/MemUtils.cpp3
-rw-r--r--xbmc/platform/win32/MemUtils.cpp5
-rw-r--r--xbmc/utils/MemUtils.h4
5 files changed, 16 insertions, 47 deletions
diff --git a/xbmc/platform/darwin/MemUtils.cpp b/xbmc/platform/darwin/MemUtils.cpp
index e0fc66f7ba..ca774af7ef 100644
--- a/xbmc/platform/darwin/MemUtils.cpp
+++ b/xbmc/platform/darwin/MemUtils.cpp
@@ -62,44 +62,31 @@ void GetMemoryStatus(MemoryStatus* buffer)
if (sysctl(mib.data(), mib.size(), &physmem, &len, nullptr, 0) == 0 && len == sizeof(physmem))
buffer->totalPhys = physmem;
- // Virtual memory.
- mib[0] = CTL_VM;
- mib[1] = VM_SWAPUSAGE;
- struct xsw_usage swap;
- len = sizeof(struct xsw_usage);
- if (sysctl(mib.data(), mib.size(), &swap, &len, NULL, 0) == 0)
- {
- buffer->availPageFile = swap.xsu_avail;
- buffer->totalVirtual = buffer->totalPhys + swap.xsu_total;
- }
-
// In use.
mach_port_t stat_port = mach_host_self();
vm_statistics_data_t vm_stat;
mach_msg_type_number_t count = sizeof(vm_stat) / sizeof(natural_t);
if (host_statistics(stat_port, HOST_VM_INFO, reinterpret_cast<host_info_t>(&vm_stat), &count) == 0)
{
- // Find page size.
+ // Find page size.
#if defined(TARGET_DARWIN_IOS)
- // on ios with 64bit ARM CPU the page size is wrongly given as 16K
- // when using the sysctl approach. We can use the host_page_size
- // function instead which will give the proper 4k pagesize
- // on both 32 and 64 bit ARM CPUs
- vm_size_t pageSize;
- host_page_size(stat_port, &pageSize);
+ // on ios with 64bit ARM CPU the page size is wrongly given as 16K
+ // when using the sysctl approach. We can use the host_page_size
+ // function instead which will give the proper 4k pagesize
+ // on both 32 and 64 bit ARM CPUs
+ vm_size_t pageSize;
+ host_page_size(stat_port, &pageSize);
#else
- int pageSize;
- mib[0] = CTL_HW;
- mib[1] = HW_PAGESIZE;
- len = sizeof(int);
- if (sysctl(mib.data(), mib.size(), &pageSize, &len, nullptr, 0) == 0)
+ int pageSize;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ len = sizeof(int);
+ if (sysctl(mib.data(), mib.size(), &pageSize, &len, nullptr, 0) == 0)
#endif
- {
- uint64_t used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pageSize;
-
- buffer->availPhys = buffer->totalPhys - used;
- buffer->availVirtual = buffer->availPhys; // FIXME.
- }
+ {
+ uint64_t used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pageSize;
+ buffer->availPhys = buffer->totalPhys - used;
+ }
}
}
diff --git a/xbmc/platform/freebsd/MemUtils.cpp b/xbmc/platform/freebsd/MemUtils.cpp
index aeb2666370..66752e39ec 100644
--- a/xbmc/platform/freebsd/MemUtils.cpp
+++ b/xbmc/platform/freebsd/MemUtils.cpp
@@ -50,7 +50,6 @@ void GetMemoryStatus(MemoryStatus* buffer)
if (sysctlbyname("hw.physmem", &physmem, &len, NULL, 0) == 0)
{
buffer->totalPhys = physmem;
- buffer->totalVirtual = physmem;
}
/* pagesize */
@@ -79,11 +78,6 @@ void GetMemoryStatus(MemoryStatus* buffer)
/* mem_avail = mem_inactive + mem_cache + mem_free */
buffer->availPhys = mem_inactive + mem_cache + mem_free;
- buffer->availVirtual = mem_inactive + mem_cache + mem_free;
-
- size_t swap_free = 0;
- if (sysctlbyname("vm.stats.vm.v_swappgsout", &swap_free, &len, NULL, 0) == 0)
- buffer->availPageFile = swap_free * pagesize;
}
}
diff --git a/xbmc/platform/linux/MemUtils.cpp b/xbmc/platform/linux/MemUtils.cpp
index 44f82ba22b..058826ff5e 100644
--- a/xbmc/platform/linux/MemUtils.cpp
+++ b/xbmc/platform/linux/MemUtils.cpp
@@ -38,11 +38,8 @@ void GetMemoryStatus(MemoryStatus* buffer)
struct sysinfo info;
sysinfo(&info);
- buffer->availPageFile = (info.freeswap * info.mem_unit);
buffer->availPhys = ((info.freeram + info.bufferram) * info.mem_unit);
- buffer->availVirtual = ((info.freeram + info.bufferram) * info.mem_unit);
buffer->totalPhys = (info.totalram * info.mem_unit);
- buffer->totalVirtual = (info.totalram * info.mem_unit);
}
}
diff --git a/xbmc/platform/win32/MemUtils.cpp b/xbmc/platform/win32/MemUtils.cpp
index 3af2dc20e6..3ae25fdcee 100644
--- a/xbmc/platform/win32/MemUtils.cpp
+++ b/xbmc/platform/win32/MemUtils.cpp
@@ -32,13 +32,8 @@ void GetMemoryStatus(MemoryStatus* buffer)
memory.dwLength = sizeof(memory);
GlobalMemoryStatusEx(&memory);
- buffer->memoryLoad = memory.dwMemoryLoad;
buffer->totalPhys = memory.ullTotalPhys;
buffer->availPhys = memory.ullAvailPhys;
- buffer->totalPageFile = memory.ullTotalPageFile;
- buffer->availPageFile = memory.ullAvailPageFile;
- buffer->totalVirtual = memory.ullTotalVirtual;
- buffer->availVirtual = memory.ullAvailVirtual;
}
}
diff --git a/xbmc/utils/MemUtils.h b/xbmc/utils/MemUtils.h
index 963c526a70..026690864f 100644
--- a/xbmc/utils/MemUtils.h
+++ b/xbmc/utils/MemUtils.h
@@ -21,10 +21,6 @@ struct MemoryStatus
uint64_t totalPhys;
uint64_t availPhys;
- uint64_t totalPageFile;
- uint64_t availPageFile;
- uint64_t totalVirtual;
- uint64_t availVirtual;
};
void* AlignedMalloc(size_t s, size_t alignTo);