[TASKMGR]

fix process cpu time
CORE-9562

svn path=/trunk/; revision=67373
This commit is contained in:
Christoph von Wittich 2015-04-23 20:18:38 +00:00
parent 8492cfb611
commit dc0ac57186

View file

@ -331,20 +331,18 @@ void PerfDataRefresh(void)
/* Now alloc a new PERFDATA array and fill in the data */
pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA) * ProcessCount);
if (pPerfDataOld) {
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
}
pPerfDataOld = pPerfData;
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
for (Idx=0; Idx<ProcessCount; Idx++) {
/* Get the old perf data for this process (if any) */
/* so that we can establish delta values */
pPDOld = NULL;
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
if (pPerfDataOld[Idx2].ProcessId == pSPI->UniqueProcessId) {
pPDOld = &pPerfDataOld[Idx2];
break;
if (pPerfDataOld) {
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
if (pPerfDataOld[Idx2].ProcessId == pSPI->UniqueProcessId) {
pPDOld = &pPerfDataOld[Idx2];
break;
}
}
}
@ -447,6 +445,10 @@ ClearInfo:
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
}
HeapFree(GetProcessHeap(), 0, pBuffer);
if (pPerfDataOld) {
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
}
pPerfDataOld = pPerfData;
LeaveCriticalSection(&PerfDataCriticalSection);
}