HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
+#ifdef RUN_PERF_PAGE
+static HANDLE hPerformanceThread = NULL;
+static DWORD dwPerformanceThread;
+#endif
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static int lastX, lastY;
-static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
InvalidateRect(hCntrl, NULL, TRUE);
}
-void AdjustControlPostion(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
+static void AdjustControlPostion(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
}
-void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
+static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
}
RECT rc;
int nXDifference;
int nYDifference;
-#ifdef RUN_PERF_PAGE
- HANDLE hRefreshThread = NULL;
-#endif
/* HDC hdc; */
/* PAINTSTRUCT ps; */
GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
#ifdef RUN_PERF_PAGE
- CloseHandle(hRefreshThread);
+ EndLocalThread(&hPerformanceThread, dwPerformanceThread);
#endif
break;
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
/* Start our refresh thread */
#ifdef RUN_PERF_PAGE
- hRefreshThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+ hPerformanceThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, &dwPerformanceThread);
#endif
/*
void RefreshPerformancePage(void)
{
+#ifdef RUN_PERF_PAGE
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
- SetEvent(hPerformancePageEvent);
+ PostThreadMessage(dwPerformanceThread, WM_TIMER, 0, 0);
+#endif
}
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
WCHAR Text[260];
WCHAR szMemUsage[256];
- /* Create the event */
- hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
-
- /* If we couldn't create the event then exit the thread */
- if (!hPerformancePageEvent)
- return 0;
+ MSG msg;
LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
while (1)
{
- DWORD dwWaitVal;
-
int nBarsUsed1;
int nBarsUsed2;
- /* 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)
+ /* Wait for an the event or application close */
+ if (GetMessage(&msg, NULL, 0, 0) <= 0)
return 0;
- if (dwWaitVal == WAIT_OBJECT_0)
+ if (msg.message == WM_TIMER)
{
- /* Reset our event */
- ResetEvent(hPerformancePageEvent);
-
/*
* Update the commit charge info
*/
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(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
}
}
- return 0;
+ return 0;
}
void PerformancePage_OnViewShowKernelTimes(void)