6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * Copyright (C) 2008 Vladimir Pankratov
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/unicode.h"
36 TGraphCtrl PerformancePageCpuUsageHistoryGraph
;
37 TGraphCtrl PerformancePageMemUsageHistoryGraph
;
39 HWND hPerformancePage
; /* Performance Property Page */
40 HWND hPerformancePageCpuUsageGraph
; /* CPU Usage Graph */
41 HWND hPerformancePageMemUsageGraph
; /* MEM Usage Graph */
42 HWND hPerformancePageCpuUsageHistoryGraph
; /* CPU Usage History Graph */
43 HWND hPerformancePageMemUsageHistoryGraph
; /* Memory Usage History Graph */
44 HWND hPerformancePageTotalsFrame
; /* Totals Frame */
45 HWND hPerformancePageCommitChargeFrame
; /* Commit Charge Frame */
46 HWND hPerformancePageKernelMemoryFrame
; /* Kernel Memory Frame */
47 HWND hPerformancePagePhysicalMemoryFrame
; /* Physical Memory Frame */
48 HWND hPerformancePageCpuUsageFrame
;
49 HWND hPerformancePageMemUsageFrame
;
50 HWND hPerformancePageCpuUsageHistoryFrame
;
51 HWND hPerformancePageMemUsageHistoryFrame
;
52 HWND hPerformancePageCommitChargeTotalEdit
; /* Commit Charge Total Edit Control */
53 HWND hPerformancePageCommitChargeLimitEdit
; /* Commit Charge Limit Edit Control */
54 HWND hPerformancePageCommitChargePeakEdit
; /* Commit Charge Peak Edit Control */
55 HWND hPerformancePageKernelMemoryTotalEdit
; /* Kernel Memory Total Edit Control */
56 HWND hPerformancePageKernelMemoryPagedEdit
; /* Kernel Memory Paged Edit Control */
57 HWND hPerformancePageKernelMemoryNonPagedEdit
; /* Kernel Memory NonPaged Edit Control */
58 HWND hPerformancePagePhysicalMemoryTotalEdit
; /* Physical Memory Total Edit Control */
59 HWND hPerformancePagePhysicalMemoryAvailableEdit
; /* Physical Memory Available Edit Control */
60 HWND hPerformancePagePhysicalMemorySystemCacheEdit
; /* Physical Memory System Cache Edit Control */
61 HWND hPerformancePageTotalsHandleCountEdit
; /* Total Handles Edit Control */
62 HWND hPerformancePageTotalsProcessCountEdit
; /* Total Processes Edit Control */
63 HWND hPerformancePageTotalsThreadCountEdit
; /* Total Threads Edit Control */
66 static int nPerformancePageWidth
;
67 static int nPerformancePageHeight
;
68 static HANDLE hPerformancePageEvent
= NULL
; /* When this event becomes signaled then we refresh the performance page */
70 static void AdjustFrameSize(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
, int pos
)
75 GetClientRect(hCntrl
, &rc
);
76 MapWindowPoints(hCntrl
, hDlg
, (LPPOINT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)));
80 sx
= rc
.right
- rc
.left
;
85 cy
+= nYDifference
/ 2;
91 cy
+= nYDifference
/ 2;
95 sy
= rc
.bottom
- rc
.top
+ nYDifference
/ 2;
96 SetWindowPos(hCntrl
, NULL
, cx
, cy
, sx
, sy
, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOZORDER
);
98 cx
= rc
.left
+ nXDifference
;
99 cy
= rc
.top
+ nYDifference
;
100 SetWindowPos(hCntrl
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
102 InvalidateRect(hCntrl
, NULL
, TRUE
);
105 static void AdjustControlPosition(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
)
107 AdjustFrameSize(hCntrl
, hDlg
, nXDifference
, nYDifference
, 0);
110 static void AdjustCntrlPos(int ctrl_id
, HWND hDlg
, int nXDifference
, int nYDifference
)
112 AdjustFrameSize(GetDlgItem(hDlg
, ctrl_id
), hDlg
, nXDifference
, nYDifference
, 0);
114 void RefreshPerformancePage(void)
116 /* Signal the event so that our refresh thread */
117 /* will wake up and refresh the performance page */
118 SetEvent(hPerformancePageEvent
);
121 static DWORD WINAPI
PerformancePageRefreshThread(void *lpParameter
)
123 ULONG CommitChargeTotal
;
124 ULONG CommitChargeLimit
;
125 ULONG CommitChargePeak
;
127 ULONG KernelMemoryTotal
;
128 ULONG KernelMemoryPaged
;
129 ULONG KernelMemoryNonPaged
;
131 ULONG PhysicalMemoryTotal
;
132 ULONG PhysicalMemoryAvailable
;
133 ULONG PhysicalMemorySystemCache
;
137 ULONG TotalProcesses
;
141 static const WCHAR wszFormatDigit
[] = {'%','u',0};
142 WCHAR wszMemUsage
[255];
144 LoadStringW(hInst
, IDS_STATUS_BAR_MEMORY_USAGE
, wszMemUsage
, sizeof(wszMemUsage
)/sizeof(WCHAR
));
146 /* Create the event */
147 hPerformancePageEvent
= CreateEventW(NULL
, TRUE
, TRUE
, NULL
);
149 /* If we couldn't create the event then exit the thread */
150 if (!hPerformancePageEvent
)
157 /* Wait on the event */
158 dwWaitVal
= WaitForSingleObject(hPerformancePageEvent
, INFINITE
);
160 /* If the wait failed then the event object must have been */
161 /* closed and the task manager is exiting so exit this thread */
162 if (dwWaitVal
== WAIT_FAILED
)
165 if (dwWaitVal
== WAIT_OBJECT_0
)
168 ULONG CpuKernelUsage
;
169 int nBarsUsed1
, nBarsUsed2
;
172 /* Reset our event */
173 ResetEvent(hPerformancePageEvent
);
176 * Update the commit charge info
178 CommitChargeTotal
= PerfDataGetCommitChargeTotalK();
179 CommitChargeLimit
= PerfDataGetCommitChargeLimitK();
180 CommitChargePeak
= PerfDataGetCommitChargePeakK();
181 wsprintfW(Text
, wszFormatDigit
, CommitChargeTotal
);
182 SetWindowTextW(hPerformancePageCommitChargeTotalEdit
, Text
);
183 wsprintfW(Text
, wszFormatDigit
, CommitChargeLimit
);
184 SetWindowTextW(hPerformancePageCommitChargeLimitEdit
, Text
);
185 wsprintfW(Text
, wszFormatDigit
, CommitChargePeak
);
187 SetWindowTextW(hPerformancePageCommitChargePeakEdit
, Text
);
189 args
[0] = CommitChargeTotal
;
190 args
[1] = CommitChargeLimit
;
191 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
|FORMAT_MESSAGE_ARGUMENT_ARRAY
,
192 wszMemUsage
, 0, 0, Text
,
193 sizeof(Text
)/sizeof(*Text
), (__ms_va_list
*)args
);
194 SendMessageW(hStatusWnd
, SB_SETTEXTW
, 2, (LPARAM
)Text
);
197 * Update the kernel memory info
199 KernelMemoryTotal
= PerfDataGetKernelMemoryTotalK();
200 KernelMemoryPaged
= PerfDataGetKernelMemoryPagedK();
201 KernelMemoryNonPaged
= PerfDataGetKernelMemoryNonPagedK();
202 wsprintfW(Text
, wszFormatDigit
, KernelMemoryTotal
);
203 SetWindowTextW(hPerformancePageKernelMemoryTotalEdit
, Text
);
204 wsprintfW(Text
, wszFormatDigit
, KernelMemoryPaged
);
205 SetWindowTextW(hPerformancePageKernelMemoryPagedEdit
, Text
);
206 wsprintfW(Text
, wszFormatDigit
, KernelMemoryNonPaged
);
207 SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit
, Text
);
210 * Update the physical memory info
212 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
213 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
214 PhysicalMemorySystemCache
= PerfDataGetPhysicalMemorySystemCacheK();
215 wsprintfW(Text
, wszFormatDigit
, PhysicalMemoryTotal
);
216 SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit
, Text
);
217 wsprintfW(Text
, wszFormatDigit
, PhysicalMemoryAvailable
);
218 SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit
, Text
);
219 wsprintfW(Text
, wszFormatDigit
, PhysicalMemorySystemCache
);
220 SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit
, Text
);
223 * Update the totals info
225 TotalHandles
= PerfDataGetSystemHandleCount();
226 TotalThreads
= PerfDataGetTotalThreadCount();
227 TotalProcesses
= PerfDataGetProcessCount();
228 wsprintfW(Text
, wszFormatDigit
, TotalHandles
);
229 SetWindowTextW(hPerformancePageTotalsHandleCountEdit
, Text
);
230 wsprintfW(Text
, wszFormatDigit
, TotalThreads
);
231 SetWindowTextW(hPerformancePageTotalsThreadCountEdit
, Text
);
232 wsprintfW(Text
, wszFormatDigit
, TotalProcesses
);
233 SetWindowTextW(hPerformancePageTotalsProcessCountEdit
, Text
);
238 InvalidateRect(hPerformancePageCpuUsageGraph
, NULL
, FALSE
);
239 InvalidateRect(hPerformancePageMemUsageGraph
, NULL
, FALSE
);
244 CpuUsage
= PerfDataGetProcessorUsage();
245 CpuKernelUsage
= PerfDataGetProcessorSystemUsage();
248 * Get the memory usage
250 CommitChargeTotal
= (ULONGLONG
)PerfDataGetCommitChargeTotalK();
251 CommitChargeLimit
= (ULONGLONG
)PerfDataGetCommitChargeLimitK();
252 nBarsUsed1
= CommitChargeLimit
? ((CommitChargeTotal
* 100) / CommitChargeLimit
) : 0;
254 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
255 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
256 nBarsUsed2
= PhysicalMemoryTotal
? ((PhysicalMemoryAvailable
* 100) / PhysicalMemoryTotal
) : 0;
259 GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph
, CpuUsage
, CpuKernelUsage
, 0.0, 0.0);
260 GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph
, nBarsUsed1
, nBarsUsed2
, 0.0, 0.0);
261 /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
262 InvalidateRect(hPerformancePageMemUsageHistoryGraph
, NULL
, FALSE
);
263 InvalidateRect(hPerformancePageCpuUsageHistoryGraph
, NULL
, FALSE
);
270 PerformancePageWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
279 /* Save the width and height */
280 GetClientRect(hDlg
, &rc
);
281 nPerformancePageWidth
= rc
.right
;
282 nPerformancePageHeight
= rc
.bottom
;
284 /* Update window position */
285 SetWindowPos(hDlg
, NULL
, 15, 30, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
288 * Get handles to all the controls
290 hPerformancePageTotalsFrame
= GetDlgItem(hDlg
, IDC_TOTALS_FRAME
);
291 hPerformancePageCommitChargeFrame
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_FRAME
);
292 hPerformancePageKernelMemoryFrame
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_FRAME
);
293 hPerformancePagePhysicalMemoryFrame
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_FRAME
);
295 hPerformancePageCpuUsageFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_FRAME
);
296 hPerformancePageMemUsageFrame
= GetDlgItem(hDlg
, IDC_MEM_USAGE_FRAME
);
297 hPerformancePageCpuUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_FRAME
);
298 hPerformancePageMemUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_MEMORY_USAGE_HISTORY_FRAME
);
300 hPerformancePageCommitChargeTotalEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_TOTAL
);
301 hPerformancePageCommitChargeLimitEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_LIMIT
);
302 hPerformancePageCommitChargePeakEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_PEAK
);
303 hPerformancePageKernelMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_TOTAL
);
304 hPerformancePageKernelMemoryPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_PAGED
);
305 hPerformancePageKernelMemoryNonPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_NONPAGED
);
306 hPerformancePagePhysicalMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_TOTAL
);
307 hPerformancePagePhysicalMemoryAvailableEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_AVAILABLE
);
308 hPerformancePagePhysicalMemorySystemCacheEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE
);
309 hPerformancePageTotalsHandleCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_HANDLE_COUNT
);
310 hPerformancePageTotalsProcessCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_PROCESS_COUNT
);
311 hPerformancePageTotalsThreadCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_THREAD_COUNT
);
313 hPerformancePageCpuUsageGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_GRAPH
);
314 hPerformancePageMemUsageGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_GRAPH
);
315 hPerformancePageMemUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
316 hPerformancePageCpuUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
318 GetClientRect(hPerformancePageCpuUsageHistoryGraph
, &rc
);
319 /* create the control */
320 /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
321 GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph
, hPerformancePageCpuUsageHistoryGraph
, hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
322 /* customize the control */
323 GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph
, 0.0, 100.0, 10);
324 GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph
, RGB(0, 0, 0)) ;
325 GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph
, RGB(152, 205, 152)) ;
326 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 0, RGB(255, 0, 0)) ;
327 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 1, RGB(0, 255, 0)) ;
329 GetClientRect(hPerformancePageMemUsageHistoryGraph
, &rc
);
330 GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph
, hPerformancePageMemUsageHistoryGraph
, hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
331 GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph
, 0.0, 100.0, 10) ;
332 GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph
, RGB(0, 0, 0)) ;
333 GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph
, RGB(152, 215, 152)) ;
334 GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph
, 0, RGB(255, 255, 0)) ;
335 /* Start our refresh thread */
337 CloseHandle( CreateThread(NULL
, 0, PerformancePageRefreshThread
, NULL
, 0, NULL
));
341 * Subclass graph buttons
343 OldGraphWndProc
= (WNDPROC
)SetWindowLongPtrW(hPerformancePageCpuUsageGraph
, GWLP_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
344 SetWindowLongPtrW(hPerformancePageMemUsageGraph
, GWLP_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
345 OldGraphCtrlWndProc
= (WNDPROC
)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph
, GWLP_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
346 SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph
, GWLP_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
356 if (wParam
== SIZE_MINIMIZED
)
361 nXDifference
= cx
- nPerformancePageWidth
;
362 nYDifference
= cy
- nPerformancePageHeight
;
363 nPerformancePageWidth
= cx
;
364 nPerformancePageHeight
= cy
;
367 /* Reposition the performance page's controls */
368 AdjustFrameSize(hPerformancePageTotalsFrame
, hDlg
, 0, nYDifference
, 0);
369 AdjustFrameSize(hPerformancePageCommitChargeFrame
, hDlg
, 0, nYDifference
, 0);
370 AdjustFrameSize(hPerformancePageKernelMemoryFrame
, hDlg
, 0, nYDifference
, 0);
371 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame
, hDlg
, 0, nYDifference
, 0);
372 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL
, hDlg
, 0, nYDifference
);
373 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT
, hDlg
, 0, nYDifference
);
374 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK
, hDlg
, 0, nYDifference
);
375 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
376 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED
, hDlg
, 0, nYDifference
);
377 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED
, hDlg
, 0, nYDifference
);
378 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
379 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE
, hDlg
, 0, nYDifference
);
380 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
, hDlg
, 0, nYDifference
);
381 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT
, hDlg
, 0, nYDifference
);
382 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT
, hDlg
, 0, nYDifference
);
383 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT
, hDlg
, 0, nYDifference
);
385 AdjustControlPosition(hPerformancePageCommitChargeTotalEdit
, hDlg
, 0, nYDifference
);
386 AdjustControlPosition(hPerformancePageCommitChargeLimitEdit
, hDlg
, 0, nYDifference
);
387 AdjustControlPosition(hPerformancePageCommitChargePeakEdit
, hDlg
, 0, nYDifference
);
388 AdjustControlPosition(hPerformancePageKernelMemoryTotalEdit
, hDlg
, 0, nYDifference
);
389 AdjustControlPosition(hPerformancePageKernelMemoryPagedEdit
, hDlg
, 0, nYDifference
);
390 AdjustControlPosition(hPerformancePageKernelMemoryNonPagedEdit
, hDlg
, 0, nYDifference
);
391 AdjustControlPosition(hPerformancePagePhysicalMemoryTotalEdit
, hDlg
, 0, nYDifference
);
392 AdjustControlPosition(hPerformancePagePhysicalMemoryAvailableEdit
, hDlg
, 0, nYDifference
);
393 AdjustControlPosition(hPerformancePagePhysicalMemorySystemCacheEdit
, hDlg
, 0, nYDifference
);
394 AdjustControlPosition(hPerformancePageTotalsHandleCountEdit
, hDlg
, 0, nYDifference
);
395 AdjustControlPosition(hPerformancePageTotalsProcessCountEdit
, hDlg
, 0, nYDifference
);
396 AdjustControlPosition(hPerformancePageTotalsThreadCountEdit
, hDlg
, 0, nYDifference
);
399 static int lastX
, lastY
;
401 nXDifference
+= lastX
;
402 nYDifference
+= lastY
;
404 if (nXDifference
% 2) {
405 if (nXDifference
> 0) {
413 if (nYDifference
% 2) {
414 if (nYDifference
> 0) {
424 AdjustFrameSize(hPerformancePageCpuUsageFrame
, hDlg
, nXDifference
, nYDifference
, 1);
425 AdjustFrameSize(hPerformancePageMemUsageFrame
, hDlg
, nXDifference
, nYDifference
, 2);
426 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 3);
427 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 4);
428 AdjustFrameSize(hPerformancePageCpuUsageGraph
, hDlg
, nXDifference
, nYDifference
, 1);
429 AdjustFrameSize(hPerformancePageMemUsageGraph
, hDlg
, nXDifference
, nYDifference
, 2);
430 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 3);
431 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 4);
437 void PerformancePage_OnViewShowKernelTimes(void)
442 hMenu
= GetMenu(hMainWnd
);
443 hViewMenu
= GetSubMenu(hMenu
, 2);
445 /* Check or uncheck the show 16-bit tasks menu item */
446 if (GetMenuState(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
) & MF_CHECKED
)
448 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_UNCHECKED
);
449 TaskManagerSettings
.ShowKernelTimes
= FALSE
;
453 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_CHECKED
);
454 TaskManagerSettings
.ShowKernelTimes
= TRUE
;
457 RefreshPerformancePage();
460 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
464 HMENU hCPUHistoryMenu
;
466 hMenu
= GetMenu(hMainWnd
);
467 hViewMenu
= GetSubMenu(hMenu
, 2);
468 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
470 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= FALSE
;
471 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, MF_BYCOMMAND
);
474 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
478 HMENU hCPUHistoryMenu
;
480 hMenu
= GetMenu(hMainWnd
);
481 hViewMenu
= GetSubMenu(hMenu
, 2);
482 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
484 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= TRUE
;
485 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, MF_BYCOMMAND
);