mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 10:05:35 +00:00
[TASKMGR]
fix process cpu time CORE-9562 svn path=/trunk/; revision=67373
This commit is contained in:
parent
8492cfb611
commit
dc0ac57186
1 changed files with 10 additions and 8 deletions
|
@ -331,20 +331,18 @@ void PerfDataRefresh(void)
|
||||||
|
|
||||||
/* Now alloc a new PERFDATA array and fill in the data */
|
/* Now alloc a new PERFDATA array and fill in the data */
|
||||||
pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA) * ProcessCount);
|
pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA) * ProcessCount);
|
||||||
if (pPerfDataOld) {
|
|
||||||
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
|
|
||||||
}
|
|
||||||
pPerfDataOld = pPerfData;
|
|
||||||
|
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||||
for (Idx=0; Idx<ProcessCount; Idx++) {
|
for (Idx=0; Idx<ProcessCount; Idx++) {
|
||||||
/* Get the old perf data for this process (if any) */
|
/* Get the old perf data for this process (if any) */
|
||||||
/* so that we can establish delta values */
|
/* so that we can establish delta values */
|
||||||
pPDOld = NULL;
|
pPDOld = NULL;
|
||||||
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
if (pPerfDataOld) {
|
||||||
if (pPerfDataOld[Idx2].ProcessId == pSPI->UniqueProcessId) {
|
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
||||||
pPDOld = &pPerfDataOld[Idx2];
|
if (pPerfDataOld[Idx2].ProcessId == pSPI->UniqueProcessId) {
|
||||||
break;
|
pPDOld = &pPerfDataOld[Idx2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,6 +445,10 @@ ClearInfo:
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, pBuffer);
|
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||||
|
if (pPerfDataOld) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
|
||||||
|
}
|
||||||
|
pPerfDataOld = pPerfData;
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue