ReactOS  0.4.15-dev-5461-g062a8f2
perfpage.c File Reference
#include "precomp.h"
#include <shlwapi.h>
Include dependency graph for perfpage.c:

Go to the source code of this file.

Functions

DWORD WINAPI PerformancePageRefreshThread (void *lpParameter)
 
void AdjustFrameSize (HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
 
static void AdjustControlPosition (HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
 
static void AdjustCntrlPos (int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
 
INT_PTR CALLBACK PerformancePageWndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
void RefreshPerformancePage (void)
 
void PerformancePage_OnViewShowKernelTimes (void)
 
void PerformancePage_OnViewCPUHistoryOneGraphAll (void)
 
void PerformancePage_OnViewCPUHistoryOneGraphPerCPU (void)
 

Variables

BOOL bInMenuLoop
 
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
 
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph
 
HWND hPerformancePage
 
HWND hPerformancePageCpuUsageGraph
 
HWND hPerformancePageMemUsageGraph
 
HWND hPerformancePageCpuUsageHistoryGraph
 
HWND hPerformancePageMemUsageHistoryGraph
 
HWND hPerformancePageTotalsFrame
 
HWND hPerformancePageCommitChargeFrame
 
HWND hPerformancePageKernelMemoryFrame
 
HWND hPerformancePagePhysicalMemoryFrame
 
HWND hPerformancePageCpuUsageFrame
 
HWND hPerformancePageMemUsageFrame
 
HWND hPerformancePageCpuUsageHistoryFrame
 
HWND hPerformancePageMemUsageHistoryFrame
 
HWND hPerformancePageCommitChargeTotalEdit
 
HWND hPerformancePageCommitChargeLimitEdit
 
HWND hPerformancePageCommitChargePeakEdit
 
HWND hPerformancePageKernelMemoryTotalEdit
 
HWND hPerformancePageKernelMemoryPagedEdit
 
HWND hPerformancePageKernelMemoryNonPagedEdit
 
HWND hPerformancePagePhysicalMemoryTotalEdit
 
HWND hPerformancePagePhysicalMemoryAvailableEdit
 
HWND hPerformancePagePhysicalMemorySystemCacheEdit
 
HWND hPerformancePageTotalsHandleCountEdit
 
HWND hPerformancePageTotalsProcessCountEdit
 
HWND hPerformancePageTotalsThreadCountEdit
 
static HANDLE hPerformanceThread = NULL
 
static DWORD dwPerformanceThread
 
static int nPerformancePageWidth
 
static int nPerformancePageHeight
 
static int lastX
 
static int lastY
 

Function Documentation

◆ AdjustCntrlPos()

static void AdjustCntrlPos ( int  ctrl_id,
HWND  hDlg,
int  nXDifference,
int  nYDifference 
)
static

Definition at line 107 of file perfpage.c.

108 {
109  AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
110 }
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
Definition: perfpage.c:67

Referenced by PerformancePageWndProc().

◆ AdjustControlPosition()

static void AdjustControlPosition ( HWND  hCntrl,
HWND  hDlg,
int  nXDifference,
int  nYDifference 
)
static

Definition at line 102 of file perfpage.c.

103 {
104  AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
105 }
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
Definition: perfpage.c:67

Referenced by PerformancePageWndProc().

◆ AdjustFrameSize()

void AdjustFrameSize ( HWND  hCntrl,
HWND  hDlg,
int  nXDifference,
int  nYDifference,
int  pos 
)

Definition at line 67 of file perfpage.c.

68 {
69  RECT rc;
70  int cx, cy, sx, sy;
71 
72  GetClientRect(hCntrl, &rc);
73  MapWindowPoints(hCntrl, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
74  if (pos) {
75  cx = rc.left;
76  cy = rc.top;
77  sx = rc.right - rc.left;
78  switch (pos) {
79  case 1:
80  break;
81  case 2:
82  cy += nYDifference / 2;
83  break;
84  case 3:
85  sx += nXDifference;
86  break;
87  case 4:
88  cy += nYDifference / 2;
89  sx += nXDifference;
90  break;
91  }
92  sy = rc.bottom - rc.top + nYDifference / 2;
94  } else {
95  cx = rc.left + nXDifference;
96  cy = rc.top + nYDifference;
98  }
99  InvalidateRect(hCntrl, NULL, TRUE);
100 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
LONG right
Definition: windef.h:308
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define SWP_NOACTIVATE
Definition: winuser.h:1232
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SWP_NOSIZE
Definition: winuser.h:1235
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define NULL
Definition: types.h:112
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239

Referenced by AdjustCntrlPos(), AdjustControlPosition(), and PerformancePageWndProc().

◆ PerformancePage_OnViewCPUHistoryOneGraphAll()

void PerformancePage_OnViewCPUHistoryOneGraphAll ( void  )

Definition at line 506 of file perfpage.c.

507 {
508  HMENU hMenu;
509  HMENU hViewMenu;
510  HMENU hCPUHistoryMenu;
511 
512  hMenu = GetMenu(hMainWnd);
513  hViewMenu = GetSubMenu(hMenu, 2);
514  hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
515 
518 }
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define FALSE
Definition: types.h:117
#define ID_VIEW_CPUHISTORY_ONEGRAPHALL
Definition: resource.h:162
#define ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
Definition: resource.h:163
HWND hMainWnd
Definition: magnifier.c:32
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL CPUHistory_OneGraphPerCPU
Definition: taskmgr.h:87

Referenced by TaskManagerWndProc().

◆ PerformancePage_OnViewCPUHistoryOneGraphPerCPU()

void PerformancePage_OnViewCPUHistoryOneGraphPerCPU ( void  )

Definition at line 520 of file perfpage.c.

521 {
522  HMENU hMenu;
523  HMENU hViewMenu;
524  HMENU hCPUHistoryMenu;
525 
526  hMenu = GetMenu(hMainWnd);
527  hViewMenu = GetSubMenu(hMenu, 2);
528  hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
529 
532 }
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TRUE
Definition: types.h:120
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define ID_VIEW_CPUHISTORY_ONEGRAPHALL
Definition: resource.h:162
#define ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
Definition: resource.h:163
HWND hMainWnd
Definition: magnifier.c:32
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL CPUHistory_OneGraphPerCPU
Definition: taskmgr.h:87

Referenced by TaskManagerWndProc().

◆ PerformancePage_OnViewShowKernelTimes()

void PerformancePage_OnViewShowKernelTimes ( void  )

Definition at line 480 of file perfpage.c.

481 {
482  HMENU hMenu;
483  HMENU hViewMenu;
484 
485  hMenu = GetMenu(hMainWnd);
486  hViewMenu = GetSubMenu(hMenu, 2);
487 
488  /* Check or uncheck the show 16-bit tasks menu item */
490  {
494  }
495  else
496  {
500  }
501 
504 }
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL DrawSecondaryPlot
Definition: graphctl.h:56
#define TRUE
Definition: types.h:120
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
void GraphCtrl_RedrawBitmap(PTM_GRAPH_CONTROL inst, INT h)
Definition: graphctl.c:209
#define FALSE
Definition: types.h:117
#define MF_CHECKED
Definition: winuser.h:132
void RefreshPerformancePage(void)
Definition: perfpage.c:310
#define ID_VIEW_SHOWKERNELTIMES
Definition: resource.h:161
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28
HWND hMainWnd
Definition: magnifier.c:32
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MF_UNCHECKED
Definition: winuser.h:204
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by TaskManagerWndProc().

◆ PerformancePageRefreshThread()

DWORD WINAPI PerformancePageRefreshThread ( void lpParameter)

Definition at line 319 of file perfpage.c.

320 {
321  ULONGLONG CommitChargeTotal;
322  ULONGLONG CommitChargeLimit;
323  ULONGLONG CommitChargePeak;
324 
325  ULONG CpuUsage;
326  ULONG CpuKernelUsage;
327 
328  ULONGLONG KernelMemoryTotal;
329  ULONGLONG KernelMemoryPaged;
330  ULONGLONG KernelMemoryNonPaged;
331 
332  ULONGLONG PhysicalMemoryTotal;
333  ULONGLONG PhysicalMemoryAvailable;
334  ULONGLONG PhysicalMemorySystemCache;
335 
336  ULONG TotalHandles;
337  ULONG TotalThreads;
338  ULONG TotalProcesses;
339 
340  MSG msg;
341 
342  WCHAR Text[260];
343  WCHAR szMemUsage[256], szCpuUsage[256], szProcesses[256];
344 
345  LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256);
346  LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
347  LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, 256);
348 
349  while (1)
350  {
351  int nBarsUsed1;
352  int nBarsUsed2;
353 
354  WCHAR szChargeTotalFormat[256];
355  WCHAR szChargeLimitFormat[256];
356 
357  /* Wait for an the event or application close */
358  if (GetMessage(&msg, NULL, 0, 0) <= 0)
359  return 0;
360 
361  if (msg.message == WM_TIMER)
362  {
363  /*
364  * Update the commit charge info
365  */
366  CommitChargeTotal = PerfDataGetCommitChargeTotalK();
367  CommitChargeLimit = PerfDataGetCommitChargeLimitK();
368  CommitChargePeak = PerfDataGetCommitChargePeakK();
369  _ultow(CommitChargeTotal, Text, 10);
371  _ultow(CommitChargeLimit, Text, 10);
373  _ultow(CommitChargePeak, Text, 10);
375 
376  StrFormatByteSizeW(CommitChargeTotal * 1024,
377  szChargeTotalFormat,
378  _countof(szChargeTotalFormat));
379 
380  StrFormatByteSizeW(CommitChargeLimit * 1024,
381  szChargeLimitFormat,
382  _countof(szChargeLimitFormat));
383 
384  if (!bInMenuLoop)
385  {
386  wsprintfW(Text, szMemUsage, szChargeTotalFormat, szChargeLimitFormat,
387  (CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0));
389  }
390 
391  /*
392  * Update the kernel memory info
393  */
394  KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
395  KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
396  KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
397  _ultow(KernelMemoryTotal, Text, 10);
399  _ultow(KernelMemoryPaged, Text, 10);
401  _ultow(KernelMemoryNonPaged, Text, 10);
403 
404  /*
405  * Update the physical memory info
406  */
407  PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
408  PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
409  PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
410  _ultow(PhysicalMemoryTotal, Text, 10);
412  _ultow(PhysicalMemoryAvailable, Text, 10);
414  _ultow(PhysicalMemorySystemCache, Text, 10);
416 
417  /*
418  * Update the totals info
419  */
420  TotalHandles = PerfDataGetSystemHandleCount();
421  TotalThreads = PerfDataGetTotalThreadCount();
422  TotalProcesses = PerfDataGetProcessCount();
423  _ultow(TotalHandles, Text, 10);
425  _ultow(TotalThreads, Text, 10);
427  _ultow(TotalProcesses, Text, 10);
429  if (!bInMenuLoop)
430  {
431  wsprintfW(Text, szProcesses, TotalProcesses);
433  }
434 
435  /*
436  * Redraw the graphs
437  */
440 
441  /*
442  * Get the CPU usage
443  */
444  CpuUsage = PerfDataGetProcessorUsage();
445  if (CpuUsage <= 0 ) CpuUsage = 0;
446  if (CpuUsage > 100) CpuUsage = 100;
447 
448  if (!bInMenuLoop)
449  {
450  wsprintfW(Text, szCpuUsage, CpuUsage);
452  }
453 
454  CpuKernelUsage = PerfDataGetProcessorSystemUsage();
455  if (CpuKernelUsage <= 0)
456  CpuKernelUsage = 0;
457  else if (CpuKernelUsage > 100)
458  CpuKernelUsage = 100;
459 
460  /*
461  * Get the memory usage
462  */
463  CommitChargeTotal = PerfDataGetCommitChargeTotalK();
464  CommitChargeLimit = PerfDataGetCommitChargeLimitK();
465  nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
466 
467  PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
468  PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
469  nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
470 
471  GraphCtrl_AddPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage);
475  }
476  }
477  return 0;
478 }
ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
Definition: perfdata.c:1079
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HWND hStatusWnd
Definition: charmap.c:22
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
#define IDS_STATUS_PROCESSES
Definition: resource.h:257
ULONG PerfDataGetKernelMemoryNonPagedK(void)
Definition: perfdata.c:1028
_CRTIMP wchar_t *__cdecl _ultow(_In_ unsigned long _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
HWND hPerformancePageTotalsHandleCountEdit
Definition: perfpage.c:53
HWND hPerformancePageKernelMemoryPagedEdit
Definition: perfpage.c:48
HWND hPerformancePageMemUsageGraph
Definition: perfpage.c:33
HWND hPerformancePageMemUsageHistoryGraph
Definition: perfpage.c:35
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph
Definition: perfpage.c:29
HWND hPerformancePageCommitChargePeakEdit
Definition: perfpage.c:46
ULONG PerfDataGetCommitChargePeakK(void)
Definition: perfdata.c:971
HWND hPerformancePageKernelMemoryNonPagedEdit
Definition: perfpage.c:49
ULONG PerfDataGetCommitChargeLimitK(void)
Definition: perfdata.c:954
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
ULONG PerfDataGetTotalThreadCount(void)
Definition: perfdata.c:1107
ULONG PerfDataGetProcessorSystemUsage(void)
Definition: perfdata.c:481
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
ULONG PerfDataGetSystemHandleCount(void)
Definition: perfdata.c:1094
ULONG PerfDataGetPhysicalMemoryAvailableK(void)
Definition: perfdata.c:1062
#define FALSE
Definition: types.h:117
ULONG PerfDataGetKernelMemoryPagedK(void)
Definition: perfdata.c:1011
HWND hPerformancePagePhysicalMemorySystemCacheEdit
Definition: perfpage.c:52
LONG_PTR LPARAM
Definition: windef.h:208
ULONG PerfDataGetProcessCount(void)
Definition: perfdata.c:463
HWND hPerformancePageCommitChargeLimitEdit
Definition: perfpage.c:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
#define _countof(array)
Definition: sndvol32.h:68
#define WM_TIMER
Definition: winuser.h:1732
HWND hPerformancePageKernelMemoryTotalEdit
Definition: perfpage.c:47
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define IDS_STATUS_CPUUSAGE
Definition: resource.h:256
HWND hPerformancePageTotalsThreadCountEdit
Definition: perfpage.c:55
#define IDS_STATUS_MEMUSAGE
Definition: resource.h:255
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28
#define SB_SETTEXT
Definition: commctrl.h:1949
HWND hPerformancePageCpuUsageGraph
Definition: perfpage.c:32
ULONG PerfDataGetKernelMemoryTotalK(void)
Definition: perfdata.c:988
HWND hPerformancePageCommitChargeTotalEdit
Definition: perfpage.c:44
HWND hPerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:34
HWND hPerformancePageTotalsProcessCountEdit
Definition: perfpage.c:54
HWND hPerformancePagePhysicalMemoryTotalEdit
Definition: perfpage.c:50
HINSTANCE hInst
Definition: dxdiag.c:13
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5780
ULONG PerfDataGetCommitChargeTotalK(void)
Definition: perfdata.c:937
ULONG PerfDataGetPhysicalMemoryTotalK(void)
Definition: perfdata.c:1045
#define msg(x)
Definition: auth_time.c:54
unsigned int ULONG
Definition: retypes.h:1
ULONG PerfDataGetProcessorUsage(void)
Definition: perfdata.c:472
void GraphCtrl_AddPoint(PTM_GRAPH_CONTROL inst, BYTE val0, BYTE val1)
Definition: graphctl.c:139
HWND hPerformancePagePhysicalMemoryAvailableEdit
Definition: perfpage.c:51
BOOL bInMenuLoop
Definition: taskmgr.c:49
char * Text
Definition: combotst.c:136

Referenced by PerformancePageWndProc().

◆ PerformancePageWndProc()

INT_PTR CALLBACK PerformancePageWndProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 113 of file perfpage.c.

114 {
115  RECT rc;
116  int nXDifference;
117  int nYDifference;
118 /* HDC hdc; */
119 /* PAINTSTRUCT ps; */
120 
121  switch (message) {
122  case WM_DESTROY:
125 #ifdef RUN_PERF_PAGE
127 #endif
128  break;
129 
130  case WM_INITDIALOG:
131  {
132  BOOL bGraph;
133  TM_FORMAT fmt;
134 
135  /* Save the width and height */
136  GetClientRect(hDlg, &rc);
139 
140  /* Update window position */
142 
143  /*
144  * Get handles to all the controls
145  */
150 
155 
168 
173 
174  /* Create the controls */
175  fmt.clrBack = RGB(0, 0, 0);
176  fmt.clrGrid = RGB(0, 128, 64);
177  fmt.clrPlot0 = RGB(0, 255, 0);
178  fmt.clrPlot1 = RGB(255, 0, 0);
179  fmt.GridCellWidth = fmt.GridCellHeight = 12;
180  fmt.DrawSecondaryPlot = TaskManagerSettings.ShowKernelTimes;
182  if (!bGraph)
183  {
184  EndDialog(hDlg, 0);
185  return FALSE;
186  }
187 
188  fmt.clrPlot0 = RGB(255, 255, 0);
189  fmt.clrPlot1 = RGB(100, 255, 255);
190  fmt.DrawSecondaryPlot = TRUE;
192  if (!bGraph)
193  {
194  EndDialog(hDlg, 0);
195  return FALSE;
196  }
197 
198  /* Start our refresh thread */
199 #ifdef RUN_PERF_PAGE
201 #endif
202 
203  /*
204  * Subclass graph buttons
205  */
210  return TRUE;
211  }
212 
213  case WM_COMMAND:
214  break;
215 #if 0
216  case WM_NCPAINT:
217  hdc = GetDC(hDlg);
218  GetClientRect(hDlg, &rc);
220  ReleaseDC(hDlg, hdc);
221  break;
222 
223  case WM_PAINT:
224  hdc = BeginPaint(hDlg, &ps);
225  GetClientRect(hDlg, &rc);
227  EndPaint(hDlg, &ps);
228  break;
229 #endif
230  case WM_SIZE:
231  do {
232  int cx, cy;
233 
234  if (wParam == SIZE_MINIMIZED)
235  return 0;
236 
237  cx = LOWORD(lParam);
238  cy = HIWORD(lParam);
239  nXDifference = cx - nPerformancePageWidth;
240  nYDifference = cy - nPerformancePageHeight;
243  } while (0);
244 
245  /* Reposition the performance page's controls */
246  AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
247  AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
248  AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
249  AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
250  AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
251  AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
252  AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
253  AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
254  AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
255  AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
256  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
257  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
258  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
259  AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
260  AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
261  AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
262 
275 
276  nXDifference += lastX;
277  nYDifference += lastY;
278  lastX = lastY = 0;
279  if (nXDifference % 2) {
280  if (nXDifference > 0) {
281  nXDifference--;
282  lastX++;
283  } else {
284  nXDifference++;
285  lastX--;
286  }
287  }
288  if (nYDifference % 2) {
289  if (nYDifference > 0) {
290  nYDifference--;
291  lastY++;
292  } else {
293  nYDifference++;
294  lastY--;
295  }
296  }
297  AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
298  AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
299  AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
300  AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
301  AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
302  AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
303  AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
304  AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
305  break;
306  }
307  return 0;
308 }
static HANDLE hPerformanceThread
Definition: perfpage.c:58
INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: graph.c:34
#define IDC_PHYSICAL_MEMORY_TOTAL
Definition: resource.h:69
HWND hPerformancePageCpuUsageHistoryFrame
Definition: perfpage.c:42
#define COLOR_3DHILIGHT
Definition: winuser.h:931
Definition: tftpd.h:59
#define IDC_PHYSICAL_MEMORY_SYSTEM_CACHE
Definition: resource.h:75
HWND hPerformancePageTotalsHandleCountEdit
Definition: perfpage.c:53
HWND hPerformancePageKernelMemoryPagedEdit
Definition: perfpage.c:48
#define IDS_TOTALS_PROCESS_COUNT
Definition: resource.h:126
static int lastX
Definition: perfpage.c:64
HWND hPerformancePageMemUsageGraph
Definition: perfpage.c:33
#define IDC_MEM_USAGE_FRAME
Definition: resource.h:105
#define IDC_CPU_USAGE_FRAME
Definition: resource.h:102
#define RGB(r, g, b)
Definition: precomp.h:62
#define IDC_KERNEL_MEMORY_NONPAGED
Definition: resource.h:84
void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight)
Definition: taskmgr.c:552
#define IDC_COMMIT_CHARGE_TOTAL
Definition: resource.h:59
HDC WINAPI GetDC(_In_opt_ HWND)
static DWORD dwPerformanceThread
Definition: perfpage.c:59
#define TRUE
Definition: types.h:120
HWND hPerformancePageCommitChargeFrame
Definition: perfpage.c:37
HWND hPerformancePageMemUsageHistoryGraph
Definition: perfpage.c:35
WNDPROC OldGraphWndProc
Definition: graph.c:27
HWND hPerformancePageMemUsageHistoryFrame
Definition: perfpage.c:43
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph
Definition: perfpage.c:29
const char * fmt
Definition: wsprintf.c:30
LONG top
Definition: windef.h:307
HWND hPerformancePageCommitChargePeakEdit
Definition: perfpage.c:46
#define IDC_COMMIT_CHARGE_PEAK
Definition: resource.h:66
HWND hPerformancePageKernelMemoryNonPagedEdit
Definition: perfpage.c:49
#define IDC_PHYSICAL_MEMORY_FRAME
Definition: resource.h:96
static int nPerformancePageWidth
Definition: perfpage.c:62
#define IDC_MEMORY_USAGE_HISTORY_FRAME
Definition: resource.h:111
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
#define IDC_KERNEL_MEMORY_PAGED
Definition: resource.h:81
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1181
#define IDS_PHYSICAL_MEMORY_TOTAL
Definition: resource.h:130
LONG right
Definition: windef.h:308
INT_PTR CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: graphctl.c:300
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define COLOR_3DSHADOW
Definition: winuser.h:925
#define IDC_PHYSICAL_MEMORY_AVAILABLE
Definition: resource.h:72
#define WM_NCPAINT
Definition: winuser.h:1677
#define IDS_PHYSICAL_MEMORY_AVAILABLE
Definition: resource.h:131
#define FALSE
Definition: types.h:117
#define IDC_COMMIT_CHARGE_LIMIT
Definition: resource.h:62
unsigned int BOOL
Definition: ntddk_ex.h:94
static void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
Definition: perfpage.c:102
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define IDS_COMMIT_CHARGE_LIMIT
Definition: resource.h:128
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
Definition: perfpage.c:107
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define IDC_COMMIT_CHARGE_FRAME
Definition: resource.h:90
#define IDC_CPU_USAGE_HISTORY_FRAME
Definition: resource.h:108
HWND hPerformancePagePhysicalMemorySystemCacheEdit
Definition: perfpage.c:52
BOOL GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT fmt)
Definition: graphctl.c:16
HWND hPerformancePagePhysicalMemoryFrame
Definition: perfpage.c:39
#define WM_DESTROY
Definition: winuser.h:1599
WNDPROC OldGraphCtrlWndProc
Definition: graphctl.c:13
void GraphCtrl_Dispose(PTM_GRAPH_CONTROL inst)
Definition: graphctl.c:114
#define IDS_COMMIT_CHARGE_PEAK
Definition: resource.h:129
static int nPerformancePageHeight
Definition: perfpage.c:63
HWND hPerformancePageCommitChargeLimitEdit
Definition: perfpage.c:45
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1601
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
Definition: perfpage.c:67
HWND hPerformancePageKernelMemoryFrame
Definition: perfpage.c:38
#define SWP_NOACTIVATE
Definition: winuser.h:1232
HWND hPerformancePageKernelMemoryTotalEdit
Definition: perfpage.c:47
static int lastY
Definition: perfpage.c:64
#define IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
Definition: resource.h:132
#define SIZE_MINIMIZED
Definition: winuser.h:2496
HWND hPerformancePageTotalsThreadCountEdit
Definition: perfpage.c:55
#define WM_PAINT
Definition: winuser.h:1610
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28
HWND hPerformancePageCpuUsageFrame
Definition: perfpage.c:40
#define IDS_KERNEL_MEMORY_NONPAGED
Definition: resource.h:135
HDC hdc
Definition: main.c:9
#define IDC_TOTALS_PROCESS_COUNT
Definition: resource.h:56
#define WM_COMMAND
Definition: winuser.h:1730
#define IDC_KERNEL_MEMORY_FRAME
Definition: resource.h:93
#define IDS_TOTALS_THREAD_COUNT
Definition: resource.h:125
HWND hPerformancePageCpuUsageGraph
Definition: perfpage.c:32
#define IDC_TOTALS_HANDLE_COUNT
Definition: resource.h:48
#define GWLP_WNDPROC
Definition: treelist.c:66
#define IDC_CPU_USAGE_HISTORY_GRAPH
Definition: resource.h:121
HWND hPerformancePageCommitChargeTotalEdit
Definition: perfpage.c:44
#define SWP_NOSIZE
Definition: winuser.h:1235
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
HWND hPerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:34
HWND hPerformancePageTotalsProcessCountEdit
Definition: perfpage.c:54
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hPerformancePagePhysicalMemoryTotalEdit
Definition: perfpage.c:50
#define IDC_TOTALS_THREAD_COUNT
Definition: resource.h:53
#define IDC_CPU_USAGE_GRAPH
Definition: resource.h:114
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HWND hPerformancePageMemUsageFrame
Definition: perfpage.c:41
#define NULL
Definition: types.h:112
HWND hPerformancePageTotalsFrame
Definition: perfpage.c:36
#define IDC_MEM_USAGE_GRAPH
Definition: resource.h:118
_Out_opt_ int * cx
Definition: commctrl.h:585
#define HIWORD(l)
Definition: typedefs.h:247
#define IDS_COMMIT_CHARGE_TOTAL
Definition: resource.h:127
#define IDC_MEM_USAGE_HISTORY_GRAPH
Definition: resource.h:120
LONG bottom
Definition: windef.h:309
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5336
HWND hPerformancePagePhysicalMemoryAvailableEdit
Definition: perfpage.c:51
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
Definition: perfpage.c:319
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
Definition: dsound.c:943
#define IDC_KERNEL_MEMORY_TOTAL
Definition: resource.h:78
#define IDS_KERNEL_MEMORY_PAGED
Definition: resource.h:134
#define IDC_TOTALS_FRAME
Definition: resource.h:87
#define IDS_KERNEL_MEMORY_TOTAL
Definition: resource.h:133
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239
#define IDS_TOTALS_HANDLE_COUNT
Definition: resource.h:124

Referenced by OnCreate().

◆ RefreshPerformancePage()

void RefreshPerformancePage ( void  )

Definition at line 310 of file perfpage.c.

311 {
312 #ifdef RUN_PERF_PAGE
313  /* Signal the event so that our refresh thread */
314  /* will wake up and refresh the performance page */
316 #endif
317 }
static DWORD dwPerformanceThread
Definition: perfpage.c:59
#define WM_TIMER
Definition: winuser.h:1732
#define PostThreadMessage
Definition: winuser.h:5823

Referenced by OnCreate(), PerformancePage_OnViewShowKernelTimes(), TaskManager_OnExitMenuLoop(), and TaskManagerWndProc().

Variable Documentation

◆ bInMenuLoop

◆ dwPerformanceThread

DWORD dwPerformanceThread
static

Definition at line 59 of file perfpage.c.

Referenced by PerformancePageWndProc(), and RefreshPerformancePage().

◆ hPerformancePage

HWND hPerformancePage

Definition at line 31 of file perfpage.c.

Referenced by OnCreate(), OnMove(), OnSize(), and TaskManager_OnTabWndSelChange().

◆ hPerformancePageCommitChargeFrame

HWND hPerformancePageCommitChargeFrame

Definition at line 37 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageCommitChargeLimitEdit

HWND hPerformancePageCommitChargeLimitEdit

Definition at line 45 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageCommitChargePeakEdit

HWND hPerformancePageCommitChargePeakEdit

Definition at line 46 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageCommitChargeTotalEdit

HWND hPerformancePageCommitChargeTotalEdit

Definition at line 44 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageCpuUsageFrame

HWND hPerformancePageCpuUsageFrame

Definition at line 40 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageCpuUsageGraph

HWND hPerformancePageCpuUsageGraph

Definition at line 32 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageCpuUsageHistoryFrame

HWND hPerformancePageCpuUsageHistoryFrame

Definition at line 42 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageCpuUsageHistoryGraph

HWND hPerformancePageCpuUsageHistoryGraph

◆ hPerformancePageKernelMemoryFrame

HWND hPerformancePageKernelMemoryFrame

Definition at line 38 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageKernelMemoryNonPagedEdit

HWND hPerformancePageKernelMemoryNonPagedEdit

Definition at line 49 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageKernelMemoryPagedEdit

HWND hPerformancePageKernelMemoryPagedEdit

Definition at line 48 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageKernelMemoryTotalEdit

HWND hPerformancePageKernelMemoryTotalEdit

Definition at line 47 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageMemUsageFrame

HWND hPerformancePageMemUsageFrame

Definition at line 41 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageMemUsageGraph

HWND hPerformancePageMemUsageGraph

Definition at line 33 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageMemUsageHistoryFrame

HWND hPerformancePageMemUsageHistoryFrame

Definition at line 43 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageMemUsageHistoryGraph

HWND hPerformancePageMemUsageHistoryGraph

◆ hPerformancePagePhysicalMemoryAvailableEdit

HWND hPerformancePagePhysicalMemoryAvailableEdit

Definition at line 51 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePagePhysicalMemoryFrame

HWND hPerformancePagePhysicalMemoryFrame

Definition at line 39 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePagePhysicalMemorySystemCacheEdit

HWND hPerformancePagePhysicalMemorySystemCacheEdit

Definition at line 52 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePagePhysicalMemoryTotalEdit

HWND hPerformancePagePhysicalMemoryTotalEdit

Definition at line 50 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageTotalsFrame

HWND hPerformancePageTotalsFrame

Definition at line 36 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ hPerformancePageTotalsHandleCountEdit

HWND hPerformancePageTotalsHandleCountEdit

Definition at line 53 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageTotalsProcessCountEdit

HWND hPerformancePageTotalsProcessCountEdit

Definition at line 54 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformancePageTotalsThreadCountEdit

HWND hPerformancePageTotalsThreadCountEdit

Definition at line 55 of file perfpage.c.

Referenced by PerformancePageRefreshThread(), and PerformancePageWndProc().

◆ hPerformanceThread

HANDLE hPerformanceThread = NULL
static

Definition at line 58 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ lastX

int lastX
static

Definition at line 64 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ lastY

int lastY
static

Definition at line 64 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ nPerformancePageHeight

int nPerformancePageHeight
static

Definition at line 63 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ nPerformancePageWidth

int nPerformancePageWidth
static

Definition at line 62 of file perfpage.c.

Referenced by PerformancePageWndProc().

◆ PerformancePageCpuUsageHistoryGraph

TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph

◆ PerformancePageMemUsageHistoryGraph

TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph