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
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
38 #include "PerformancePage.h"
42 #include "GraphCtrl.h"
44 TGraphCtrl PerformancePageCpuUsageHistoryGraph
;
45 TGraphCtrl PerformancePageMemUsageHistoryGraph
;
47 HWND hPerformancePage
; // Performance Property Page
49 HWND hPerformancePageCpuUsageGraph
; // CPU Usage Graph
50 HWND hPerformancePageMemUsageGraph
; // MEM Usage Graph
51 HWND hPerformancePageCpuUsageHistoryGraph
; // CPU Usage History Graph
52 HWND hPerformancePageMemUsageHistoryGraph
; // Memory Usage History Graph
54 HWND hPerformancePageTotalsFrame
; // Totals Frame
55 HWND hPerformancePageCommitChargeFrame
; // Commit Charge Frame
56 HWND hPerformancePageKernelMemoryFrame
; // Kernel Memory Frame
57 HWND hPerformancePagePhysicalMemoryFrame
; // Physical Memory Frame
59 HWND hPerformancePageCpuUsageFrame
;
60 HWND hPerformancePageMemUsageFrame
;
61 HWND hPerformancePageCpuUsageHistoryFrame
;
62 HWND hPerformancePageMemUsageHistoryFrame
;
64 HWND hPerformancePageCommitChargeTotalEdit
; // Commit Charge Total Edit Control
65 HWND hPerformancePageCommitChargeLimitEdit
; // Commit Charge Limit Edit Control
66 HWND hPerformancePageCommitChargePeakEdit
; // Commit Charge Peak Edit Control
68 HWND hPerformancePageKernelMemoryTotalEdit
; // Kernel Memory Total Edit Control
69 HWND hPerformancePageKernelMemoryPagedEdit
; // Kernel Memory Paged Edit Control
70 HWND hPerformancePageKernelMemoryNonPagedEdit
; // Kernel Memory NonPaged Edit Control
72 HWND hPerformancePagePhysicalMemoryTotalEdit
; // Physical Memory Total Edit Control
73 HWND hPerformancePagePhysicalMemoryAvailableEdit
; // Physical Memory Available Edit Control
74 HWND hPerformancePagePhysicalMemorySystemCacheEdit
; // Physical Memory System Cache Edit Control
76 HWND hPerformancePageTotalsHandleCountEdit
; // Total Handles Edit Control
77 HWND hPerformancePageTotalsProcessCountEdit
; // Total Processes Edit Control
78 HWND hPerformancePageTotalsThreadCountEdit
; // Total Threads Edit Control
81 static int nPerformancePageWidth
;
82 static int nPerformancePageHeight
;
84 static HANDLE hPerformancePageEvent
= NULL
; // When this event becomes signaled then we refresh the performance page
86 void PerformancePageRefreshThread(void *lpParameter
);
88 void AdjustFrameSize(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
, int pos
)
93 GetClientRect(hCntrl
, &rc
);
94 MapWindowPoints(hCntrl
, hDlg
, (LPPOINT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)));
98 sx
= rc
.right
- rc
.left
;
103 cy
+= nYDifference
/ 2;
109 cy
+= nYDifference
/ 2;
113 sy
= rc
.bottom
- rc
.top
+ nYDifference
/ 2;
114 SetWindowPos(hCntrl
, NULL
, cx
, cy
, sx
, sy
, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOZORDER
);
116 cx
= rc
.left
+ nXDifference
;
117 cy
= rc
.top
+ nYDifference
;
119 SetWindowPos(hCntrl
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
121 InvalidateRect(hCntrl
, NULL
, TRUE
);
124 void AdjustControlPostion(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
)
126 AdjustFrameSize(hCntrl
, hDlg
, nXDifference
, nYDifference
, 0);
129 void AdjustCntrlPos(int ctrl_id
, HWND hDlg
, int nXDifference
, int nYDifference
)
131 AdjustFrameSize(GetDlgItem(hDlg
, ctrl_id
), hDlg
, nXDifference
, nYDifference
, 0);
134 LRESULT CALLBACK
PerformancePageWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
147 // Save the width and height
148 GetClientRect(hDlg
, &rc
);
149 nPerformancePageWidth
= rc
.right
;
150 nPerformancePageHeight
= rc
.bottom
;
152 // Update window position
153 SetWindowPos(hDlg
, NULL
, 15, 30, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
156 // Get handles to all the controls
158 hPerformancePageTotalsFrame
= GetDlgItem(hDlg
, IDC_TOTALS_FRAME
);
159 hPerformancePageCommitChargeFrame
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_FRAME
);
160 hPerformancePageKernelMemoryFrame
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_FRAME
);
161 hPerformancePagePhysicalMemoryFrame
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_FRAME
);
163 hPerformancePageCpuUsageFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_FRAME
);
164 hPerformancePageMemUsageFrame
= GetDlgItem(hDlg
, IDC_MEM_USAGE_FRAME
);
165 hPerformancePageCpuUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_FRAME
);
166 hPerformancePageMemUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_MEMORY_USAGE_HISTORY_FRAME
);
168 hPerformancePageCommitChargeTotalEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_TOTAL
);
169 hPerformancePageCommitChargeLimitEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_LIMIT
);
170 hPerformancePageCommitChargePeakEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_PEAK
);
171 hPerformancePageKernelMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_TOTAL
);
172 hPerformancePageKernelMemoryPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_PAGED
);
173 hPerformancePageKernelMemoryNonPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_NONPAGED
);
174 hPerformancePagePhysicalMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_TOTAL
);
175 hPerformancePagePhysicalMemoryAvailableEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_AVAILABLE
);
176 hPerformancePagePhysicalMemorySystemCacheEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE
);
177 hPerformancePageTotalsHandleCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_HANDLE_COUNT
);
178 hPerformancePageTotalsProcessCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_PROCESS_COUNT
);
179 hPerformancePageTotalsThreadCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_THREAD_COUNT
);
181 hPerformancePageCpuUsageGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_GRAPH
);
182 hPerformancePageMemUsageGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_GRAPH
);
183 hPerformancePageMemUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
184 hPerformancePageCpuUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
186 GetClientRect(hPerformancePageCpuUsageHistoryGraph
, &rc
);
187 // create the control
188 //PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
189 PerformancePageCpuUsageHistoryGraph
.Create(hPerformancePageCpuUsageHistoryGraph
, hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
190 // customize the control
191 PerformancePageCpuUsageHistoryGraph
.SetRange(0.0, 100.0, 10) ;
192 // PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ;
193 // PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ;
194 // PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ;
195 // PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ;
196 // PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ;
197 PerformancePageCpuUsageHistoryGraph
.SetBackgroundColor(RGB(0, 0, 0)) ;
198 PerformancePageCpuUsageHistoryGraph
.SetGridColor(RGB(152, 205, 152)) ;
199 PerformancePageCpuUsageHistoryGraph
.SetPlotColor(0, RGB(255, 0, 0)) ;
200 PerformancePageCpuUsageHistoryGraph
.SetPlotColor(1, RGB(0, 255, 0)) ;
202 GetClientRect(hPerformancePageMemUsageHistoryGraph
, &rc
);
203 PerformancePageMemUsageHistoryGraph
.Create(hPerformancePageMemUsageHistoryGraph
, hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
204 PerformancePageMemUsageHistoryGraph
.SetRange(0.0, 100.0, 10) ;
205 PerformancePageMemUsageHistoryGraph
.SetBackgroundColor(RGB(0, 0, 0)) ;
206 PerformancePageMemUsageHistoryGraph
.SetGridColor(RGB(152, 215, 152)) ;
207 PerformancePageMemUsageHistoryGraph
.SetPlotColor(0, RGB(255, 255, 0)) ;
209 // Start our refresh thread
211 _beginthread(PerformancePageRefreshThread
, 0, NULL
);
214 // Subclass graph buttons
216 OldGraphWndProc
= SetWindowLong(hPerformancePageCpuUsageGraph
, GWL_WNDPROC
, (LONG
)Graph_WndProc
);
217 SetWindowLong(hPerformancePageMemUsageGraph
, GWL_WNDPROC
, (LONG
)Graph_WndProc
);
218 OldGraphCtrlWndProc
= SetWindowLong(hPerformancePageMemUsageHistoryGraph
, GWL_WNDPROC
, (LONG
)GraphCtrl_WndProc
);
219 SetWindowLong(hPerformancePageCpuUsageHistoryGraph
, GWL_WNDPROC
, (LONG
)GraphCtrl_WndProc
);
227 GetClientRect(hDlg
, &rc
);
228 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
229 ReleaseDC(hDlg
, hdc
);
233 hdc
= BeginPaint(hDlg
, &ps
);
234 GetClientRect(hDlg
, &rc
);
235 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
242 if (wParam
== SIZE_MINIMIZED
)
247 nXDifference
= cx
- nPerformancePageWidth
;
248 nYDifference
= cy
- nPerformancePageHeight
;
249 nPerformancePageWidth
= cx
;
250 nPerformancePageHeight
= cy
;
252 // Reposition the performance page's controls
253 AdjustFrameSize(hPerformancePageTotalsFrame
, hDlg
, 0, nYDifference
, 0);
254 AdjustFrameSize(hPerformancePageCommitChargeFrame
, hDlg
, 0, nYDifference
, 0);
255 AdjustFrameSize(hPerformancePageKernelMemoryFrame
, hDlg
, 0, nYDifference
, 0);
256 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame
, hDlg
, 0, nYDifference
, 0);
257 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL
, hDlg
, 0, nYDifference
);
258 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT
, hDlg
, 0, nYDifference
);
259 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK
, hDlg
, 0, nYDifference
);
260 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
261 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED
, hDlg
, 0, nYDifference
);
262 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED
, hDlg
, 0, nYDifference
);
263 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
264 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE
, hDlg
, 0, nYDifference
);
265 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
, hDlg
, 0, nYDifference
);
266 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT
, hDlg
, 0, nYDifference
);
267 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT
, hDlg
, 0, nYDifference
);
268 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT
, hDlg
, 0, nYDifference
);
270 AdjustControlPostion(hPerformancePageCommitChargeTotalEdit
, hDlg
, 0, nYDifference
);
271 AdjustControlPostion(hPerformancePageCommitChargeLimitEdit
, hDlg
, 0, nYDifference
);
272 AdjustControlPostion(hPerformancePageCommitChargePeakEdit
, hDlg
, 0, nYDifference
);
273 AdjustControlPostion(hPerformancePageKernelMemoryTotalEdit
, hDlg
, 0, nYDifference
);
274 AdjustControlPostion(hPerformancePageKernelMemoryPagedEdit
, hDlg
, 0, nYDifference
);
275 AdjustControlPostion(hPerformancePageKernelMemoryNonPagedEdit
, hDlg
, 0, nYDifference
);
276 AdjustControlPostion(hPerformancePagePhysicalMemoryTotalEdit
, hDlg
, 0, nYDifference
);
277 AdjustControlPostion(hPerformancePagePhysicalMemoryAvailableEdit
, hDlg
, 0, nYDifference
);
278 AdjustControlPostion(hPerformancePagePhysicalMemorySystemCacheEdit
, hDlg
, 0, nYDifference
);
279 AdjustControlPostion(hPerformancePageTotalsHandleCountEdit
, hDlg
, 0, nYDifference
);
280 AdjustControlPostion(hPerformancePageTotalsProcessCountEdit
, hDlg
, 0, nYDifference
);
281 AdjustControlPostion(hPerformancePageTotalsThreadCountEdit
, hDlg
, 0, nYDifference
);
283 static int lastX
, lastY
;
285 nXDifference
+= lastX
;
286 nYDifference
+= lastY
;
288 if (nXDifference
% 2) {
289 if (nXDifference
> 0) {
297 if (nYDifference
% 2) {
298 if (nYDifference
> 0) {
306 AdjustFrameSize(hPerformancePageCpuUsageFrame
, hDlg
, nXDifference
, nYDifference
, 1);
307 AdjustFrameSize(hPerformancePageMemUsageFrame
, hDlg
, nXDifference
, nYDifference
, 2);
308 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 3);
309 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 4);
310 AdjustFrameSize(hPerformancePageCpuUsageGraph
, hDlg
, nXDifference
, nYDifference
, 1);
311 AdjustFrameSize(hPerformancePageMemUsageGraph
, hDlg
, nXDifference
, nYDifference
, 2);
312 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 3);
313 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 4);
319 void RefreshPerformancePage(void)
321 // Signal the event so that our refresh thread
322 // will wake up and refresh the performance page
323 SetEvent(hPerformancePageEvent
);
326 void PerformancePageRefreshThread(void *lpParameter
)
328 ULONG CommitChargeTotal
;
329 ULONG CommitChargeLimit
;
330 ULONG CommitChargePeak
;
332 ULONG KernelMemoryTotal
;
333 ULONG KernelMemoryPaged
;
334 ULONG KernelMemoryNonPaged
;
336 ULONG PhysicalMemoryTotal
;
337 ULONG PhysicalMemoryAvailable
;
338 ULONG PhysicalMemorySystemCache
;
342 ULONG TotalProcesses
;
347 hPerformancePageEvent
= CreateEvent(NULL
, TRUE
, TRUE
, "Performance Page Event");
349 // If we couldn't create the event then exit the thread
350 if (!hPerformancePageEvent
)
358 dwWaitVal
= WaitForSingleObject(hPerformancePageEvent
, INFINITE
);
360 // If the wait failed then the event object must have been
361 // closed and the task manager is exiting so exit this thread
362 if (dwWaitVal
== WAIT_FAILED
)
365 if (dwWaitVal
== WAIT_OBJECT_0
)
368 ResetEvent(hPerformancePageEvent
);
371 // Update the commit charge info
373 CommitChargeTotal
= PerfDataGetCommitChargeTotalK();
374 CommitChargeLimit
= PerfDataGetCommitChargeLimitK();
375 CommitChargePeak
= PerfDataGetCommitChargePeakK();
376 _ultot(CommitChargeTotal
, Text
, 10);
377 SetWindowText(hPerformancePageCommitChargeTotalEdit
, Text
);
378 _ultot(CommitChargeLimit
, Text
, 10);
379 SetWindowText(hPerformancePageCommitChargeLimitEdit
, Text
);
380 _ultot(CommitChargePeak
, Text
, 10);
381 SetWindowText(hPerformancePageCommitChargePeakEdit
, Text
);
382 wsprintf(Text
, _T("Mem Usage: %dK / %dK"), CommitChargeTotal
, CommitChargeLimit
);
383 SendMessage(hStatusWnd
, SB_SETTEXT
, 2, (LPARAM
)Text
);
386 // Update the kernel memory info
388 KernelMemoryTotal
= PerfDataGetKernelMemoryTotalK();
389 KernelMemoryPaged
= PerfDataGetKernelMemoryPagedK();
390 KernelMemoryNonPaged
= PerfDataGetKernelMemoryNonPagedK();
391 _ultot(KernelMemoryTotal
, Text
, 10);
392 SetWindowText(hPerformancePageKernelMemoryTotalEdit
, Text
);
393 _ultot(KernelMemoryPaged
, Text
, 10);
394 SetWindowText(hPerformancePageKernelMemoryPagedEdit
, Text
);
395 _ultot(KernelMemoryNonPaged
, Text
, 10);
396 SetWindowText(hPerformancePageKernelMemoryNonPagedEdit
, Text
);
399 // Update the physical memory info
401 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
402 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
403 PhysicalMemorySystemCache
= PerfDataGetPhysicalMemorySystemCacheK();
404 _ultot(PhysicalMemoryTotal
, Text
, 10);
405 SetWindowText(hPerformancePagePhysicalMemoryTotalEdit
, Text
);
406 _ultot(PhysicalMemoryAvailable
, Text
, 10);
407 SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit
, Text
);
408 _ultot(PhysicalMemorySystemCache
, Text
, 10);
409 SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit
, Text
);
412 // Update the totals info
414 TotalHandles
= PerfDataGetSystemHandleCount();
415 TotalThreads
= PerfDataGetTotalThreadCount();
416 TotalProcesses
= PerfDataGetProcessCount();
417 _ultot(TotalHandles
, Text
, 10);
418 SetWindowText(hPerformancePageTotalsHandleCountEdit
, Text
);
419 _ultot(TotalThreads
, Text
, 10);
420 SetWindowText(hPerformancePageTotalsThreadCountEdit
, Text
);
421 _ultot(TotalProcesses
, Text
, 10);
422 SetWindowText(hPerformancePageTotalsProcessCountEdit
, Text
);
427 InvalidateRect(hPerformancePageCpuUsageGraph
, NULL
, FALSE
);
428 InvalidateRect(hPerformancePageMemUsageGraph
, NULL
, FALSE
);
433 ULONG CpuKernelUsage
;
434 ULONGLONG CommitChargeTotal
;
435 ULONGLONG CommitChargeLimit
;
436 ULONG PhysicalMemoryTotal
;
437 ULONG PhysicalMemoryAvailable
;
444 CpuUsage
= PerfDataGetProcessorUsage();
445 CpuKernelUsage
= PerfDataGetProcessorSystemUsage();
446 if (CpuUsage
< 0 ) CpuUsage
= 0;
447 if (CpuUsage
> 100) CpuUsage
= 100;
448 if (CpuKernelUsage
< 0) CpuKernelUsage
= 0;
449 if (CpuKernelUsage
> 100) CpuKernelUsage
= 100;
452 // Get the memory usage
454 CommitChargeTotal
= (ULONGLONG
)PerfDataGetCommitChargeTotalK();
455 CommitChargeLimit
= (ULONGLONG
)PerfDataGetCommitChargeLimitK();
456 nBarsUsed1
= ((CommitChargeTotal
* 100) / CommitChargeLimit
);
458 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
459 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
460 nBarsUsed2
= ((PhysicalMemoryAvailable
* 100) / PhysicalMemoryTotal
);
463 PerformancePageCpuUsageHistoryGraph
.AppendPoint(CpuUsage
, CpuKernelUsage
);
464 PerformancePageMemUsageHistoryGraph
.AppendPoint(nBarsUsed1
, nBarsUsed2
);
465 //PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ;
466 InvalidateRect(hPerformancePageMemUsageHistoryGraph
, NULL
, FALSE
);
467 InvalidateRect(hPerformancePageCpuUsageHistoryGraph
, NULL
, FALSE
);
472 void PerformancePage_OnViewShowKernelTimes(void)
477 hMenu
= GetMenu(hMainWnd
);
478 hViewMenu
= GetSubMenu(hMenu
, 2);
480 // Check or uncheck the show 16-bit tasks menu item
481 if (GetMenuState(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
) & MF_CHECKED
)
483 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_UNCHECKED
);
484 TaskManagerSettings
.ShowKernelTimes
= FALSE
;
488 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_CHECKED
);
489 TaskManagerSettings
.ShowKernelTimes
= TRUE
;
492 RefreshPerformancePage();
495 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
499 HMENU hCPUHistoryMenu
;
501 hMenu
= GetMenu(hMainWnd
);
502 hViewMenu
= GetSubMenu(hMenu
, 2);
503 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
505 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= FALSE
;
506 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, MF_BYCOMMAND
);
509 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
513 HMENU hCPUHistoryMenu
;
515 hMenu
= GetMenu(hMainWnd
);
516 hViewMenu
= GetSubMenu(hMenu
, 2);
517 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
519 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= TRUE
;
520 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, MF_BYCOMMAND
);