ReactOS  0.4.11-dev-946-g431643b
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
 
TGraphCtrl PerformancePageCpuUsageHistoryGraph
 
TGraphCtrl 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.

Referenced by PerformancePageWndProc().

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

◆ AdjustControlPosition()

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

Definition at line 102 of file perfpage.c.

Referenced by PerformancePageWndProc().

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

◆ AdjustFrameSize()

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

Definition at line 67 of file perfpage.c.

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

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 }
#define TRUE
Definition: types.h:120
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:298
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
_Out_opt_ int * cx
Definition: commctrl.h:570
LONG bottom
Definition: windef.h:299
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

◆ PerformancePage_OnViewCPUHistoryOneGraphAll()

void PerformancePage_OnViewCPUHistoryOneGraphAll ( void  )

Definition at line 504 of file perfpage.c.

Referenced by TaskManagerWndProc().

505 {
506  HMENU hMenu;
507  HMENU hViewMenu;
508  HMENU hCPUHistoryMenu;
509 
510  hMenu = GetMenu(hMainWnd);
511  hViewMenu = GetSubMenu(hMenu, 2);
512  hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
513 
516 }
#define MF_BYCOMMAND
Definition: winuser.h:202
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:33
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

◆ PerformancePage_OnViewCPUHistoryOneGraphPerCPU()

void PerformancePage_OnViewCPUHistoryOneGraphPerCPU ( void  )

Definition at line 518 of file perfpage.c.

Referenced by TaskManagerWndProc().

519 {
520  HMENU hMenu;
521  HMENU hViewMenu;
522  HMENU hCPUHistoryMenu;
523 
524  hMenu = GetMenu(hMainWnd);
525  hViewMenu = GetSubMenu(hMenu, 2);
526  hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
527 
530 }
#define TRUE
Definition: types.h:120
#define MF_BYCOMMAND
Definition: winuser.h:202
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:33
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

◆ PerformancePage_OnViewShowKernelTimes()

void PerformancePage_OnViewShowKernelTimes ( void  )

Definition at line 481 of file perfpage.c.

Referenced by TaskManagerWndProc().

482 {
483  HMENU hMenu;
484  HMENU hViewMenu;
485 
486  hMenu = GetMenu(hMainWnd);
487  hViewMenu = GetSubMenu(hMenu, 2);
488 
489  /* Check or uncheck the show 16-bit tasks menu item */
491  {
494  }
495  else
496  {
497  CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
499  }
500 
502 }
#define TRUE
Definition: types.h:120
#define MF_BYCOMMAND
Definition: winuser.h:202
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_CHECKED
Definition: winuser.h:132
void RefreshPerformancePage(void)
Definition: perfpage.c:306
#define ID_VIEW_SHOWKERNELTIMES
Definition: resource.h:161
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HWND hMainWnd
Definition: magnifier.c:33
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

◆ PerformancePageRefreshThread()

DWORD WINAPI PerformancePageRefreshThread ( void lpParameter)

Definition at line 315 of file perfpage.c.

Referenced by PerformancePageWndProc().

316 {
317  ULONGLONG CommitChargeTotal;
318  ULONGLONG CommitChargeLimit;
319  ULONGLONG CommitChargePeak;
320 
321  ULONG CpuUsage;
322  ULONG CpuKernelUsage;
323 
324  ULONGLONG KernelMemoryTotal;
325  ULONGLONG KernelMemoryPaged;
326  ULONGLONG KernelMemoryNonPaged;
327 
328  ULONGLONG PhysicalMemoryTotal;
329  ULONGLONG PhysicalMemoryAvailable;
330  ULONGLONG PhysicalMemorySystemCache;
331 
332  ULONG TotalHandles;
333  ULONG TotalThreads;
334  ULONG TotalProcesses;
335 
336  MSG msg;
337 
338  WCHAR Text[260];
339  WCHAR szMemUsage[256], szCpuUsage[256], szProcesses[256];
340 
341  LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256);
342  LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
343  LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, 256);
344 
345  while (1)
346  {
347  int nBarsUsed1;
348  int nBarsUsed2;
349 
350  WCHAR szChargeTotalFormat[256];
351  WCHAR szChargeLimitFormat[256];
352 
353  /* Wait for an the event or application close */
354  if (GetMessage(&msg, NULL, 0, 0) <= 0)
355  return 0;
356 
357  if (msg.message == WM_TIMER)
358  {
359  /*
360  * Update the commit charge info
361  */
362  CommitChargeTotal = PerfDataGetCommitChargeTotalK();
363  CommitChargeLimit = PerfDataGetCommitChargeLimitK();
364  CommitChargePeak = PerfDataGetCommitChargePeakK();
365  _ultow(CommitChargeTotal, Text, 10);
367  _ultow(CommitChargeLimit, Text, 10);
369  _ultow(CommitChargePeak, Text, 10);
371 
372  StrFormatByteSizeW(CommitChargeTotal * 1024,
373  szChargeTotalFormat,
374  _countof(szChargeTotalFormat));
375 
376  StrFormatByteSizeW(CommitChargeLimit * 1024,
377  szChargeLimitFormat,
378  _countof(szChargeLimitFormat));
379 
380  if (!bInMenuLoop)
381  {
382  wsprintfW(Text, szMemUsage, szChargeTotalFormat, szChargeLimitFormat,
383  (CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0));
385  }
386 
387  /*
388  * Update the kernel memory info
389  */
390  KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
391  KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
392  KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
393  _ultow(KernelMemoryTotal, Text, 10);
395  _ultow(KernelMemoryPaged, Text, 10);
397  _ultow(KernelMemoryNonPaged, Text, 10);
399 
400  /*
401  * Update the physical memory info
402  */
403  PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
404  PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
405  PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
406  _ultow(PhysicalMemoryTotal, Text, 10);
408  _ultow(PhysicalMemoryAvailable, Text, 10);
410  _ultow(PhysicalMemorySystemCache, Text, 10);
412 
413  /*
414  * Update the totals info
415  */
416  TotalHandles = PerfDataGetSystemHandleCount();
417  TotalThreads = PerfDataGetTotalThreadCount();
418  TotalProcesses = PerfDataGetProcessCount();
419  _ultow(TotalHandles, Text, 10);
421  _ultow(TotalThreads, Text, 10);
423  _ultow(TotalProcesses, Text, 10);
425  if (!bInMenuLoop)
426  {
427  wsprintfW(Text, szProcesses, TotalProcesses);
429  }
430 
431  /*
432  * Redraw the graphs
433  */
436 
437  /*
438  * Get the CPU usage
439  */
440  CpuUsage = PerfDataGetProcessorUsage();
441  if (CpuUsage <= 0 ) CpuUsage = 0;
442  if (CpuUsage > 100) CpuUsage = 100;
443 
444  if (!bInMenuLoop)
445  {
446  wsprintfW(Text, szCpuUsage, CpuUsage);
448  }
449 
451  {
452  CpuKernelUsage = PerfDataGetProcessorSystemUsage();
453  if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
454  if (CpuKernelUsage > 100) CpuKernelUsage = 100;
455  }
456  else
457  {
458  CpuKernelUsage = 0;
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_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
472  GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
473  /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
476  }
477  }
478  return 0;
479 }
ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
Definition: perfdata.c:1088
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HWND hStatusWnd
Definition: charmap.c:23
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
#define IDS_STATUS_PROCESSES
Definition: resource.h:256
ULONG PerfDataGetKernelMemoryNonPagedK(void)
Definition: perfdata.c:1037
_CRTIMP wchar_t *__cdecl _ultow(_In_ unsigned long _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
TGraphCtrl PerformancePageMemUsageHistoryGraph
Definition: perfpage.c:29
HWND hPerformancePageTotalsHandleCountEdit
Definition: perfpage.c:53
HWND hPerformancePageKernelMemoryPagedEdit
Definition: perfpage.c:48
HWND hPerformancePageMemUsageGraph
Definition: perfpage.c:33
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND hPerformancePageMemUsageHistoryGraph
Definition: perfpage.c:35
#define _countof(array)
Definition: fontsub.cpp:30
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND hPerformancePageCommitChargePeakEdit
Definition: perfpage.c:46
ULONG PerfDataGetCommitChargePeakK(void)
Definition: perfdata.c:980
HWND hPerformancePageKernelMemoryNonPagedEdit
Definition: perfpage.c:49
ULONG PerfDataGetCommitChargeLimitK(void)
Definition: perfdata.c:963
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
ULONG PerfDataGetTotalThreadCount(void)
Definition: perfdata.c:1116
ULONG PerfDataGetProcessorSystemUsage(void)
Definition: perfdata.c:490
TGraphCtrl PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28
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:1103
ULONG PerfDataGetPhysicalMemoryAvailableK(void)
Definition: perfdata.c:1071
LONG_PTR LPARAM
Definition: windef.h:208
ULONG PerfDataGetKernelMemoryPagedK(void)
Definition: perfdata.c:1020
smooth NULL
Definition: ftsmooth.c:416
HWND hPerformancePagePhysicalMemorySystemCacheEdit
Definition: perfpage.c:52
ULONG PerfDataGetProcessCount(void)
Definition: perfdata.c:472
HWND hPerformancePageCommitChargeLimitEdit
Definition: perfpage.c:45
uint64_t ULONGLONG
Definition: typedefs.h:65
#define WM_TIMER
Definition: winuser.h:1718
HWND hPerformancePageKernelMemoryTotalEdit
Definition: perfpage.c:47
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define IDS_STATUS_CPUUSAGE
Definition: resource.h:255
HWND hPerformancePageTotalsThreadCountEdit
Definition: perfpage.c:55
#define IDS_STATUS_MEMUSAGE
Definition: resource.h:254
#define SB_SETTEXT
Definition: commctrl.h:1919
double GraphCtrl_AppendPoint(TGraphCtrl *this, double dNewPoint0, double dNewPoint1, double dNewPoint2, double dNewPoint3)
Definition: graphctl.c:357
HWND hPerformancePageCpuUsageGraph
Definition: perfpage.c:32
ULONG PerfDataGetKernelMemoryTotalK(void)
Definition: perfdata.c:997
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 GetMessage
Definition: winuser.h:5656
ULONG PerfDataGetCommitChargeTotalK(void)
Definition: perfdata.c:946
ULONG PerfDataGetPhysicalMemoryTotalK(void)
Definition: perfdata.c:1054
#define msg(x)
Definition: auth_time.c:54
unsigned int ULONG
Definition: retypes.h:1
ULONG PerfDataGetProcessorUsage(void)
Definition: perfdata.c:481
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
HWND hPerformancePagePhysicalMemoryAvailableEdit
Definition: perfpage.c:51
BOOL bInMenuLoop
Definition: taskmgr.c:49
char * Text
Definition: combotst.c:136

◆ PerformancePageWndProc()

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

Definition at line 113 of file perfpage.c.

Referenced by OnCreate().

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  /* Save the width and height */
133  GetClientRect(hDlg, &rc);
136 
137  /* Update window position */
139 
140  /*
141  * Get handles to all the controls
142  */
147 
152 
165 
170 
172  /* create the control */
173  /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
175  /* customize the control */
177 /* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */
178 /* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */
179 /* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */
180 /* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */
181 /* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */
184 
187 
188 
195  /* Start our refresh thread */
196 #ifdef RUN_PERF_PAGE
198 #endif
199 
200  /*
201  * Subclass graph buttons
202  */
207  return TRUE;
208 
209  case WM_COMMAND:
210  break;
211 #if 0
212  case WM_NCPAINT:
213  hdc = GetDC(hDlg);
214  GetClientRect(hDlg, &rc);
216  ReleaseDC(hDlg, hdc);
217  break;
218 
219  case WM_PAINT:
220  hdc = BeginPaint(hDlg, &ps);
221  GetClientRect(hDlg, &rc);
223  EndPaint(hDlg, &ps);
224  break;
225 #endif
226  case WM_SIZE:
227  do {
228  int cx, cy;
229 
230  if (wParam == SIZE_MINIMIZED)
231  return 0;
232 
233  cx = LOWORD(lParam);
234  cy = HIWORD(lParam);
235  nXDifference = cx - nPerformancePageWidth;
236  nYDifference = cy - nPerformancePageHeight;
237  nPerformancePageWidth = cx;
238  nPerformancePageHeight = cy;
239  } while (0);
240 
241  /* Reposition the performance page's controls */
242  AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
243  AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
244  AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
245  AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
246  AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
247  AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
248  AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
249  AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
250  AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
251  AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
252  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
253  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
254  AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
255  AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
256  AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
257  AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
258 
271 
272  nXDifference += lastX;
273  nYDifference += lastY;
274  lastX = lastY = 0;
275  if (nXDifference % 2) {
276  if (nXDifference > 0) {
277  nXDifference--;
278  lastX++;
279  } else {
280  nXDifference++;
281  lastX--;
282  }
283  }
284  if (nYDifference % 2) {
285  if (nYDifference > 0) {
286  nYDifference--;
287  lastY++;
288  } else {
289  nYDifference++;
290  lastY--;
291  }
292  }
293  AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
294  AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
295  AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
296  AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
297  AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
298  AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
299  AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
300  AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
301  break;
302  }
303  return 0;
304 }
static HANDLE hPerformanceThread
Definition: perfpage.c:58
INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: graph.c:34
void GraphCtrl_SetBackgroundColor(TGraphCtrl *this, COLORREF color)
Definition: graphctl.c:178
#define IDC_PHYSICAL_MEMORY_TOTAL
Definition: resource.h:69
HWND hPerformancePageCpuUsageHistoryFrame
Definition: perfpage.c:42
#define COLOR_3DHILIGHT
Definition: winuser.h:927
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
TGraphCtrl PerformancePageMemUsageHistoryGraph
Definition: perfpage.c:29
#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 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:549
#define IDC_COMMIT_CHARGE_TOTAL
Definition: resource.h:59
HDC WINAPI GetDC(_In_opt_ HWND)
static DWORD dwPerformanceThread
Definition: perfpage.c:59
HWND hPerformancePageCommitChargeFrame
Definition: perfpage.c:37
HWND hPerformancePageMemUsageHistoryGraph
Definition: perfpage.c:35
WNDPROC OldGraphWndProc
Definition: graph.c:27
HWND hPerformancePageMemUsageHistoryFrame
Definition: perfpage.c:43
LONG top
Definition: windef.h:297
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:296
#define SWP_NOZORDER
Definition: winuser.h:1232
#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:1178
TGraphCtrl PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28
#define IDS_PHYSICAL_MEMORY_TOTAL
Definition: resource.h:130
LONG right
Definition: windef.h:298
INT_PTR CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: graphctl.c:543
void GraphCtrl_Dispose(TGraphCtrl *this)
Definition: graphctl.c:104
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define COLOR_3DSHADOW
Definition: winuser.h:921
#define IDC_PHYSICAL_MEMORY_AVAILABLE
Definition: resource.h:72
#define WM_NCPAINT
Definition: winuser.h:1669
#define IDS_PHYSICAL_MEMORY_AVAILABLE
Definition: resource.h:131
#define IDC_COMMIT_CHARGE_LIMIT
Definition: resource.h:62
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:570
HDC hdc
Definition: msvc.h:53
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:112
#define IDC_COMMIT_CHARGE_FRAME
Definition: resource.h:90
smooth NULL
Definition: ftsmooth.c:416
#define IDC_CPU_USAGE_HISTORY_FRAME
Definition: resource.h:108
HWND hPerformancePagePhysicalMemorySystemCacheEdit
Definition: perfpage.c:52
HWND hPerformancePagePhysicalMemoryFrame
Definition: perfpage.c:39
#define WM_DESTROY
Definition: winuser.h:1591
WNDPROC OldGraphCtrlWndProc
Definition: graphctl.c:27
void GraphCtrl_Create(TGraphCtrl *this, HWND hWnd, HWND hParentWnd, UINT nID)
Definition: graphctl.c:123
#define IDS_COMMIT_CHARGE_PEAK
Definition: resource.h:129
void GraphCtrl_SetRange(TGraphCtrl *this, double dLower, double dUpper, int nDecimalPlaces)
Definition: graphctl.c:134
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:1593
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:1227
void GraphCtrl_SetPlotColor(TGraphCtrl *this, int plot, COLORREF color)
Definition: graphctl.c:169
HWND hPerformancePageKernelMemoryTotalEdit
Definition: perfpage.c:47
#define RGB(r, g, b)
Definition: wingdi.h:2917
static int lastY
Definition: perfpage.c:64
#define IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
Definition: resource.h:132
#define SIZE_MINIMIZED
Definition: winuser.h:2460
HWND hPerformancePageTotalsThreadCountEdit
Definition: perfpage.c:55
#define WM_PAINT
Definition: winuser.h:1602
HWND hPerformancePageCpuUsageFrame
Definition: perfpage.c:40
#define IDS_KERNEL_MEMORY_NONPAGED
Definition: resource.h:135
void GraphCtrl_SetGridColor(TGraphCtrl *this, COLORREF color)
Definition: graphctl.c:162
#define IDC_TOTALS_PROCESS_COUNT
Definition: resource.h:56
#define WM_COMMAND
Definition: winuser.h:1716
#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:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
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
HWND hPerformancePageTotalsFrame
Definition: perfpage.c:36
#define IDC_MEM_USAGE_GRAPH
Definition: resource.h:118
_Out_opt_ int * cx
Definition: commctrl.h:570
#define HIWORD(l)
Definition: typedefs.h:246
#define IDS_COMMIT_CHARGE_TOTAL
Definition: resource.h:127
#define IDC_MEM_USAGE_HISTORY_GRAPH
Definition: resource.h:120
LONG bottom
Definition: windef.h:299
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5215
HWND hPerformancePagePhysicalMemoryAvailableEdit
Definition: perfpage.c:51
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
Definition: perfpage.c:315
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#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:1234
#define IDS_TOTALS_HANDLE_COUNT
Definition: resource.h:124

◆ RefreshPerformancePage()

void RefreshPerformancePage ( void  )

Definition at line 306 of file perfpage.c.

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

307 {
308 #ifdef RUN_PERF_PAGE
309  /* Signal the event so that our refresh thread */
310  /* will wake up and refresh the performance page */
312 #endif
313 }
static DWORD dwPerformanceThread
Definition: perfpage.c:59
#define WM_TIMER
Definition: winuser.h:1718
#define PostThreadMessage
Definition: winuser.h:5699

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.

◆ hPerformancePageCommitChargeLimitEdit

HWND hPerformancePageCommitChargeLimitEdit

Definition at line 45 of file perfpage.c.

◆ hPerformancePageCommitChargePeakEdit

HWND hPerformancePageCommitChargePeakEdit

Definition at line 46 of file perfpage.c.

◆ hPerformancePageCommitChargeTotalEdit

HWND hPerformancePageCommitChargeTotalEdit

Definition at line 44 of file perfpage.c.

◆ hPerformancePageCpuUsageFrame

HWND hPerformancePageCpuUsageFrame

Definition at line 40 of file perfpage.c.

◆ hPerformancePageCpuUsageGraph

HWND hPerformancePageCpuUsageGraph

Definition at line 32 of file perfpage.c.

◆ hPerformancePageCpuUsageHistoryFrame

HWND hPerformancePageCpuUsageHistoryFrame

Definition at line 42 of file perfpage.c.

◆ hPerformancePageCpuUsageHistoryGraph

HWND hPerformancePageCpuUsageHistoryGraph

Definition at line 34 of file perfpage.c.

Referenced by GraphCtrl_Resize().

◆ hPerformancePageKernelMemoryFrame

HWND hPerformancePageKernelMemoryFrame

Definition at line 38 of file perfpage.c.

◆ hPerformancePageKernelMemoryNonPagedEdit

HWND hPerformancePageKernelMemoryNonPagedEdit

Definition at line 49 of file perfpage.c.

◆ hPerformancePageKernelMemoryPagedEdit

HWND hPerformancePageKernelMemoryPagedEdit

Definition at line 48 of file perfpage.c.

◆ hPerformancePageKernelMemoryTotalEdit

HWND hPerformancePageKernelMemoryTotalEdit

Definition at line 47 of file perfpage.c.

◆ hPerformancePageMemUsageFrame

HWND hPerformancePageMemUsageFrame

Definition at line 41 of file perfpage.c.

◆ hPerformancePageMemUsageGraph

HWND hPerformancePageMemUsageGraph

Definition at line 33 of file perfpage.c.

◆ hPerformancePageMemUsageHistoryFrame

