6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 TGraphCtrl PerformancePageCpuUsageHistoryGraph
;
26 TGraphCtrl PerformancePageMemUsageHistoryGraph
;
28 HWND hPerformancePage
; /* Performance Property Page */
29 HWND hPerformancePageCpuUsageGraph
; /* CPU Usage Graph */
30 HWND hPerformancePageMemUsageGraph
; /* MEM Usage Graph */
31 HWND hPerformancePageCpuUsageHistoryGraph
; /* CPU Usage History Graph */
32 HWND hPerformancePageMemUsageHistoryGraph
; /* Memory Usage History Graph */
33 HWND hPerformancePageTotalsFrame
; /* Totals Frame */
34 HWND hPerformancePageCommitChargeFrame
; /* Commit Charge Frame */
35 HWND hPerformancePageKernelMemoryFrame
; /* Kernel Memory Frame */
36 HWND hPerformancePagePhysicalMemoryFrame
; /* Physical Memory Frame */
37 HWND hPerformancePageCpuUsageFrame
;
38 HWND hPerformancePageMemUsageFrame
;
39 HWND hPerformancePageCpuUsageHistoryFrame
;
40 HWND hPerformancePageMemUsageHistoryFrame
;
41 HWND hPerformancePageCommitChargeTotalEdit
; /* Commit Charge Total Edit Control */
42 HWND hPerformancePageCommitChargeLimitEdit
; /* Commit Charge Limit Edit Control */
43 HWND hPerformancePageCommitChargePeakEdit
; /* Commit Charge Peak Edit Control */
44 HWND hPerformancePageKernelMemoryTotalEdit
; /* Kernel Memory Total Edit Control */
45 HWND hPerformancePageKernelMemoryPagedEdit
; /* Kernel Memory Paged Edit Control */
46 HWND hPerformancePageKernelMemoryNonPagedEdit
; /* Kernel Memory NonPaged Edit Control */
47 HWND hPerformancePagePhysicalMemoryTotalEdit
; /* Physical Memory Total Edit Control */
48 HWND hPerformancePagePhysicalMemoryAvailableEdit
; /* Physical Memory Available Edit Control */
49 HWND hPerformancePagePhysicalMemorySystemCacheEdit
; /* Physical Memory System Cache Edit Control */
50 HWND hPerformancePageTotalsHandleCountEdit
; /* Total Handles Edit Control */
51 HWND hPerformancePageTotalsProcessCountEdit
; /* Total Processes Edit Control */
52 HWND hPerformancePageTotalsThreadCountEdit
; /* Total Threads Edit Control */
55 static int nPerformancePageWidth
;
56 static int nPerformancePageHeight
;
57 static int lastX
, lastY
;
58 static HANDLE hPerformancePageEvent
= NULL
; /* When this event becomes signaled then we refresh the performance page */
59 DWORD WINAPI
PerformancePageRefreshThread(void *lpParameter
);
61 void AdjustFrameSize(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
, int pos
)
66 GetClientRect(hCntrl
, &rc
);
67 MapWindowPoints(hCntrl
, hDlg
, (LPPOINT
)(PRECT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)));
71 sx
= rc
.right
- rc
.left
;
76 cy
+= nYDifference
/ 2;
82 cy
+= nYDifference
/ 2;
86 sy
= rc
.bottom
- rc
.top
+ nYDifference
/ 2;
87 SetWindowPos(hCntrl
, NULL
, cx
, cy
, sx
, sy
, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOZORDER
);
89 cx
= rc
.left
+ nXDifference
;
90 cy
= rc
.top
+ nYDifference
;
92 SetWindowPos(hCntrl
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
94 InvalidateRect(hCntrl
, NULL
, TRUE
);
97 void AdjustControlPostion(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
)
99 AdjustFrameSize(hCntrl
, hDlg
, nXDifference
, nYDifference
, 0);
102 void AdjustCntrlPos(int ctrl_id
, HWND hDlg
, int nXDifference
, int nYDifference
)
104 AdjustFrameSize(GetDlgItem(hDlg
, ctrl_id
), hDlg
, nXDifference
, nYDifference
, 0);
108 PerformancePageWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
114 HANDLE hRefreshThread
= NULL
;
117 /* PAINTSTRUCT ps; */
121 GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph
);
122 GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph
);
124 CloseHandle(hRefreshThread
);
130 /* Save the width and height */
131 GetClientRect(hDlg
, &rc
);
132 nPerformancePageWidth
= rc
.right
;
133 nPerformancePageHeight
= rc
.bottom
;
135 /* Update window position */
136 SetWindowPos(hDlg
, NULL
, 15, 30, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
139 * Get handles to all the controls
141 hPerformancePageTotalsFrame
= GetDlgItem(hDlg
, IDC_TOTALS_FRAME
);
142 hPerformancePageCommitChargeFrame
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_FRAME
);
143 hPerformancePageKernelMemoryFrame
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_FRAME
);
144 hPerformancePagePhysicalMemoryFrame
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_FRAME
);
146 hPerformancePageCpuUsageFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_FRAME
);
147 hPerformancePageMemUsageFrame
= GetDlgItem(hDlg
, IDC_MEM_USAGE_FRAME
);
148 hPerformancePageCpuUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_FRAME
);
149 hPerformancePageMemUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_MEMORY_USAGE_HISTORY_FRAME
);
151 hPerformancePageCommitChargeTotalEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_TOTAL
);
152 hPerformancePageCommitChargeLimitEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_LIMIT
);
153 hPerformancePageCommitChargePeakEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_PEAK
);
154 hPerformancePageKernelMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_TOTAL
);
155 hPerformancePageKernelMemoryPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_PAGED
);
156 hPerformancePageKernelMemoryNonPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_NONPAGED
);
157 hPerformancePagePhysicalMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_TOTAL
);
158 hPerformancePagePhysicalMemoryAvailableEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_AVAILABLE
);
159 hPerformancePagePhysicalMemorySystemCacheEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE
);
160 hPerformancePageTotalsHandleCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_HANDLE_COUNT
);
161 hPerformancePageTotalsProcessCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_PROCESS_COUNT
);
162 hPerformancePageTotalsThreadCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_THREAD_COUNT
);
164 hPerformancePageCpuUsageGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_GRAPH
);
165 hPerformancePageMemUsageGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_GRAPH
);
166 hPerformancePageMemUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
167 hPerformancePageCpuUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
169 GetClientRect(hPerformancePageCpuUsageHistoryGraph
, &rc
);
170 /* create the control */
171 /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
172 GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph
, hPerformancePageCpuUsageHistoryGraph
, hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
173 /* customize the control */
174 GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph
, 0.0, 100.0, 10);
175 /* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */
176 /* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */
177 /* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */
178 /* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */
179 /* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */
180 GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph
, RGB(0, 0, 0)) ;
181 GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph
, RGB(0, 128, 64));
183 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 0, RGB(0, 255, 0)) ;
184 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 1, RGB(255, 0, 0)) ;
187 GetClientRect(hPerformancePageMemUsageHistoryGraph
, &rc
);
188 GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph
, hPerformancePageMemUsageHistoryGraph
, hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
189 GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph
, 0.0, 100.0, 10) ;
190 GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph
, RGB(0, 0, 0)) ;
191 GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph
, RGB(0, 128, 64)) ;
192 GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph
, 0, RGB(255, 255, 0)) ;
193 /* Start our refresh thread */
195 hRefreshThread
= CreateThread(NULL
, 0, PerformancePageRefreshThread
, NULL
, 0, NULL
);
199 * Subclass graph buttons
201 OldGraphWndProc
= (WNDPROC
)(LONG_PTR
) SetWindowLongPtrW(hPerformancePageCpuUsageGraph
, GWL_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
202 SetWindowLongPtrW(hPerformancePageMemUsageGraph
, GWL_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
203 OldGraphCtrlWndProc
= (WNDPROC
)(LONG_PTR
) SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph
, GWL_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
204 SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph
, GWL_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
212 GetClientRect(hDlg
, &rc
);
213 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
214 ReleaseDC(hDlg
, hdc
);
218 hdc
= BeginPaint(hDlg
, &ps
);
219 GetClientRect(hDlg
, &rc
);
220 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
228 if (wParam
== SIZE_MINIMIZED
)
233 nXDifference
= cx
- nPerformancePageWidth
;
234 nYDifference
= cy
- nPerformancePageHeight
;
235 nPerformancePageWidth
= cx
;
236 nPerformancePageHeight
= cy
;
239 /* Reposition the performance page's controls */
240 AdjustFrameSize(hPerformancePageTotalsFrame
, hDlg
, 0, nYDifference
, 0);
241 AdjustFrameSize(hPerformancePageCommitChargeFrame
, hDlg
, 0, nYDifference
, 0);
242 AdjustFrameSize(hPerformancePageKernelMemoryFrame
, hDlg
, 0, nYDifference
, 0);
243 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame
, hDlg
, 0, nYDifference
, 0);
244 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL
, hDlg
, 0, nYDifference
);
245 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT
, hDlg
, 0, nYDifference
);
246 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK
, hDlg
, 0, nYDifference
);
247 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
248 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED
, hDlg
, 0, nYDifference
);
249 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED
, hDlg
, 0, nYDifference
);
250 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
251 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE
, hDlg
, 0, nYDifference
);
252 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
, hDlg
, 0, nYDifference
);
253 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT
, hDlg
, 0, nYDifference
);
254 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT
, hDlg
, 0, nYDifference
);
255 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT
, hDlg
, 0, nYDifference
);
257 AdjustControlPostion(hPerformancePageCommitChargeTotalEdit
, hDlg
, 0, nYDifference
);
258 AdjustControlPostion(hPerformancePageCommitChargeLimitEdit
, hDlg
, 0, nYDifference
);
259 AdjustControlPostion(hPerformancePageCommitChargePeakEdit
, hDlg
, 0, nYDifference
);
260 AdjustControlPostion(hPerformancePageKernelMemoryTotalEdit
, hDlg
, 0, nYDifference
);
261 AdjustControlPostion(hPerformancePageKernelMemoryPagedEdit
, hDlg
, 0, nYDifference
);
262 AdjustControlPostion(hPerformancePageKernelMemoryNonPagedEdit
, hDlg
, 0, nYDifference
);
263 AdjustControlPostion(hPerformancePagePhysicalMemoryTotalEdit
, hDlg
, 0, nYDifference
);
264 AdjustControlPostion(hPerformancePagePhysicalMemoryAvailableEdit
, hDlg
, 0, nYDifference
);
265 AdjustControlPostion(hPerformancePagePhysicalMemorySystemCacheEdit
, hDlg
, 0, nYDifference
);
266 AdjustControlPostion(hPerformancePageTotalsHandleCountEdit
, hDlg
, 0, nYDifference
);
267 AdjustControlPostion(hPerformancePageTotalsProcessCountEdit
, hDlg
, 0, nYDifference
);
268 AdjustControlPostion(hPerformancePageTotalsThreadCountEdit
, hDlg
, 0, nYDifference
);
270 nXDifference
+= lastX
;
271 nYDifference
+= lastY
;
273 if (nXDifference
% 2) {
274 if (nXDifference
> 0) {
282 if (nYDifference
% 2) {
283 if (nYDifference
> 0) {
291 AdjustFrameSize(hPerformancePageCpuUsageFrame
, hDlg
, nXDifference
, nYDifference
, 1);
292 AdjustFrameSize(hPerformancePageMemUsageFrame
, hDlg
, nXDifference
, nYDifference
, 2);
293 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 3);
294 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 4);
295 AdjustFrameSize(hPerformancePageCpuUsageGraph
, hDlg
, nXDifference
, nYDifference
, 1);
296 AdjustFrameSize(hPerformancePageMemUsageGraph
, hDlg
, nXDifference
, nYDifference
, 2);
297 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 3);
298 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 4);
304 void RefreshPerformancePage(void)
306 /* Signal the event so that our refresh thread */
307 /* will wake up and refresh the performance page */
308 SetEvent(hPerformancePageEvent
);
311 DWORD WINAPI
PerformancePageRefreshThread(void *lpParameter
)
313 ULONG CommitChargeTotal
;
314 ULONG CommitChargeLimit
;
315 ULONG CommitChargePeak
;
318 ULONG CpuKernelUsage
;
320 ULONG KernelMemoryTotal
;
321 ULONG KernelMemoryPaged
;
322 ULONG KernelMemoryNonPaged
;
324 ULONG PhysicalMemoryTotal
;
325 ULONG PhysicalMemoryAvailable
;
326 ULONG PhysicalMemorySystemCache
;
330 ULONG TotalProcesses
;
333 WCHAR szMemUsage
[256];
335 /* Create the event */
336 hPerformancePageEvent
= CreateEventW(NULL
, TRUE
, TRUE
, NULL
);
338 /* If we couldn't create the event then exit the thread */
339 if (!hPerformancePageEvent
)
342 LoadStringW(hInst
, IDS_STATUS_MEMUSAGE
, szMemUsage
, 256);
351 /* Wait on the event */
352 dwWaitVal
= WaitForSingleObject(hPerformancePageEvent
, INFINITE
);
354 /* If the wait failed then the event object must have been */
355 /* closed and the task manager is exiting so exit this thread */
356 if (dwWaitVal
== WAIT_FAILED
)
359 if (dwWaitVal
== WAIT_OBJECT_0
)
361 /* Reset our event */
362 ResetEvent(hPerformancePageEvent
);
365 * Update the commit charge info
367 CommitChargeTotal
= PerfDataGetCommitChargeTotalK();
368 CommitChargeLimit
= PerfDataGetCommitChargeLimitK();
369 CommitChargePeak
= PerfDataGetCommitChargePeakK();
370 _ultow(CommitChargeTotal
, Text
, 10);
371 SetWindowTextW(hPerformancePageCommitChargeTotalEdit
, Text
);
372 _ultow(CommitChargeLimit
, Text
, 10);
373 SetWindowTextW(hPerformancePageCommitChargeLimitEdit
, Text
);
374 _ultow(CommitChargePeak
, Text
, 10);
375 SetWindowTextW(hPerformancePageCommitChargePeakEdit
, Text
);
376 wsprintfW(Text
, szMemUsage
, CommitChargeTotal
, CommitChargeLimit
);
377 SendMessageW(hStatusWnd
, SB_SETTEXT
, 2, (LPARAM
)Text
);
380 * Update the kernel memory info
382 KernelMemoryTotal
= PerfDataGetKernelMemoryTotalK();
383 KernelMemoryPaged
= PerfDataGetKernelMemoryPagedK();
384 KernelMemoryNonPaged
= PerfDataGetKernelMemoryNonPagedK();
385 _ultow(KernelMemoryTotal
, Text
, 10);
386 SetWindowTextW(hPerformancePageKernelMemoryTotalEdit
, Text
);
387 _ultow(KernelMemoryPaged
, Text
, 10);
388 SetWindowTextW(hPerformancePageKernelMemoryPagedEdit
, Text
);
389 _ultow(KernelMemoryNonPaged
, Text
, 10);
390 SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit
, Text
);
393 * Update the physical memory info
395 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
396 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
397 PhysicalMemorySystemCache
= PerfDataGetPhysicalMemorySystemCacheK();
398 _ultow(PhysicalMemoryTotal
, Text
, 10);
399 SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit
, Text
);
400 _ultow(PhysicalMemoryAvailable
, Text
, 10);
401 SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit
, Text
);
402 _ultow(PhysicalMemorySystemCache
, Text
, 10);
403 SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit
, Text
);
406 * Update the totals info
408 TotalHandles
= PerfDataGetSystemHandleCount();
409 TotalThreads
= PerfDataGetTotalThreadCount();
410 TotalProcesses
= PerfDataGetProcessCount();
411 _ultow(TotalHandles
, Text
, 10);
412 SetWindowTextW(hPerformancePageTotalsHandleCountEdit
, Text
);
413 _ultow(TotalThreads
, Text
, 10);
414 SetWindowTextW(hPerformancePageTotalsThreadCountEdit
, Text
);
415 _ultow(TotalProcesses
, Text
, 10);
416 SetWindowTextW(hPerformancePageTotalsProcessCountEdit
, Text
);
421 InvalidateRect(hPerformancePageCpuUsageGraph
, NULL
, FALSE
);
422 InvalidateRect(hPerformancePageMemUsageGraph
, NULL
, FALSE
);
427 CpuUsage
= PerfDataGetProcessorUsage();
428 if (CpuUsage
<= 0 ) CpuUsage
= 0;
429 if (CpuUsage
> 100) CpuUsage
= 100;
431 if (TaskManagerSettings
.ShowKernelTimes
)
433 CpuKernelUsage
= PerfDataGetProcessorSystemUsage();
434 if (CpuKernelUsage
<= 0) CpuKernelUsage
= 0;
435 if (CpuKernelUsage
> 100) CpuKernelUsage
= 100;
442 * Get the memory usage
444 CommitChargeTotal
= PerfDataGetCommitChargeTotalK();
445 CommitChargeLimit
= PerfDataGetCommitChargeLimitK();
446 nBarsUsed1
= CommitChargeLimit
? ((CommitChargeTotal
* 100) / CommitChargeLimit
) : 0;
448 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
449 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
450 nBarsUsed2
= PhysicalMemoryTotal
? ((PhysicalMemoryAvailable
* 100) / PhysicalMemoryTotal
) : 0;
454 GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph
, CpuUsage
, CpuKernelUsage
, 0.0, 0.0);
455 GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph
, nBarsUsed1
, nBarsUsed2
, 0.0, 0.0);
456 /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
457 InvalidateRect(hPerformancePageMemUsageHistoryGraph
, NULL
, FALSE
);
458 InvalidateRect(hPerformancePageCpuUsageHistoryGraph
, NULL
, FALSE
);
464 void PerformancePage_OnViewShowKernelTimes(void)
469 hMenu
= GetMenu(hMainWnd
);
470 hViewMenu
= GetSubMenu(hMenu
, 2);
472 /* Check or uncheck the show 16-bit tasks menu item */
473 if (GetMenuState(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
) & MF_CHECKED
)
475 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_UNCHECKED
);
476 TaskManagerSettings
.ShowKernelTimes
= FALSE
;
480 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_CHECKED
);
481 TaskManagerSettings
.ShowKernelTimes
= TRUE
;
484 RefreshPerformancePage();
487 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
491 HMENU hCPUHistoryMenu
;
493 hMenu
= GetMenu(hMainWnd
);
494 hViewMenu
= GetSubMenu(hMenu
, 2);
495 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
497 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= FALSE
;
498 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, MF_BYCOMMAND
);
501 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
505 HMENU hCPUHistoryMenu
;
507 hMenu
= GetMenu(hMainWnd
);
508 hViewMenu
= GetSubMenu(hMenu
, 2);
509 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
511 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= TRUE
;
512 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, MF_BYCOMMAND
);