wineoss: Fix missing break statement.
[wine.git] / programs / taskmgr / perfpage.c
blob4689d4e3312f0e4d0694d3616fd34a6ab9e00df7
1 /*
2 * ReactOS Task Manager
4 * perfpage.c
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
24 #include <stdio.h>
25 #include <stdlib.h>
27 #include <windows.h>
28 #include <commctrl.h>
29 #include <winnt.h>
31 #include "taskmgr.h"
32 #include "perfdata.h"
33 #include "graphctl.h"
35 TGraphCtrl PerformancePageCpuUsageHistoryGraph;
36 TGraphCtrl PerformancePageMemUsageHistoryGraph;
38 HWND hPerformancePage; /* Performance Property Page */
39 HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
40 HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
41 HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
42 HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
43 HWND hPerformancePageTotalsFrame; /* Totals Frame */
44 HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
45 HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
46 HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
47 HWND hPerformancePageCpuUsageFrame;
48 HWND hPerformancePageMemUsageFrame;
49 HWND hPerformancePageCpuUsageHistoryFrame;
50 HWND hPerformancePageMemUsageHistoryFrame;
51 HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
52 HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
53 HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
54 HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
55 HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
56 HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
57 HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
58 HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
59 HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
60 HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
61 HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
62 HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
65 static int nPerformancePageWidth;
66 static int nPerformancePageHeight;
67 static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
69 static void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
71 RECT rc;
72 int cx, cy, sx, sy;
74 GetClientRect(hCntrl, &rc);
75 MapWindowPoints(hCntrl, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)));
76 if (pos) {
77 cx = rc.left;
78 cy = rc.top;
79 sx = rc.right - rc.left;
80 switch (pos) {
81 case 1:
82 break;
83 case 2:
84 cy += nYDifference / 2;
85 break;
86 case 3:
87 sx += nXDifference;
88 break;
89 case 4:
90 cy += nYDifference / 2;
91 sx += nXDifference;
92 break;
94 sy = rc.bottom - rc.top + nYDifference / 2;
95 SetWindowPos(hCntrl, NULL, cx, cy, sx, sy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER);
96 } else {
97 cx = rc.left + nXDifference;
98 cy = rc.top + nYDifference;
99 SetWindowPos(hCntrl, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
101 InvalidateRect(hCntrl, NULL, TRUE);
104 static void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
106 AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
109 static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
111 AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
113 void RefreshPerformancePage(void)
115 /* Signal the event so that our refresh thread */
116 /* will wake up and refresh the performance page */
117 SetEvent(hPerformancePageEvent);
120 static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
122 ULONG CommitChargeTotal;
123 ULONG CommitChargeLimit;
124 ULONG CommitChargePeak;
126 ULONG KernelMemoryTotal;
127 ULONG KernelMemoryPaged;
128 ULONG KernelMemoryNonPaged;
130 ULONG PhysicalMemoryTotal;
131 ULONG PhysicalMemoryAvailable;
132 ULONG PhysicalMemorySystemCache;
134 ULONG TotalHandles;
135 ULONG TotalThreads;
136 ULONG TotalProcesses;
138 WCHAR Text[256];
140 static const WCHAR wszFormatDigit[] = {'%','u',0};
141 WCHAR wszMemUsage[255];
143 LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
145 /* Create the event */
146 hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
148 /* If we couldn't create the event then exit the thread */
149 if (!hPerformancePageEvent)
150 return 0;
152 while (1)
154 DWORD dwWaitVal;
156 /* Wait on the event */
157 dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
159 /* If the wait failed then the event object must have been */
160 /* closed and the task manager is exiting so exit this thread */
161 if (dwWaitVal == WAIT_FAILED)
162 return 0;
164 if (dwWaitVal == WAIT_OBJECT_0)
166 ULONG CpuUsage;
167 ULONG CpuKernelUsage;
168 int nBarsUsed1, nBarsUsed2;
169 DWORD_PTR args[2];
171 /* Reset our event */
172 ResetEvent(hPerformancePageEvent);
175 * Update the commit charge info
177 CommitChargeTotal = PerfDataGetCommitChargeTotalK();
178 CommitChargeLimit = PerfDataGetCommitChargeLimitK();
179 CommitChargePeak = PerfDataGetCommitChargePeakK();
180 wsprintfW(Text, wszFormatDigit, CommitChargeTotal);
181 SetWindowTextW(hPerformancePageCommitChargeTotalEdit, Text);
182 wsprintfW(Text, wszFormatDigit, CommitChargeLimit);
183 SetWindowTextW(hPerformancePageCommitChargeLimitEdit, Text);
184 wsprintfW(Text, wszFormatDigit, CommitChargePeak);
186 SetWindowTextW(hPerformancePageCommitChargePeakEdit, Text);
188 args[0] = CommitChargeTotal;
189 args[1] = CommitChargeLimit;
190 FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
191 wszMemUsage, 0, 0, Text,
192 ARRAY_SIZE(Text), (__ms_va_list*)args);
193 SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
196 * Update the kernel memory info
198 KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
199 KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
200 KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
201 wsprintfW(Text, wszFormatDigit, KernelMemoryTotal);
202 SetWindowTextW(hPerformancePageKernelMemoryTotalEdit, Text);
203 wsprintfW(Text, wszFormatDigit, KernelMemoryPaged);
204 SetWindowTextW(hPerformancePageKernelMemoryPagedEdit, Text);
205 wsprintfW(Text, wszFormatDigit, KernelMemoryNonPaged);
206 SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit, Text);
209 * Update the physical memory info
211 PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
212 PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
213 PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
214 wsprintfW(Text, wszFormatDigit, PhysicalMemoryTotal);
215 SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit, Text);
216 wsprintfW(Text, wszFormatDigit, PhysicalMemoryAvailable);
217 SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit, Text);
218 wsprintfW(Text, wszFormatDigit, PhysicalMemorySystemCache);
219 SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
222 * Update the totals info
224 TotalHandles = PerfDataGetSystemHandleCount();
225 TotalThreads = PerfDataGetTotalThreadCount();
226 TotalProcesses = PerfDataGetProcessCount();
227 wsprintfW(Text, wszFormatDigit, TotalHandles);
228 SetWindowTextW(hPerformancePageTotalsHandleCountEdit, Text);
229 wsprintfW(Text, wszFormatDigit, TotalThreads);
230 SetWindowTextW(hPerformancePageTotalsThreadCountEdit, Text);
231 wsprintfW(Text, wszFormatDigit, TotalProcesses);
232 SetWindowTextW(hPerformancePageTotalsProcessCountEdit, Text);
235 * Redraw the graphs
237 InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
238 InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
241 * Get the CPU usage
243 CpuUsage = PerfDataGetProcessorUsage();
244 CpuKernelUsage = PerfDataGetProcessorSystemUsage();
247 * Get the memory usage
249 CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
250 CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
251 nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
253 PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
254 PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
255 nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
258 GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
259 GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
260 /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
261 InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
262 InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
265 return 0;
268 INT_PTR CALLBACK
269 PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
271 RECT rc;
272 int nXDifference;
273 int nYDifference;
275 switch (message) {
276 case WM_INITDIALOG:
278 /* Save the width and height */
279 GetClientRect(hDlg, &rc);
280 nPerformancePageWidth = rc.right;
281 nPerformancePageHeight = rc.bottom;
283 /* Update window position */
284 SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
287 * Get handles to all the controls
289 hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
290 hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
291 hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
292 hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
294 hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
295 hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
296 hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
297 hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME);
299 hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
300 hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
301 hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
302 hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
303 hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
304 hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
305 hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
306 hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
307 hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
308 hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
309 hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
310 hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
312 hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
313 hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
314 hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
315 hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
317 GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
318 /* create the control */
319 /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
320 GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
321 /* customize the control */
322 GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10);
323 GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ;
324 GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ;
325 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ;
326 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 1, RGB(0, 255, 0)) ;
328 GetClientRect(hPerformancePageMemUsageHistoryGraph, &rc);
329 GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
330 GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph, 0.0, 100.0, 10) ;
331 GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ;
332 GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ;
333 GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
334 /* Start our refresh thread */
335 #ifdef RUN_PERF_PAGE
336 CloseHandle( CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL));
337 #endif
340 * Subclass graph buttons
342 OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
343 SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
344 OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
345 SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
346 return TRUE;
348 case WM_COMMAND:
349 break;
351 case WM_SIZE:
352 do {
353 int cx, cy;
355 if (wParam == SIZE_MINIMIZED)
356 return 0;
358 cx = LOWORD(lParam);
359 cy = HIWORD(lParam);
360 nXDifference = cx - nPerformancePageWidth;
361 nYDifference = cy - nPerformancePageHeight;
362 nPerformancePageWidth = cx;
363 nPerformancePageHeight = cy;
364 } while (0);
366 /* Reposition the performance page's controls */
367 AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
368 AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
369 AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
370 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
371 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
372 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
373 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
374 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
375 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
376 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
377 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
378 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
379 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
380 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
381 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
382 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
384 AdjustControlPosition(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference);
385 AdjustControlPosition(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference);
386 AdjustControlPosition(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference);
387 AdjustControlPosition(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference);
388 AdjustControlPosition(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference);
389 AdjustControlPosition(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
390 AdjustControlPosition(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
391 AdjustControlPosition(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
392 AdjustControlPosition(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
393 AdjustControlPosition(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference);
394 AdjustControlPosition(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
395 AdjustControlPosition(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
398 static int lastX, lastY;
400 nXDifference += lastX;
401 nYDifference += lastY;
402 lastX = lastY = 0;
403 if (nXDifference % 2) {
404 if (nXDifference > 0) {
405 nXDifference--;
406 lastX++;
407 } else {
408 nXDifference++;
409 lastX--;
412 if (nYDifference % 2) {
413 if (nYDifference > 0) {
414 nYDifference--;
415 lastY++;
416 } else {
417 nYDifference++;
418 lastY--;
423 AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
424 AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
425 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
426 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
427 AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
428 AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
429 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
430 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
431 break;
433 return 0;
436 void PerformancePage_OnViewShowKernelTimes(void)
438 HMENU hMenu;
439 HMENU hViewMenu;
441 hMenu = GetMenu(hMainWnd);
442 hViewMenu = GetSubMenu(hMenu, 2);
444 /* Check or uncheck the show 16-bit tasks menu item */
445 if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
447 CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
448 TaskManagerSettings.ShowKernelTimes = FALSE;
450 else
452 CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
453 TaskManagerSettings.ShowKernelTimes = TRUE;
456 RefreshPerformancePage();
459 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
461 HMENU hMenu;
462 HMENU hViewMenu;
463 HMENU hCPUHistoryMenu;
465 hMenu = GetMenu(hMainWnd);
466 hViewMenu = GetSubMenu(hMenu, 2);
467 hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
469 TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
470 CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
473 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
475 HMENU hMenu;
476 HMENU hViewMenu;
477 HMENU hCPUHistoryMenu;
479 hMenu = GetMenu(hMainWnd);
480 hViewMenu = GetSubMenu(hMenu, 2);
481 hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
483 TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
484 CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);