HWND hPerformancePageMemUsageHistoryFrame

Definition at line 43 of file perfpage.c.

◆ hPerformancePageMemUsageHistoryGraph

HWND hPerformancePageMemUsageHistoryGraph

Definition at line 35 of file perfpage.c.

Referenced by GraphCtrl_Resize().

◆ hPerformancePagePhysicalMemoryAvailableEdit

HWND hPerformancePagePhysicalMemoryAvailableEdit

Definition at line 51 of file perfpage.c.

◆ hPerformancePagePhysicalMemoryFrame

HWND hPerformancePagePhysicalMemoryFrame

Definition at line 39 of file perfpage.c.

◆ hPerformancePagePhysicalMemorySystemCacheEdit

HWND hPerformancePagePhysicalMemorySystemCacheEdit

Definition at line 52 of file perfpage.c.

◆ hPerformancePagePhysicalMemoryTotalEdit

HWND hPerformancePagePhysicalMemoryTotalEdit

Definition at line 50 of file perfpage.c.

◆ hPerformancePageTotalsFrame

HWND hPerformancePageTotalsFrame

Definition at line 36 of file perfpage.c.

◆ hPerformancePageTotalsHandleCountEdit

HWND hPerformancePageTotalsHandleCountEdit

Definition at line 53 of file perfpage.c.

◆ hPerformancePageTotalsProcessCountEdit

HWND hPerformancePageTotalsProcessCountEdit

Definition at line 54 of file perfpage.c.

◆ hPerformancePageTotalsThreadCountEdit

HWND hPerformancePageTotalsThreadCountEdit

Definition at line 55 of file perfpage.c.

◆ hPerformanceThread

HANDLE hPerformanceThread = NULL
static

Definition at line 58 of file perfpage.c.

◆ 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

TGraphCtrl PerformancePageCpuUsageHistoryGraph

Definition at line 28 of file perfpage.c.

Referenced by GraphCtrl_Resize().

◆ PerformancePageMemUsageHistoryGraph

TGraphCtrl PerformancePageMemUsageHistoryGraph

Definition at line 29 of file perfpage.c.

Referenced by GraphCtrl_Resize().