From 032190ac918009a43384d79e666b10725130185c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 27 May 2020 23:56:02 +0200 Subject: [PATCH] taskmgr: Introduce size_diff helper. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- programs/taskmgr/perfdata.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c index f86d52159f2..3b5997d759f 100644 --- a/programs/taskmgr/perfdata.c +++ b/programs/taskmgr/perfdata.c @@ -51,6 +51,11 @@ static SYSTEM_CACHE_INFORMATION SystemCacheInfo; static SYSTEM_HANDLE_INFORMATION SystemHandleInfo; static PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL; +static size_t size_diff(size_t x, size_t y) +{ + return x > y ? x - y : y - x; +} + BOOL PerfDataInitialize(void) { LONG status; @@ -266,12 +271,12 @@ void PerfDataRefresh(void) pPerfData[Idx].vmCounters.WorkingSetSize = pSPI->vmCounters.WorkingSetSize; pPerfData[Idx].vmCounters.PeakWorkingSetSize = pSPI->vmCounters.PeakWorkingSetSize; if (pPDOld) - pPerfData[Idx].WorkingSetSizeDelta = labs(pSPI->vmCounters.WorkingSetSize - pPDOld->vmCounters.WorkingSetSize); + pPerfData[Idx].WorkingSetSizeDelta = size_diff(pSPI->vmCounters.WorkingSetSize, pPDOld->vmCounters.WorkingSetSize); else pPerfData[Idx].WorkingSetSizeDelta = 0; pPerfData[Idx].vmCounters.PageFaultCount = pSPI->vmCounters.PageFaultCount; if (pPDOld) - pPerfData[Idx].PageFaultCountDelta = labs(pSPI->vmCounters.PageFaultCount - pPDOld->vmCounters.PageFaultCount); + pPerfData[Idx].PageFaultCountDelta = size_diff(pSPI->vmCounters.PageFaultCount, pPDOld->vmCounters.PageFaultCount); else pPerfData[Idx].PageFaultCountDelta = 0; pPerfData[Idx].vmCounters.VirtualSize = pSPI->vmCounters.VirtualSize;