1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
/*
* ReactOS Task Manager
*
* perfpage.c
*
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
* Copyright (C) 2008 Vladimir Pankratov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <commctrl.h>
#include <winnt.h>
#include "wine/unicode.h"
#include "taskmgr.h"
#include "perfdata.h"
#include "graphctl.h"
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
TGraphCtrl PerformancePageMemUsageHistoryGraph;
HWND hPerformancePage; /* Performance Property Page */
HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
HWND hPerformancePageTotalsFrame; /* Totals Frame */
HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
HWND hPerformancePageCpuUsageFrame;
HWND hPerformancePageMemUsageFrame;
HWND hPerformancePageCpuUsageHistoryFrame;
HWND hPerformancePageMemUsageHistoryFrame;
HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
static void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
{
RECT rc;
int cx, cy, sx, sy;
GetClientRect(hCntrl, &rc);
MapWindowPoints(hCntrl, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)));
if (pos) {
cx = rc.left;
cy = rc.top;
sx = rc.right - rc.left;
switch (pos) {
case 1:
break;
case 2:
cy += nYDifference / 2;
break;
case 3:
sx += nXDifference;
break;
case 4:
cy += nYDifference / 2;
sx += nXDifference;
break;
}
sy = rc.bottom - rc.top + nYDifference / 2;
SetWindowPos(hCntrl, NULL, cx, cy, sx, sy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER);
} else {
cx = rc.left + nXDifference;
cy = rc.top + nYDifference;
SetWindowPos(hCntrl, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
}
InvalidateRect(hCntrl, NULL, TRUE);
}
static void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
}
static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
}
void RefreshPerformancePage(void)
{
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
SetEvent(hPerformancePageEvent);
}
static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
{
ULONG CommitChargeTotal;
ULONG CommitChargeLimit;
ULONG CommitChargePeak;
ULONG KernelMemoryTotal;
ULONG KernelMemoryPaged;
ULONG KernelMemoryNonPaged;
ULONG PhysicalMemoryTotal;
ULONG PhysicalMemoryAvailable;
ULONG PhysicalMemorySystemCache;
ULONG TotalHandles;
ULONG TotalThreads;
ULONG TotalProcesses;
WCHAR Text[256];
static const WCHAR wszFormatDigit[] = {'%','u',0};
WCHAR wszMemUsage[255];
LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
/* Create the event */
hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
/* If we couldn't create the event then exit the thread */
if (!hPerformancePageEvent)
return 0;
while (1)
{
DWORD dwWaitVal;
/* Wait on the event */
dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
/* If the wait failed then the event object must have been */
/* closed and the task manager is exiting so exit this thread */
if (dwWaitVal == WAIT_FAILED)
return 0;
if (dwWaitVal == WAIT_OBJECT_0)
{
ULONG CpuUsage;
ULONG CpuKernelUsage;
int nBarsUsed1, nBarsUsed2;
DWORD_PTR args[2];
/* Reset our event */
ResetEvent(hPerformancePageEvent);
/*
* Update the commit charge info
*/
CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
wsprintfW(Text, wszFormatDigit, CommitChargeTotal);
SetWindowTextW(hPerformancePageCommitChargeTotalEdit, Text);
wsprintfW(Text, wszFormatDigit, CommitChargeLimit);
SetWindowTextW(hPerformancePageCommitChargeLimitEdit, Text);
wsprintfW(Text, wszFormatDigit, CommitChargePeak);
SetWindowTextW(hPerformancePageCommitChargePeakEdit, Text);
args[0] = CommitChargeTotal;
args[1] = CommitChargeLimit;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
wszMemUsage, 0, 0, Text,
sizeof(Text)/sizeof(*Text), (__ms_va_list*)args);
SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
/*
* Update the kernel memory info
*/
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
wsprintfW(Text, wszFormatDigit, KernelMemoryTotal);
SetWindowTextW(hPerformancePageKernelMemoryTotalEdit, Text);
wsprintfW(Text, wszFormatDigit, KernelMemoryPaged);
SetWindowTextW(hPerformancePageKernelMemoryPagedEdit, Text);
wsprintfW(Text, wszFormatDigit, KernelMemoryNonPaged);
SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit, Text);
/*
* Update the physical memory info
*/
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
wsprintfW(Text, wszFormatDigit, PhysicalMemoryTotal);
SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit, Text);
wsprintfW(Text, wszFormatDigit, PhysicalMemoryAvailable);
SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit, Text);
wsprintfW(Text, wszFormatDigit, PhysicalMemorySystemCache);
SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
/*
* Update the totals info
*/
TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
wsprintfW(Text, wszFormatDigit, TotalHandles);
SetWindowTextW(hPerformancePageTotalsHandleCountEdit, Text);
wsprintfW(Text, wszFormatDigit, TotalThreads);
SetWindowTextW(hPerformancePageTotalsThreadCountEdit, Text);
wsprintfW(Text, wszFormatDigit, TotalProcesses);
SetWindowTextW(hPerformancePageTotalsProcessCountEdit, Text);
/*
* Redraw the graphs
*/
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
/*
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
/*
* Get the memory usage
*/
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
/* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
}
}
return 0;
}
INT_PTR CALLBACK
PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rc;
int nXDifference;
int nYDifference;
/* HDC hdc; */
/* PAINTSTRUCT ps; */
switch (message) {
case WM_INITDIALOG:
/* Save the width and height */
GetClientRect(hDlg, &rc);
nPerformancePageWidth = rc.right;
nPerformancePageHeight = rc.bottom;
/* Update window position */
SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
/*
* Get handles to all the controls
*/
hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME);
hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
/* create the control */
/* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
/* customize the control */
GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10);
/* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */
/* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */
/* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */
/* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */
/* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */
GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ;
GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ;
GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ;
GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 1, RGB(0, 255, 0)) ;
GetClientRect(hPerformancePageMemUsageHistoryGraph, &rc);
GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph, 0.0, 100.0, 10) ;
GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ;
GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ;
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
/* Start our refresh thread */
#ifdef RUN_PERF_PAGE
CloseHandle( CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL));
#endif
/*
* Subclass graph buttons
*/
OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
case WM_COMMAND:
break;
#if 0
case WM_NCPAINT:
hdc = GetDC(hDlg);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
ReleaseDC(hDlg, hdc);
break;
case WM_PAINT:
hdc = BeginPaint(hDlg, &ps);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
EndPaint(hDlg, &ps);
break;
#endif
case WM_SIZE:
do {
int cx, cy;
if (wParam == SIZE_MINIMIZED)
return 0;
cx = LOWORD(lParam);
cy = HIWORD(lParam);
nXDifference = cx - nPerformancePageWidth;
nYDifference = cy - nPerformancePageHeight;
nPerformancePageWidth = cx;
nPerformancePageHeight = cy;
} while (0);
/* Reposition the performance page's controls */
AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
{
static int lastX, lastY;
nXDifference += lastX;
nYDifference += lastY;
lastX = lastY = 0;
if (nXDifference % 2) {
if (nXDifference > 0) {
nXDifference--;
lastX++;
} else {
nXDifference++;
lastX--;
}
}
if (nYDifference % 2) {
if (nYDifference > 0) {
nYDifference--;
lastY++;
} else {
nYDifference++;
lastY--;
}
}
}
AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
break;
}
return 0;
}
void PerformancePage_OnViewShowKernelTimes(void)
{
HMENU hMenu;
HMENU hViewMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
/* Check or uncheck the show 16-bit tasks menu item */
if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
TaskManagerSettings.ShowKernelTimes = FALSE;
}
else
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
TaskManagerSettings.ShowKernelTimes = TRUE;
}
RefreshPerformancePage();
}
void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
}
void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
}