dmsynth: Implement IDirectMusicSynth_(Download|Unload) for waves.
[wine.git] / programs / taskmgr / perfpage.c
blob505846e3b4fb6be26b57d0d12af1b5af6e619832
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, ARRAY_SIZE(Text), (va_list *)args);
192 SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
195 * Update the kernel memory info
197 KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
198 KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
199 KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
200 wsprintfW(Text, wszFormatDigit, KernelMemoryTotal);
201 SetWindowTextW(hPerformancePageKernelMemoryTotalEdit, Text);
202 wsprintfW(Text, wszFormatDigit, KernelMemoryPaged);
203 SetWindowTextW(hPerformancePageKernelMemoryPagedEdit, Text);
204 wsprintfW(Text, wszFormatDigit, KernelMemoryNonPaged);
205 SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit, Text);
208 * Update the physical memory info
210 PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
211 PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
212 PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
213 wsprintfW(Text, wszFormatDigit, PhysicalMemoryTotal);
214 SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit, Text);
215 wsprintfW(Text, wszFormatDigit, PhysicalMemoryAvailable);
216 SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit, Text);
217 wsprintfW(Text, wszFormatDigit, PhysicalMemorySystemCache);
218 SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
221 * Update the totals info
223 TotalHandles = PerfDataGetSystemHandleCount();
224 TotalThreads = PerfDataGetTotalThreadCount();
225 TotalProcesses = PerfDataGetProcessCount();
226 wsprintfW(Text, wszFormatDigit, TotalHandles);
227 SetWindowTextW(hPerformancePageTotalsHandleCountEdit, Text);
228 wsprintfW(Text, wszFormatDigit, TotalThreads);
229 SetWindowTextW(hPerformancePageTotalsThreadCountEdit, Text);
230 wsprintfW(Text, wszFormatDigit, TotalProcesses);
231 SetWindowTextW(hPerformancePageTotalsProcessCountEdit, Text);
234 * Redraw the graphs
236 InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
237 InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
240 * Get the CPU usage
242 CpuUsage = PerfDataGetProcessorUsage();
243 CpuKernelUsage = PerfDataGetProcessorSystemUsage();
246 * Get the memory usage
248 CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
249 CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
250 nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
252 PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
253 PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
254 nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
257 GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
258 GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
259 /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
260 InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
261 InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
264 return 0;
267 INT_PTR CALLBACK
268 PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
270 RECT rc;
271 int nXDifference;
272 int nYDifference;
274 switch (message) {
275 case WM_INITDIALOG:
277 /* Save the width and height */
278 GetClientRect(hDlg, &rc);
279 nPerformancePageWidth = rc.right;
280 nPerformancePageHeight = rc.bottom;
282 /* Update window position */
283 SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
286 * Get handles to all the controls
288 hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
289 hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
290 hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
291 hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
293 hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
294 hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
295 hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
296 hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME);
298 hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
299 hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
300 hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
301 hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
302 hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
303 hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
304 hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
305 hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
306 hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
307 hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
308 hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
309 hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
311 hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
312 hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
313 hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
314 hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
316 GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
317 /* create the control */
318 /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
319 GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
320 /* customize the control */
321 GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10);
322 GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ;
323 GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ;
324 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ;
325 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 1, RGB(0, 255, 0)) ;
327 GetClientRect(hPerformancePageMemUsageHistoryGraph, &rc);
328 GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
329 GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph, 0.0, 100.0, 10) ;
330 GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ;
331 GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ;
332 GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
333 /* Start our refresh thread */
334 #ifdef RUN_PERF_PAGE
335 CloseHandle( CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL));
336 #endif
339 * Subclass graph buttons
341 OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
342 SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
343 OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
344 SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
345 return TRUE;
347 case WM_COMMAND:
348 break;
350 case WM_SIZE:
351 do {
352 int cx, cy;
354 if (wParam == SIZE_MINIMIZED)
355 return 0;
357 cx = LOWORD(lParam);
358 cy = HIWORD(lParam);
359 nXDifference = cx - nPerformancePageWidth;
360 nYDifference = cy - nPerformancePageHeight;
361 nPerformancePageWidth = cx;
362 nPerformancePageHeight = cy;
363 } while (0);
365 /* Reposition the performance page's controls */
366 AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
367 AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
368 AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
369 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
370 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
371 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
372 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
373 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
374 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
375 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
376 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
377 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
378 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
379 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
380 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
381 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
383 AdjustControlPosition(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference);
384 AdjustControlPosition(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference);
385 AdjustControlPosition(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference);
386 AdjustControlPosition(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference);
387 AdjustControlPosition(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference);
388 AdjustControlPosition(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
389 AdjustControlPosition(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
390 AdjustControlPosition(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
391 AdjustControlPosition(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
392 AdjustControlPosition(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference);
393 AdjustControlPosition(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
394 AdjustControlPosition(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
397 static int lastX, lastY;
399 nXDifference += lastX;
400 nYDifference += lastY;
401 lastX = lastY = 0;
402 if (nXDifference % 2) {
403 if (nXDifference > 0) {
404 nXDifference--;
405 lastX++;
406 } else {
407 nXDifference++;
408 lastX--;
411 if (nYDifference % 2) {
412 if (nYDifference > 0) {
413 nYDifference--;
414 lastY++;
415 } else {
416 nYDifference++;
417 lastY--;
422 AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
423 AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
424 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
425 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
426 AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
427 AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
428 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
429 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
430 break;
432 return 0;
435 void PerformancePage_OnViewShowKernelTimes(void)
437 HMENU hMenu;
438 HMENU hViewMenu;
440 hMenu = GetMenu(hMainWnd);
441 hViewMenu = GetSubMenu(hMenu, 2);
443 /* Check or uncheck the show 16-bit tasks menu item */
444 if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
446 CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
447 TaskManagerSettings.ShowKernelTimes = FALSE;
449 else
451 CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
452 TaskManagerSettings.ShowKernelTimes = TRUE;
455 RefreshPerformancePage();
458 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
460 HMENU hMenu;
461 HMENU hViewMenu;
462 HMENU hCPUHistoryMenu;
464 hMenu = GetMenu(hMainWnd);
465 hViewMenu = GetSubMenu(hMenu, 2);
466 hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
468 TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
469 CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
472 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
474 HMENU hMenu;
475 HMENU hViewMenu;
476 HMENU hCPUHistoryMenu;
478 hMenu = GetMenu(hMainWnd);
479 hViewMenu = GetSubMenu(hMenu, 2);
480 hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
482 TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
483 CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);