From 2ad5dd67023ca16fdf3803656461f810b647b669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Mon, 20 Dec 2021 03:19:38 +0200 Subject: [PATCH] [TASKMGR] Grab SMP taskmgr from herm ** WIP ** [TASKMGR] Get rid of thread-oriented updates. Just do it synchronously on WM_TIMER. ** WIP ** Merge RefreshPerformancePage() and PerformancePageRefreshThread(), now that we removed the separate performance page refreshing thread. - Use _ui64tow() instead of _ultow() for converting ULONGLONGs into a string representation. - Isolate the update of the status bar. - Isolate the actual graphs redrawing. The idea for later is to not trigger any redrawings (and run unnecessary code) if the page is deactivated. [TASKMGR] No need to get and save global handles for all the controls in the performance page. ... and especially for controls that are used only in one place. Only handles to the graph controls are sufficient. For the others, we can manage by using dialog control IDs. - Rename AdjustFrameSize() 'pos' parameter to be more explicit. ** WIP ** Group trios of Memory performance getters together, as they are always used in succession. - Group PerfDataGetCommitCharge[Total|Limit|Peak]K() together into PerfDataGetCommitChargeK(). - Group PerfDataGetKernelMemory[Total|Paged|NonPaged]K() together into PerfDataGetKernelMemoryK(). - Group PerfDataGetPhysicalMemory[Total|Available|SystemCache]K() together into PerfDataGetPhysicalMemoryK(). - Use these new Mem performance getters. [TASKMGR] Use owner-drawn performance graphs. - Use owner-drawn buttons to implement correct graph painting while maintaining the 3D appearance. As done on Windows (TM) Why using buttons (that should be disabled btw.)? Because we want, if the graphs fail to be created (due to e.g. lack of resources), to show a descriptive label of what's missing. This also allow the graphs to be drawn **properly** inside a 3D-border window. - Redraw graphs on WM_DRAWITEM. - Don't need to subclass button controls. - Use DeferWindowPos() to avoid controls blinking on resize. - Fix the problem of the buttons resizing as "1/x": this was due to the fact, using GetClientRect + Mapping, did't take the border into account. Instead, use GetWindowRect + a different coord mapping to fix all that. - Remove some dead code. - Rename the remaining ridiculously long variable names. ** WIP ** CPU/Mem meters: keep a separate copy of the CPU/Mem perf values. + Use structure for keeping state. ** WIP ** Add support for multiple-CPU stats. (In progress, needs code cleanup.) In particular, use SystemProcessorTimeInfo to calculate the idle time as done in ROSAPPS' ctm.exe, see commit c0873723. See also https://ladydebug.com/blog/codes/cpuusage_win.htm + Fix the problem of NtQuerySystemInformation(SystemPerformanceInformation) that shows up when running a 32-bit build under Windows 7 x64. ** WIP ** Investigating showing physical memory in the MEM gauge. --- base/applications/taskmgr/applpage.c | 40 +- base/applications/taskmgr/graph.c | 432 +++---------- base/applications/taskmgr/graph.h | 35 +- base/applications/taskmgr/graphctl.c | 146 +---- base/applications/taskmgr/graphctl.h | 12 +- base/applications/taskmgr/lang/bg-BG.rc | 8 +- base/applications/taskmgr/lang/cs-CZ.rc | 8 +- base/applications/taskmgr/lang/da-DK.rc | 8 +- base/applications/taskmgr/lang/de-DE.rc | 12 +- base/applications/taskmgr/lang/el-GR.rc | 8 +- base/applications/taskmgr/lang/en-US.rc | 8 +- base/applications/taskmgr/lang/es-ES.rc | 8 +- base/applications/taskmgr/lang/et-EE.rc | 8 +- base/applications/taskmgr/lang/fr-FR.rc | 8 +- base/applications/taskmgr/lang/he-IL.rc | 8 +- base/applications/taskmgr/lang/hu-HU.rc | 8 +- base/applications/taskmgr/lang/id-ID.rc | 8 +- base/applications/taskmgr/lang/it-IT.rc | 8 +- base/applications/taskmgr/lang/ja-JP.rc | 8 +- base/applications/taskmgr/lang/ko-KR.rc | 8 +- base/applications/taskmgr/lang/nl-NL.rc | 8 +- base/applications/taskmgr/lang/no-NO.rc | 8 +- base/applications/taskmgr/lang/pl-PL.rc | 8 +- base/applications/taskmgr/lang/pt-BR.rc | 8 +- base/applications/taskmgr/lang/pt-PT.rc | 8 +- base/applications/taskmgr/lang/ro-RO.rc | 12 +- base/applications/taskmgr/lang/ru-RU.rc | 8 +- base/applications/taskmgr/lang/sk-SK.rc | 8 +- base/applications/taskmgr/lang/sq-AL.rc | 8 +- base/applications/taskmgr/lang/sv-SE.rc | 8 +- base/applications/taskmgr/lang/tr-TR.rc | 8 +- base/applications/taskmgr/lang/uk-UA.rc | 8 +- base/applications/taskmgr/lang/zh-CN.rc | 8 +- base/applications/taskmgr/lang/zh-TW.rc | 8 +- base/applications/taskmgr/perfdata.c | 670 +++++++++++--------- base/applications/taskmgr/perfdata.h | 43 +- base/applications/taskmgr/perfpage.c | 811 +++++++++++++++--------- base/applications/taskmgr/perfpage.h | 10 +- base/applications/taskmgr/precomp.h | 6 +- base/applications/taskmgr/procpage.c | 39 +- base/applications/taskmgr/resource.h | 4 +- base/applications/taskmgr/taskmgr.c | 15 +- base/applications/taskmgr/taskmgr.h | 4 - 43 files changed, 1231 insertions(+), 1276 deletions(-) diff --git a/base/applications/taskmgr/applpage.c b/base/applications/taskmgr/applpage.c index 600592c10f857..8aeeb70898f8f 100644 --- a/base/applications/taskmgr/applpage.c +++ b/base/applications/taskmgr/applpage.c @@ -25,7 +25,7 @@ HWND hApplicationPageNewTaskButton; /* Application New Task button * static int nApplicationPageWidth; static int nApplicationPageHeight; static BOOL bSortAscending = TRUE; -DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter); +DWORD WINAPI ApplicationPageRefreshThread(PVOID Parameter); BOOL noApps; BOOL bApplicationPageSelectionMade = FALSE; @@ -38,11 +38,6 @@ void ApplicationPageShowContextMenu2(void); int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); int ProcGetIndexByProcessId(DWORD dwProcessId); -#ifdef RUN_APPS_PAGE -static HANDLE hApplicationThread = NULL; -static DWORD dwApplicationThread; -#endif - static INT GetSystemColorDepth(VOID) { @@ -131,21 +126,12 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) UpdateApplicationListControlViewSetting(); - /* Start our refresh thread */ -#ifdef RUN_APPS_PAGE - hApplicationThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, &dwApplicationThread); -#endif - /* Refresh page */ ApplicationPageUpdate(); return TRUE; case WM_DESTROY: - /* Close refresh thread */ -#ifdef RUN_APPS_PAGE - EndLocalThread(&hApplicationThread, dwApplicationThread); -#endif AppPageCleanup(); break; @@ -222,11 +208,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) void RefreshApplicationPage(void) { -#ifdef RUN_APPS_PAGE - /* Signal the event so that our refresh thread - * will wake up and refresh the application page */ - PostThreadMessage(dwApplicationThread, WM_TIMER, 0, 0); -#endif + ApplicationPageRefreshThread(NULL); } void UpdateApplicationListControlViewSetting(void) @@ -245,9 +227,9 @@ void UpdateApplicationListControlViewSetting(void) RefreshApplicationPage(); } -DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter) +DWORD WINAPI ApplicationPageRefreshThread(PVOID Parameter) { - MSG msg; + // MSG msg; INT i; BOOL bItemRemoved = FALSE; LV_ITEM item; @@ -255,14 +237,14 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter) HIMAGELIST hImageListLarge; HIMAGELIST hImageListSmall; - /* If we couldn't create the event then exit the thread */ - while (1) + ///* If we couldn't create the event then exit the thread */ + //while (1) { - /* Wait for an the event or application close */ - if (GetMessage(&msg, NULL, 0, 0) <= 0) - return 0; + ///* Wait for an the event or application close */ + //if (GetMessage(&msg, NULL, 0, 0) <= 0) + // return 0; - if (msg.message == WM_TIMER) + //if (msg.message == WM_TIMER) { // FIXME: Should this be EnumDesktopWindows() instead? noApps = TRUE; @@ -323,6 +305,8 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter) ApplicationPageUpdate(); } } + + return 0; } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) diff --git a/base/applications/taskmgr/graph.c b/base/applications/taskmgr/graph.c index f431bce46c9ad..93f7d275db3fd 100644 --- a/base/applications/taskmgr/graph.c +++ b/base/applications/taskmgr/graph.c @@ -3,206 +3,112 @@ * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) * PURPOSE: Performance Graph Meters. * COPYRIGHT: Copyright 1999-2001 Brian Palmer + * Copyright 2022 Hermès Bélusca-Maïto */ #include "precomp.h" -int nlastBarsUsed = 0; - -WNDPROC OldGraphWndProc; - -void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd); -void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd); -void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd); +/* Snapshot of instantaneous values */ +ULONGLONG Meter_CommitChargeTotal = 0; +ULONGLONG Meter_CommitChargeLimit = 0; INT_PTR CALLBACK -Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HDC hdc; - PAINTSTRUCT ps; - LONG WindowId; - - switch (message) - { - case WM_ERASEBKGND: - return TRUE; - - /* - * Filter out mouse & keyboard messages - */ - /* case WM_APPCOMMAND: */ - case WM_CAPTURECHANGED: - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MOUSEACTIVATE: - case WM_MOUSEHOVER: - case WM_MOUSELEAVE: - case WM_MOUSEMOVE: - /* case WM_MOUSEWHEEL: */ - case WM_NCHITTEST: - case WM_NCLBUTTONDBLCLK: - case WM_NCLBUTTONDOWN: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONDBLCLK: - case WM_NCMBUTTONDOWN: - case WM_NCMBUTTONUP: - /* case WM_NCMOUSEHOVER: */ - /* case WM_NCMOUSELEAVE: */ - case WM_NCMOUSEMOVE: - case WM_NCRBUTTONDBLCLK: - case WM_NCRBUTTONDOWN: - case WM_NCRBUTTONUP: - /* case WM_NCXBUTTONDBLCLK: */ - /* case WM_NCXBUTTONDOWN: */ - /* case WM_NCXBUTTONUP: */ - case WM_RBUTTONDBLCLK: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - /* case WM_XBUTTONDBLCLK: */ - /* case WM_XBUTTONDOWN: */ - /* case WM_XBUTTONUP: */ - case WM_ACTIVATE: - case WM_CHAR: - case WM_DEADCHAR: - case WM_GETHOTKEY: - case WM_HOTKEY: - case WM_KEYDOWN: - case WM_KEYUP: - case WM_KILLFOCUS: - case WM_SETFOCUS: - case WM_SETHOTKEY: - case WM_SYSCHAR: - case WM_SYSDEADCHAR: - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - - case WM_NCCALCSIZE: - return 0; - - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - - WindowId = GetWindowLongPtrW(hWnd, GWLP_ID); - - switch (WindowId) - { - case IDC_CPU_USAGE_GRAPH: - Graph_DrawCpuUsageGraph(hdc, hWnd); - break; - case IDC_MEM_USAGE_GRAPH: - Graph_DrawMemUsageGraph(hdc, hWnd); - break; - case IDC_MEM_USAGE_HISTORY_GRAPH: - Graph_DrawMemUsageHistoryGraph(hdc, hWnd); - break; - } - - EndPaint(hWnd, &ps); - return 0; - } - - /* - * Pass on all non-handled messages - */ - return CallWindowProcW(OldGraphWndProc, hWnd, message, wParam, lParam); -} - -void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) +Graph_DrawUsageGraph(HWND hWnd, PTM_GAUGE_CONTROL gauge, WPARAM wParam, LPARAM lParam) { RECT rcClient; RECT rcBarLeft; RECT rcBarRight; RECT rcText; COLORREF crPrevForeground; - WCHAR Text[260]; HFONT hOldFont; - ULONG CpuUsage; - ULONG CpuKernelUsage; - int nBars; - int nBarsUsed; -/* Bottom bars that are "used", i.e. are bright green, representing used cpu time */ - int nBarsUsedKernel; -/* Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time */ - int nBarsFree; -/* Top bars that are "unused", i.e. are dark green, representing free cpu time */ - int i; + WCHAR Text[260]; - /* - * Get the client area rectangle - */ +/* Total number of bars */ + int nBars; +/* Bottom bars that are "used", i.e. are bright green, representing used CPU time / used memory */ + int nBarsUsed = 0; +/* Bottom bars that are "used", i.e. are bright green, representing used CPU kernel time */ + int nBarsUsedKernel; +/* Top bars that are "unused", i.e. are dark green, representing free CPU time / free memory */ + int nBarsFree; + + int i; + + HDC hDC = (HDC)wParam; + + /* Get the client area rectangle */ GetClientRect(hWnd, &rcClient); - /* - * Fill it with blackness - */ + /* Fill it with blackness */ FillSolidRect(hDC, &rcClient, RGB(0, 0, 0)); - /* - * Get the CPU usage - */ - CpuUsage = PerfDataGetProcessorUsage(); - - wsprintfW(Text, L"%d%%", (int)CpuUsage); + if (gauge->bIsCPU) + { + /* Show the CPU usage */ + wsprintfW(Text, L"%lu%%", gauge->Current1); + } + else + { + /* Show the memory usage */ + if (Meter_CommitChargeTotal > 1024) + wsprintfW(Text, L"%lu MB", (ULONG)(Meter_CommitChargeTotal / 1024)); + else + wsprintfW(Text, L"%lu K", (ULONG)Meter_CommitChargeTotal); + } /* - * Draw the font text onto the graph + * Draw the text onto the graph */ rcText = rcClient; InflateRect(&rcText, -2, -2); - crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0)); + crPrevForeground = SetTextColor(hDC, BRIGHT_GREEN); hOldFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT)); DrawTextW(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); SelectObject(hDC, hOldFont); SetTextColor(hDC, crPrevForeground); /* - * Draw the graph. So first find out how many bars we can fit + * Now we have to draw the graph. + * So first find out how many bars we can fit. */ nBars = ((rcClient.bottom - rcClient.top) - 25) / 3; - nBarsUsed = (nBars * CpuUsage) / 100; - if ((CpuUsage) && (nBarsUsed == 0)) - { + nBarsUsed = (nBars * gauge->Current1) / 100; + if ((gauge->Current1 > 0) && (nBarsUsed == 0)) nBarsUsed = 1; - } - nBarsFree = nBars - (nlastBarsUsed>nBarsUsed ? nlastBarsUsed : nBarsUsed); - if (TaskManagerSettings.ShowKernelTimes) + if (gauge->bIsCPU) { - CpuKernelUsage = PerfDataGetProcessorSystemUsage(); - nBarsUsedKernel = (nBars * CpuKernelUsage) / 100; + nBarsFree = nBars - max(nBarsUsed, gauge->nlastBarsUsed); + + if (TaskManagerSettings.ShowKernelTimes) + nBarsUsedKernel = (nBars * gauge->Current2) / 100; + else + nBarsUsedKernel = 0; + + nBarsUsedKernel = min(max(nBarsUsedKernel, 0), nBars); } else { - nBarsUsedKernel = 0; + nBarsFree = nBars - nBarsUsed; } + nBarsUsed = min(max(nBarsUsed, 0), nBars); + nBarsFree = min(max(nBarsFree, 0), nBars); + /* * Draw the bar graph */ - rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2; - rcBarLeft.right = rcBarLeft.left + 16; + rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2; + rcBarLeft.right = rcBarLeft.left + 16; rcBarRight.left = rcBarLeft.left + 17; rcBarRight.right = rcBarLeft.right + 17; rcBarLeft.top = rcBarRight.top = 5; rcBarLeft.bottom = rcBarRight.bottom = 7; - if (nBarsUsed < 0) nBarsUsed = 0; - if (nBarsUsed > nBars) nBarsUsed = nBars; - - if (nBarsFree < 0) nBarsFree = 0; - if (nBarsFree > nBars) nBarsFree = nBars; - - if (nBarsUsedKernel < 0) nBarsUsedKernel = 0; - if (nBarsUsedKernel > nBars) nBarsUsedKernel = nBars; - /* * Draw the "free" bars */ - for (i=0; i 0) { - for (i=0; i< (nlastBarsUsed - nBarsUsed); i++) +#if 1 // TEST + + if (gauge->bIsCPU) + { + /* + * Draw the last "used" bars + */ + if ((gauge->nlastBarsUsed - nBarsUsed) > 0) { - if (nlastBarsUsed > 5000) nlastBarsUsed = 5000; + for (i = 0; i < (gauge->nlastBarsUsed - nBarsUsed); i++) + { + if (gauge->nlastBarsUsed > 5000) + gauge->nlastBarsUsed = 5000; - FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN); - FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN); + FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN); + FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN); - rcBarLeft.top += 3; - rcBarLeft.bottom += 3; + rcBarLeft.top += 3; + rcBarLeft.bottom += 3; - rcBarRight.top += 3; - rcBarRight.bottom += 3; + rcBarRight.top += 3; + rcBarRight.bottom += 3; + } } + gauge->nlastBarsUsed = nBarsUsed; } - nlastBarsUsed = nBarsUsed; + /* * Draw the "used" bars */ - for (i=0; i 5000) nBarsUsed = 5000; + if (gauge->bIsCPU) + { + if (nBarsUsed > 5000) + nBarsUsed = 5000; + } FillSolidRect(hDC, &rcBarLeft, BRIGHT_GREEN); FillSolidRect(hDC, &rcBarRight, BRIGHT_GREEN); @@ -250,188 +168,32 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) rcBarRight.bottom += 3; } - /* - * Draw the "used" kernel bars - */ - - rcBarLeft.top -=3; - rcBarLeft.bottom -=3; - - rcBarRight.top -=3; - rcBarRight.bottom -=3; - - for (i=0; ibIsCPU) { - FillSolidRect(hDC, &rcBarLeft, RED); - FillSolidRect(hDC, &rcBarRight, RED); + /* + * Draw the "used" kernel bars + */ rcBarLeft.top -=3; rcBarLeft.bottom -=3; rcBarRight.top -=3; rcBarRight.bottom -=3; - } - - SelectObject(hDC, hOldFont); -} -void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) -{ - RECT rcClient; - RECT rcBarLeft; - RECT rcBarRight; - RECT rcText; - COLORREF crPrevForeground; - WCHAR Text[260]; - HFONT hOldFont; - ULONGLONG CommitChargeTotal; - ULONGLONG CommitChargeLimit; - int nBars; - int nBarsUsed = 0; -/* Bottom bars that are "used", i.e. are bright green, representing used memory */ - int nBarsFree; -/* Top bars that are "unused", i.e. are dark green, representing free memory */ - int i; - - /* - * Get the client area rectangle - */ - GetClientRect(hWnd, &rcClient); - - /* - * Fill it with blackness - */ - FillSolidRect(hDC, &rcClient, RGB(0, 0, 0)); - - /* - * Get the memory usage - */ - CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK(); - CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK(); - - if (CommitChargeTotal > 1024) - wsprintfW(Text, L"%d MB", (int)(CommitChargeTotal / 1024)); - else - wsprintfW(Text, L"%d K", (int)CommitChargeTotal); - /* - * Draw the font text onto the graph - */ - rcText = rcClient; - InflateRect(&rcText, -2, -2); - crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0)); - hOldFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT)); - DrawTextW(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); - SelectObject(hDC, hOldFont); - SetTextColor(hDC, crPrevForeground); - - /* - * Draw the graph. So first find out how many bars we can fit - */ - nBars = ((rcClient.bottom - rcClient.top) - 25) / 3; - if (CommitChargeLimit) - nBarsUsed = (nBars * (int)((CommitChargeTotal * 100) / CommitChargeLimit)) / 100; - nBarsFree = nBars - nBarsUsed; - - if (nBarsUsed < 0) nBarsUsed = 0; - if (nBarsUsed > nBars) nBarsUsed = nBars; - - if (nBarsFree < 0) nBarsFree = 0; - if (nBarsFree > nBars) nBarsFree = nBars; - - /* - * Draw the bar graph - */ - rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2; - rcBarLeft.right = rcBarLeft.left + 16; - rcBarRight.left = rcBarLeft.left + 17; - rcBarRight.right = rcBarLeft.right + 17; - rcBarLeft.top = rcBarRight.top = 5; - rcBarLeft.bottom = rcBarRight.bottom = 7; - - /* - * Draw the "free" bars - */ - for (i=0; i= 10) - offset = 0; - - /* - * Get the client area rectangle - */ - GetClientRect(hWnd, &rcClient); - - /* - * Fill it with blackness - */ - FillSolidRect(hDC, &rcClient, RGB(0, 0, 0)); + for (i = 0; i < nBarsUsedKernel; i++) + { + FillSolidRect(hDC, &rcBarLeft, RED); + FillSolidRect(hDC, &rcBarRight, RED); - /* - * Get the memory usage - */ - //CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK(); + rcBarLeft.top -=3; + rcBarLeft.bottom -=3; - /* - * Draw the graph background and horizontal bars - */ - for (i=0; i=0; i--) - { - } + return 0; } diff --git a/base/applications/taskmgr/graph.h b/base/applications/taskmgr/graph.h index d2ada309b01f4..55651e37f48f8 100644 --- a/base/applications/taskmgr/graph.h +++ b/base/applications/taskmgr/graph.h @@ -3,25 +3,34 @@ * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) * PURPOSE: Performance Graph Meters * COPYRIGHT: Copyright 1999-2001 Brian Palmer + * Copyright 2022 Hermès Bélusca-Maïto */ #pragma once -#ifdef __cplusplus -extern "C" { -#endif +#define BRIGHT_GREEN RGB(0, 255, 0) +#define MEDIUM_GREEN RGB(0, 190, 0) +#define DARK_GREEN RGB(0, 130, 0) +#define RED RGB(255, 0, 0) +typedef struct _TM_GAUGE_CONTROL +{ + // HWND hParentWnd; + // HWND hWnd; + ULONG Current1; // Usage + ULONG Current2; + ULONG Maximum; // Limit + BOOL DrawSecondaryLevel; -#define BRIGHT_GREEN RGB(0, 255, 0) -#define MEDIUM_GREEN RGB(0, 190, 0) -#define DARK_GREEN RGB(0, 130, 0) -#define RED RGB(255, 0, 0) + INT nlastBarsUsed; -extern WNDPROC OldGraphWndProc; + /*** TEMP! ***/ + BOOL bIsCPU; // TRUE: Gauge for CPU; FALSE: Gauge for Memory +} TM_GAUGE_CONTROL, *PTM_GAUGE_CONTROL; -INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +/* Snapshot of instantaneous values */ +extern ULONGLONG Meter_CommitChargeTotal; +extern ULONGLONG Meter_CommitChargeLimit; - -#ifdef __cplusplus -}; -#endif +INT_PTR CALLBACK +Graph_DrawUsageGraph(HWND hWnd, PTM_GAUGE_CONTROL gauge, WPARAM wParam, LPARAM lParam); diff --git a/base/applications/taskmgr/graphctl.c b/base/applications/taskmgr/graphctl.c index 3f34ddf016ef9..db2bdac0d391b 100644 --- a/base/applications/taskmgr/graphctl.c +++ b/base/applications/taskmgr/graphctl.c @@ -9,10 +9,6 @@ #include "precomp.h" -#include - -WNDPROC OldGraphCtrlWndProc; - BOOL GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT fmt) { @@ -292,124 +288,38 @@ GraphCtrl_RedrawOnHeightChange(PTM_GRAPH_CONTROL inst, INT nh) GraphCtrl_RedrawBitmap(inst, nh); } -extern TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph; -extern TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph; -extern HWND hPerformancePageCpuUsageHistoryGraph; -extern HWND hPerformancePageMemUsageHistoryGraph; - INT_PTR CALLBACK -GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +GraphCtrl_OnSize(HWND hWnd, PTM_GRAPH_CONTROL graph, WPARAM wParam, LPARAM lParam) { - PTM_GRAPH_CONTROL graph; +#if 0 + RECT rcClient; + GetClientRect(hWnd, &rcClient); + // rcClient.bottom - rcClient.top is the sought new height. +#endif - switch (message) + if (HIWORD(lParam) != graph->BitmapHeight) { - case WM_ERASEBKGND: - return TRUE; - /* - * Filter out mouse & keyboard messages - */ - // case WM_APPCOMMAND: - case WM_CAPTURECHANGED: - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MOUSEACTIVATE: - case WM_MOUSEHOVER: - case WM_MOUSELEAVE: - case WM_MOUSEMOVE: - // case WM_MOUSEWHEEL: - case WM_NCHITTEST: - case WM_NCLBUTTONDBLCLK: - case WM_NCLBUTTONDOWN: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONDBLCLK: - case WM_NCMBUTTONDOWN: - case WM_NCMBUTTONUP: - // case WM_NCMOUSEHOVER: - // case WM_NCMOUSELEAVE: - case WM_NCMOUSEMOVE: - case WM_NCRBUTTONDBLCLK: - case WM_NCRBUTTONDOWN: - case WM_NCRBUTTONUP: - // case WM_NCXBUTTONDBLCLK: - // case WM_NCXBUTTONDOWN: - // case WM_NCXBUTTONUP: - case WM_RBUTTONDBLCLK: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - // case WM_XBUTTONDBLCLK: - // case WM_XBUTTONDOWN: - // case WM_XBUTTONUP: - case WM_ACTIVATE: - case WM_CHAR: - case WM_DEADCHAR: - case WM_GETHOTKEY: - case WM_HOTKEY: - case WM_KEYDOWN: - case WM_KEYUP: - case WM_KILLFOCUS: - case WM_SETFOCUS: - case WM_SETHOTKEY: - case WM_SYSCHAR: - case WM_SYSDEADCHAR: - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - return 0; - - case WM_NCCALCSIZE: - return 0; - - case WM_SIZE: - { - if (hWnd == hPerformancePageCpuUsageHistoryGraph) - graph = &PerformancePageCpuUsageHistoryGraph; - else if (hWnd == hPerformancePageMemUsageHistoryGraph) - graph = &PerformancePageMemUsageHistoryGraph; - else - return 0; - - if (HIWORD(lParam) != graph->BitmapHeight) - { - GraphCtrl_RedrawOnHeightChange(graph, HIWORD(lParam)); - } - InvalidateRect(hWnd, NULL, FALSE); - - return 0; - } - - case WM_PAINT: - { - RECT rcClient; - HDC hdc; - PAINTSTRUCT ps; - - if (hWnd == hPerformancePageCpuUsageHistoryGraph) - graph = &PerformancePageCpuUsageHistoryGraph; - else if (hWnd == hPerformancePageMemUsageHistoryGraph) - graph = &PerformancePageMemUsageHistoryGraph; - else - return 0; - - hdc = BeginPaint(hWnd, &ps); - GetClientRect(hWnd, &rcClient); - BitBlt(hdc, 0, 0, - rcClient.right, - rcClient.bottom, - graph->hdcGraph, - graph->BitmapWidth - rcClient.right, - 0, - SRCCOPY); - EndPaint(hWnd, &ps); - return 0; - } + GraphCtrl_RedrawOnHeightChange(graph, HIWORD(lParam)); } + InvalidateRect(hWnd, NULL, FALSE); + + return 0; +} - /* - * We pass on all non-handled messages - */ - return CallWindowProcW(OldGraphCtrlWndProc, hWnd, message, wParam, lParam); +INT_PTR CALLBACK +GraphCtrl_OnDraw(HWND hWnd, PTM_GRAPH_CONTROL graph, WPARAM wParam, LPARAM lParam) +{ + RECT rcClient; + HDC hdc = (HDC)wParam; + + GetClientRect(hWnd, &rcClient); + BitBlt(hdc, 0, 0, + rcClient.right, + rcClient.bottom, + graph->hdcGraph, + graph->BitmapWidth - rcClient.right, + 0, + SRCCOPY); + + return 0; } diff --git a/base/applications/taskmgr/graphctl.h b/base/applications/taskmgr/graphctl.h index 7fb84d291dbf9..562e2fd4c720c 100644 --- a/base/applications/taskmgr/graphctl.h +++ b/base/applications/taskmgr/graphctl.h @@ -12,10 +12,6 @@ #define NUM_PLOTS 2 #define PLOT_SHIFT 2 -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _TM_GRAPH_CONTROL { HWND hParentWnd; @@ -54,15 +50,11 @@ typedef struct _TM_FORMAT } TM_FORMAT, *PTM_FORMAT; -extern WNDPROC OldGraphCtrlWndProc; -INT_PTR CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK GraphCtrl_OnSize(HWND hWnd, PTM_GRAPH_CONTROL graph, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK GraphCtrl_OnDraw(HWND hWnd, PTM_GRAPH_CONTROL graph, WPARAM wParam, LPARAM lParam); BOOL GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT fmt); void GraphCtrl_Dispose(PTM_GRAPH_CONTROL inst); void GraphCtrl_AddPoint(PTM_GRAPH_CONTROL inst, BYTE val0, BYTE val1); void GraphCtrl_RedrawOnHeightChange(PTM_GRAPH_CONTROL inst, INT nh); void GraphCtrl_RedrawBitmap(PTM_GRAPH_CONTROL inst, INT h); - -#ifdef __cplusplus -} -#endif diff --git a/base/applications/taskmgr/lang/bg-BG.rc b/base/applications/taskmgr/lang/bg-BG.rc index af29ee591d1e2..2385b25ffbf1b 100644 --- a/base/applications/taskmgr/lang/bg-BG.rc +++ b/base/applications/taskmgr/lang/bg-BG.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Дневник на ЦПУ", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Дневник на паметта", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Показване заетостта на паметта", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Дневник на ЦПУ", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Дневник на паметта", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Показване заетостта на паметта", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Дневник на ЦПУ", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Дневник на паметта", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/cs-CZ.rc b/base/applications/taskmgr/lang/cs-CZ.rc index a2e7aaf3daa1f..7a93ffbf3b653 100644 --- a/base/applications/taskmgr/lang/cs-CZ.rc +++ b/base/applications/taskmgr/lang/cs-CZ.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Historie využití CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Historie využití paměti", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Zobrazení využití CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Zobrazení využití paměti", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historie využití CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historie využití paměti", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Zobrazení využití CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Zobrazení využití paměti", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historie využití CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historie využití paměti", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/da-DK.rc b/base/applications/taskmgr/lang/da-DK.rc index 3544f53cf47e0..08d09bce337ba 100644 --- a/base/applications/taskmgr/lang/da-DK.rc +++ b/base/applications/taskmgr/lang/da-DK.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU Usage History", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "MEM Hukommelses Forbrug Historik", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Forbrug Visning", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Hukommelses Forbrug Visning", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU Forbrug Historik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Hukommelses Forbrug Historik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Forbrug Visning", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Hukommelses Forbrug Visning", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Forbrug Historik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Hukommelses Forbrug Historik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/de-DE.rc b/base/applications/taskmgr/lang/de-DE.rc index 879e1b7734478..e674e070f7a02 100644 --- a/base/applications/taskmgr/lang/de-DE.rc +++ b/base/applications/taskmgr/lang/de-DE.rc @@ -224,12 +224,12 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_NONPAGED, 192, 193, 45, 8, ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - GROUPBOX "CPU-Lastverlauf", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT - GROUPBOX "Speicher-Lastverlauf", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU-Lastanzeige", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Speicher-Lastanzeige", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU-Lastverlaufsanzeige", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Speicher-Lastverlaufsanzeige", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + GROUPBOX "Verlauf der CPU-Auslastung", IDC_CPU_USAGE_HISTORY_FRAME, 76, 5, 166, 54, 0, WS_EX_TRANSPARENT + GROUPBOX "Verlauf der Auslagerungsdateiauslastung", IDC_MEMORY_USAGE_HISTORY_FRAME, 76, 63, 166, 54, 0, WS_EX_TRANSPARENT + PUSHBUTTON "CPU-Auslastungsanzeige", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Auslagerungsdateiauslastungsanzeige", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU-Auslastungsverlaufsanzeige", IDC_CPU_USAGE_HISTORY_GRAPH, 82, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Auslagerungsdateiauslastungs-Verlaufsanzeige", IDC_MEM_USAGE_HISTORY_GRAPH, 82, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/el-GR.rc b/base/applications/taskmgr/lang/el-GR.rc index adda7456f13f2..e6102322b8c97 100644 --- a/base/applications/taskmgr/lang/el-GR.rc +++ b/base/applications/taskmgr/lang/el-GR.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU Usage History", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Memory Usage History", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/en-US.rc b/base/applications/taskmgr/lang/en-US.rc index 486fbbf4c179f..73bedca3169c1 100644 --- a/base/applications/taskmgr/lang/en-US.rc +++ b/base/applications/taskmgr/lang/en-US.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU Usage History", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Memory Usage History", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/es-ES.rc b/base/applications/taskmgr/lang/es-ES.rc index 4adf34ed70141..08d15c21606a0 100644 --- a/base/applications/taskmgr/lang/es-ES.rc +++ b/base/applications/taskmgr/lang/es-ES.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Historial de uso de CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Historial de uso de memoria física", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Gráfico de uso de CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Gráfico de uso de memoria", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historial de uso de CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historial de uso de memoria", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Gráfico de uso de CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Gráfico de uso de memoria", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historial de uso de CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historial de uso de memoria", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/et-EE.rc b/base/applications/taskmgr/lang/et-EE.rc index 3b05f14a99c51..0d4088f3adc80 100644 --- a/base/applications/taskmgr/lang/et-EE.rc +++ b/base/applications/taskmgr/lang/et-EE.rc @@ -230,10 +230,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU hõivatuse ajalugu", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Füüsilise mälu hõivatuse ajalugu", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU hõivatuse kuva", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Füüsilise mälu hõivatuse kuva", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU hõivatuse ajalugu", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Füüsilise mälu hõivatuse ajalugu", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU hõivatuse kuva", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Füüsilise mälu hõivatuse kuva", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU hõivatuse ajalugu", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Füüsilise mälu hõivatuse ajalugu", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/fr-FR.rc b/base/applications/taskmgr/lang/fr-FR.rc index ed8e3cfe49b1f..f7e985f64ead2 100644 --- a/base/applications/taskmgr/lang/fr-FR.rc +++ b/base/applications/taskmgr/lang/fr-FR.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Historique de l'utilisation de l'UC", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Historique d'utilisation de la mémoire", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Affichage de l'utilisation de l'UC", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Affichage de l'utilisation du fichier d'échange", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historique de l'utilisation de l'UC", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historique d'utilisation du fichier d'échange", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Affichage de l'utilisation de l'UC", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Affichage de l'utilisation du fichier d'échange", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historique de l'utilisation de l'UC", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historique d'utilisation du fichier d'échange", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/he-IL.rc b/base/applications/taskmgr/lang/he-IL.rc index 4025b2a04f7b0..495571b6ed286 100644 --- a/base/applications/taskmgr/lang/he-IL.rc +++ b/base/applications/taskmgr/lang/he-IL.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "היסטורית שימוש במעבד", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "היסטורית שימוש בזיכרון", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "היסטורית שימוש במעבד", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "היסטורית שימוש בזיכרון", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "היסטורית שימוש במעבד", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "היסטורית שימוש בזיכרון", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/hu-HU.rc b/base/applications/taskmgr/lang/hu-HU.rc index f5e9f98b82c58..3a71ee22fd5cb 100644 --- a/base/applications/taskmgr/lang/hu-HU.rc +++ b/base/applications/taskmgr/lang/hu-HU.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU használat", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Memória használat", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU használat megjelenítése", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Memória használat megjelenítése", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU használata", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Memória használata", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU használat megjelenítése", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Memória használat megjelenítése", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU használata", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Memória használata", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/id-ID.rc b/base/applications/taskmgr/lang/id-ID.rc index 092eb8a28e882..fe1b350525b6b 100644 --- a/base/applications/taskmgr/lang/id-ID.rc +++ b/base/applications/taskmgr/lang/id-ID.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Riwayat Pemakaian CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Riwayat Pemakaian MEM", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Tampilan Pemakaian CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Tampilan Pemakaian MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Riwayat Pemakaian CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Riwayat Pemakaian MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Tampilan Pemakaian CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Tampilan Pemakaian MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Riwayat Pemakaian CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Riwayat Pemakaian MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/it-IT.rc b/base/applications/taskmgr/lang/it-IT.rc index ad29ab1a300fe..6e29a24b57e4a 100644 --- a/base/applications/taskmgr/lang/it-IT.rc +++ b/base/applications/taskmgr/lang/it-IT.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Storico uso CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Storico uso Memoria", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Visualizzazione uso CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Visualizzazione uso MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Storico uso CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Storico uso MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Visualizzazione uso CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Visualizzazione uso MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Storico uso CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Storico uso MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/ja-JP.rc b/base/applications/taskmgr/lang/ja-JP.rc index 73d50e9389df1..858602c343f5c 100644 --- a/base/applications/taskmgr/lang/ja-JP.rc +++ b/base/applications/taskmgr/lang/ja-JP.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU 使用率の履歴", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "メモリ使用量の履歴", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU 使用率の表示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "メモリ使用量の表示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU 使用率の履歴", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "メモリ使用量の履歴", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用率の表示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "メモリ使用量の表示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用率の履歴", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "メモリ使用量の履歴", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/ko-KR.rc b/base/applications/taskmgr/lang/ko-KR.rc index 9e1845928161e..3fae1fa16d592 100644 --- a/base/applications/taskmgr/lang/ko-KR.rc +++ b/base/applications/taskmgr/lang/ko-KR.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU 사용 기록", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "메모리 사용 기록", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU 사용 표시", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "메모리 사용 표시", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU 사용 기록", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "메모리 사용 기록", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 사용 표시", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "메모리 사용 표시", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 사용 기록", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "메모리 사용 기록", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/nl-NL.rc b/base/applications/taskmgr/lang/nl-NL.rc index e4cc45177c60d..070dee32ec523 100644 --- a/base/applications/taskmgr/lang/nl-NL.rc +++ b/base/applications/taskmgr/lang/nl-NL.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Geschiedenis van CPU gebruik", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Geschiedenis van wisselbestandsgebruik", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Weergave van CPU-gebruik", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Weergave van wisselbestandsgebruik", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Geschiedenis van CPU gebruik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Geschiedenis van wisselbestandsgebruik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Weergave van CPU-gebruik", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Weergave van wisselbestandsgebruik", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Geschiedenis van CPU gebruik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Geschiedenis van wisselbestandsgebruik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/no-NO.rc b/base/applications/taskmgr/lang/no-NO.rc index 4f48bb47c8a17..39a41c86cf96a 100644 --- a/base/applications/taskmgr/lang/no-NO.rc +++ b/base/applications/taskmgr/lang/no-NO.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Logg for bruk av prosessor", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Logg for bruk av fysisk minne", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Vis prosessorbruk", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Vis minnebruk", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Logg for prosessorbruk", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Minne bruk historie", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Vis prosessorbruk", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Vis minnebruk", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Logg for prosessorbruk", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Minne bruk historie", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/pl-PL.rc b/base/applications/taskmgr/lang/pl-PL.rc index b9e2f36ce16fb..f001f9e460483 100644 --- a/base/applications/taskmgr/lang/pl-PL.rc +++ b/base/applications/taskmgr/lang/pl-PL.rc @@ -229,10 +229,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Historia użycia procesora CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Historia uzycia pliku stronicowania MEM", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Wyświetl użycie procesora", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Wyświetl zużycie pamięci", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historia użycia procesora", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historia zużycia pamięci", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Wyświetl użycie procesora", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Wyświetl zużycie pamięci", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historia użycia procesora", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historia zużycia pamięci", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/pt-BR.rc b/base/applications/taskmgr/lang/pt-BR.rc index 8ec0206817bf8..331403260e08f 100644 --- a/base/applications/taskmgr/lang/pt-BR.rc +++ b/base/applications/taskmgr/lang/pt-BR.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Histórico de uso de CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Histórico de uso de Memoria", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage Display", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage Display", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Usage History", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "MEM Usage History", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/pt-PT.rc b/base/applications/taskmgr/lang/pt-PT.rc index 7502325c16b6d..3e30cb682a3c4 100644 --- a/base/applications/taskmgr/lang/pt-PT.rc +++ b/base/applications/taskmgr/lang/pt-PT.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Histórico de uso de CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Histórico de uso de Memoria", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Mostra o uso da CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Mostra o uso da RAM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Histórico de uso da CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Histórico de uso da memória RAM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Mostra o uso da CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Mostra o uso da RAM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Histórico de uso da CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Histórico de uso da memória RAM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/ro-RO.rc b/base/applications/taskmgr/lang/ro-RO.rc index 797ee7667cf3e..aa659a3ffd762 100644 --- a/base/applications/taskmgr/lang/ro-RO.rc +++ b/base/applications/taskmgr/lang/ro-RO.rc @@ -231,12 +231,12 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_NONPAGED, 192, 193, 45, 8, ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - GROUPBOX "Istoric utilizare CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT - GROUPBOX "Istoric utilizare memorie", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Afișare utilizare CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Afișare utilizare memorie", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Afișare istoric utlizare procesor", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Afișare istoric utlizare memorie", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + GROUPBOX "Istoricul încărcăturii de procesor", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT + GROUPBOX "Istoricul încărcăturii de memorie", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT + PUSHBUTTON "Afișaj încărcătură procesor", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Afișaj încărcătură memorie", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Afișaj istoric încărcătură procesor", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Afișaj istoric încărcătură memorie", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/ru-RU.rc b/base/applications/taskmgr/lang/ru-RU.rc index a33c5828144ad..5d54833ec0107 100644 --- a/base/applications/taskmgr/lang/ru-RU.rc +++ b/base/applications/taskmgr/lang/ru-RU.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Хронология загрузки ЦП", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Хронология использования файла подкачки", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Отображение загрузки ЦП", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Отображение использования памяти", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Хронология загрузки ЦП", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Хронология использования памяти", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Отображение загрузки ЦП", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Отображение использования памяти", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Хронология загрузки ЦП", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Хронология использования памяти", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/sk-SK.rc b/base/applications/taskmgr/lang/sk-SK.rc index f3b7b557c1f68..74e9cdadbbdb6 100644 --- a/base/applications/taskmgr/lang/sk-SK.rc +++ b/base/applications/taskmgr/lang/sk-SK.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "História využitia procesora", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "História využitia stránkovacieho súboru", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Zobrazenie využitia procesora", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Zobrazenie využitia pamäte", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "História využitia procesora", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "História využitia pamäte", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Zobrazenie využitia procesora", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Zobrazenie využitia pamäte", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "História využitia procesora", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "História využitia pamäte", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 270, 154 diff --git a/base/applications/taskmgr/lang/sq-AL.rc b/base/applications/taskmgr/lang/sq-AL.rc index b6a1e7a9b541c..876aa3c49af1c 100644 --- a/base/applications/taskmgr/lang/sq-AL.rc +++ b/base/applications/taskmgr/lang/sq-AL.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Historia e perdorimit CPU", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Historia e perdorimit Memories", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Shfaq perdorimin e CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Shfaq perdorimin e MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historia e perdorimit CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Historia e perdorimit MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Shfaq perdorimin e CPU", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Shfaq perdorimin e MEM", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historia e perdorimit CPU", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Historia e perdorimit MEM", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/sv-SE.rc b/base/applications/taskmgr/lang/sv-SE.rc index 8dbfa84cca5fe..e0a5cb22eb0a5 100644 --- a/base/applications/taskmgr/lang/sv-SE.rc +++ b/base/applications/taskmgr/lang/sv-SE.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Processorhistorik", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Minneshistorik", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Processoranvändning", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Minnesanvändning", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Processorhistorik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Minneshistorik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Processoranvändning", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Minnesanvändning", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Processorhistorik", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Minneshistorik", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/tr-TR.rc b/base/applications/taskmgr/lang/tr-TR.rc index 17d60b6389b6f..af45c8362ea87 100644 --- a/base/applications/taskmgr/lang/tr-TR.rc +++ b/base/applications/taskmgr/lang/tr-TR.rc @@ -226,10 +226,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU Kullanım Geçmişi", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Bellek Kullanım Geçmişi", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU Kullanım Grafiği", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Bellek Kullanım Grafiği", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU Kullanım Geçmişi Grafiği", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Bellek Kullanım Geçmişi Grafiği", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Kullanım Grafiği", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Bellek Kullanım Grafiği", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU Kullanım Geçmişi Grafiği", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Bellek Kullanım Geçmişi Grafiği", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/uk-UA.rc b/base/applications/taskmgr/lang/uk-UA.rc index 422f99798f4ef..4d5fd62c338a9 100644 --- a/base/applications/taskmgr/lang/uk-UA.rc +++ b/base/applications/taskmgr/lang/uk-UA.rc @@ -224,10 +224,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "Хронологія використання ЦП", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "Хронологія використання пам'яті", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "Відображення використання ЦП", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Відображення використання пам'яті", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Хронологія використання ЦП", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "Хронологія використання пам'яті", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Відображення використання ЦП", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Відображення використання пам'яті", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Хронологія використання ЦП", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "Хронологія використання пам'яті", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/zh-CN.rc b/base/applications/taskmgr/lang/zh-CN.rc index 0fc031c054404..24528b66fb762 100644 --- a/base/applications/taskmgr/lang/zh-CN.rc +++ b/base/applications/taskmgr/lang/zh-CN.rc @@ -227,10 +227,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU 使用记录", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "内存使用记录", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU 使用情况显示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "内存使用情况显示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU 使用记录", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "内存使用记录", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用情况显示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "内存使用情况显示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用记录", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "内存使用记录", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/lang/zh-TW.rc b/base/applications/taskmgr/lang/zh-TW.rc index 5e76b4479f3d3..9d5a785e74867 100644 --- a/base/applications/taskmgr/lang/zh-TW.rc +++ b/base/applications/taskmgr/lang/zh-TW.rc @@ -232,10 +232,10 @@ BEGIN ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP GROUPBOX "CPU 使用記錄", IDC_CPU_USAGE_HISTORY_FRAME, 74, 5, 168, 54, 0, WS_EX_TRANSPARENT GROUPBOX "記憶體使用記錄", IDC_MEMORY_USAGE_HISTORY_FRAME, 74, 63, 168, 54, 0, WS_EX_TRANSPARENT - PUSHBUTTON "CPU 使用情況顯示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "記憶體使用情況顯示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "CPU 使用記錄", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON "記憶體使用記錄", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用情況顯示", IDC_CPU_USAGE_GRAPH, 12, 17, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "記憶體使用情況顯示", IDC_MEM_USAGE_GRAPH, 12, 75, 47, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "CPU 使用記錄", IDC_CPU_USAGE_HISTORY_GRAPH, 81, 17, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE + PUSHBUTTON "記憶體使用記錄", IDC_MEM_USAGE_HISTORY_GRAPH, 81, 75, 153, 37, BS_OWNERDRAW | NOT WS_TABSTOP, WS_EX_CLIENTEDGE END IDD_AFFINITY_DIALOG DIALOGEX 0, 0, 231, 154 diff --git a/base/applications/taskmgr/perfdata.c b/base/applications/taskmgr/perfdata.c index 7f0869a575260..f3b4b0acccf60 100644 --- a/base/applications/taskmgr/perfdata.c +++ b/base/applications/taskmgr/perfdata.c @@ -15,22 +15,32 @@ #include #include -CRITICAL_SECTION PerfDataCriticalSection; -PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ -PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ -ULONG ProcessCountOld = 0; -ULONG ProcessCount = 0; -double dbIdleTime; -double dbKernelTime; -double dbSystemTime; -LARGE_INTEGER liOldIdleTime = {{0,0}}; -double OldKernelTime = 0; -LARGE_INTEGER liOldSystemTime = {{0,0}}; -SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo; +CRITICAL_SECTION PerfDataCriticalSection; +PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ +PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ +ULONG ProcessCountOld = 0; +ULONG ProcessCount = 0; + +typedef struct _CPU_TIMES +{ + double dbIdleTime; + double dbKernelTime; + + LARGE_INTEGER OldIdleTime; + LARGE_INTEGER OldKernelTime; +} CPU_TIMES, *PCPU_TIMES; + +static PCPU_TIMES ProcessorTimes = NULL; +static CPU_TIMES ProcessorMeanTimes = {0}; + +double dbSystemTime; +LARGE_INTEGER OldSystemTime = {{0,0}}; + SYSTEM_BASIC_INFORMATION SystemBasicInfo; -SYSTEM_FILECACHE_INFORMATION SystemCacheInfo; -ULONG SystemNumberOfHandles; PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL; +SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo = {0}; +SYSTEM_FILECACHE_INFORMATION SystemCacheInfo = {0}; +ULONG SystemNumberOfHandles = 0; PSID SystemUserSid = NULL; PCMD_LINE_CACHE global_cache = NULL; @@ -46,38 +56,71 @@ typedef struct _SIDTOUSERNAME static LIST_ENTRY SidToUserNameHead = {&SidToUserNameHead, &SidToUserNameHead}; -BOOL PerfDataInitialize(void) +/*static*/ VOID +__cdecl +_DiagError( + _In_ PCWSTR Format, + ...) +{ + va_list args; + WCHAR Buffer[1024]; + + va_start(args, Format); + StringCbVPrintfW(Buffer, sizeof(Buffer), Format, args); + va_end(args); + + MessageBoxW(NULL, Buffer, L"Error", MB_ICONERROR | MB_OK); +} + +BOOL PerfDataInitialize(VOID) { SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; - NTSTATUS status; + NTSTATUS status; + ULONG BufferSize; InitializeCriticalSection(&PerfDataCriticalSection); - /* - * Get number of processors in the system - */ + /* Retrieve basic system information, including the number of processors in the system */ status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL); if (!NT_SUCCESS(status)) + { + // ZeroMemory(&SystemBasicInfo, sizeof(SystemBasicInfo)); return FALSE; + } - /* - * Create the SYSTEM Sid - */ + /* Allocate the array for per-processor time information */ + // TODO: For supporting more CPUs, see e.g. + // https://github.com/processhacker/processhacker/commit/8b3a09f99d06e45df64bfee2ce4c91d7c02b8b3d + // but this should be Win7+. + BufferSize = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors; + SystemProcessorTimeInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + + /* Allocate an array for per-CPU times. If allocation fails (e.g. + * low memory resources), use the mean times instead. */ + ProcessorTimes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(CPU_TIMES) * SystemBasicInfo.NumberOfProcessors); + if (!ProcessorTimes) + ProcessorTimes = &ProcessorMeanTimes; + + /* Create the SYSTEM Sid */ AllocateAndInitializeSid(&NtSidAuthority, 1, SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, &SystemUserSid); return TRUE; } -void PerfDataUninitialize(void) +VOID PerfDataUninitialize(VOID) { PLIST_ENTRY pCur; PSIDTOUSERNAME pEntry; - if (pPerfData != NULL) + if (pPerfData) + { HeapFree(GetProcessHeap(), 0, pPerfData); + pPerfData = NULL; + } DeleteCriticalSection(&PerfDataCriticalSection); - if (SystemUserSid != NULL) + if (SystemUserSid) { FreeSid(SystemUserSid); SystemUserSid = NULL; @@ -92,12 +135,24 @@ void PerfDataUninitialize(void) HeapFree(GetProcessHeap(), 0, pEntry); } - if (SystemProcessorTimeInfo) { + if (ProcessorTimes && (ProcessorTimes != &ProcessorMeanTimes)) + { + HeapFree(GetProcessHeap(), 0, ProcessorTimes); + ProcessorTimes = NULL; + } + + if (SystemProcessorTimeInfo) + { HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo); + SystemProcessorTimeInfo = NULL; } } -static void SidToUserName(PSID Sid, LPWSTR szBuffer, DWORD BufferSize) +static VOID +SidToUserName( + _In_ PSID Sid, + _Out_ LPWSTR szBuffer, + _In_ DWORD BufferSize) { static WCHAR szDomainNameUnused[255]; DWORD DomainNameLen = _countof(szDomainNameUnused); @@ -107,12 +162,13 @@ static void SidToUserName(PSID Sid, LPWSTR szBuffer, DWORD BufferSize) LookupAccountSidW(NULL, Sid, szBuffer, &BufferSize, szDomainNameUnused, &DomainNameLen, &Use); } +/* Should be from utildll.dll */ VOID WINAPI CachedGetUserFromSid( - PSID pSid, - LPWSTR pUserName, - PULONG pcwcUserName) + _In_ PSID pSid, + _Out_ LPWSTR pUserName, + _Inout_ PULONG pcwcUserName) { PLIST_ENTRY pCur; PSIDTOUSERNAME pEntry; @@ -121,9 +177,9 @@ CachedGetUserFromSid( cwcUserName = *pcwcUserName; /* Walk through the list */ - for(pCur = SidToUserNameHead.Flink; - pCur != &SidToUserNameHead; - pCur = pCur->Flink) + for (pCur = SidToUserNameHead.Flink; + pCur != &SidToUserNameHead; + pCur = pCur->Flink) { pEntry = CONTAINING_RECORD(pCur, SIDTOUSERNAME, List); if (EqualSid((PSID)&pEntry->Data, pSid)) @@ -149,73 +205,93 @@ CachedGetUserFromSid( wcsncpy(pEntry->pszName, pUserName, cwcUserName); /* Insert the new entry */ + // InsertHeadList(); pEntry->List.Flink = &SidToUserNameHead; pEntry->List.Blink = SidToUserNameHead.Blink; SidToUserNameHead.Blink->Flink = &pEntry->List; SidToUserNameHead.Blink = &pEntry->List; } -void PerfDataRefresh(void) +VOID PerfDataRefresh(VOID) { - ULONG ulSize; - NTSTATUS status; - LPBYTE pBuffer; - ULONG BufferSize; - PSYSTEM_PROCESS_INFORMATION pSPI; - PPERFDATA pPDOld; - ULONG Idx, Idx2; - HANDLE hProcess; - HANDLE hProcessToken; - SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo; - SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo; - SYSTEM_FILECACHE_INFORMATION SysCacheInfo; - SYSTEM_HANDLE_INFORMATION SysHandleInfoData; - PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo; - double CurrentKernelTime; - PSECURITY_DESCRIPTOR ProcessSD; - PSID ProcessUser; - ULONG Buffer[64]; /* must be 4 bytes aligned! */ - ULONG cwcUserName; + ULONG ulSize; + NTSTATUS status; + LPBYTE pBuffer; + ULONG BufferSize; + PSYSTEM_PROCESS_INFORMATION pSPI; + PPERFDATA pPDOld; + ULONG Idx, Idx2; + HANDLE hProcess; + HANDLE hProcessToken; + + SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo = {0}; +#if (NTDDI_VERSION < NTDDI_WIN7) + /* Larger on Win2k8/Win7 */ + DECLSPEC_ALIGN(8) BYTE SysPerfInfoData[sizeof(SYSTEM_PERFORMANCE_INFORMATION) + 16] = {0}; +#else + SYSTEM_PERFORMANCE_INFORMATION SysPerfInfoData = {0}; +#endif + PSYSTEM_PERFORMANCE_INFORMATION pSysPerfInfo = (PSYSTEM_PERFORMANCE_INFORMATION)SysPerfInfoData; + SYSTEM_FILECACHE_INFORMATION SysCacheInfo = {0}; + SYSTEM_HANDLE_INFORMATION SysHandleInfo = {0}; + + LARGE_INTEGER CurrentIdleTime, MeanIdleTime; + LARGE_INTEGER CurrentKernelTime, MeanKernelTime; + LARGE_INTEGER liCurrentTime; + + PSECURITY_DESCRIPTOR ProcessSD; + PSID ProcessUser; + ULONG Buffer[64]; /* Must be 4 bytes aligned! */ + ULONG cwcUserName; + + /* + * Retrieve several pieces of system information. + * + * Retrieval may sometimes fail, either because we are actually interested + * only in partial information (e.g. SystemHandleInformation), or because + * we are low in memory resources, or because of (Windows 7 WOW64-only) bugs + * (see below). In any of these cases, we try to fallback to sane values, + * and continue retrieving other information. + */ /* Get new system time */ status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), NULL); if (!NT_SUCCESS(status)) - return; + SysTimeInfo.CurrentTime = OldSystemTime; - /* Get new CPU's idle time */ - status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL); + /* + * Get general system performance info. + * + * The SYSTEM_PERFORMANCE_INFORMATION structure's size increased in Win7+. + * NtQuerySystemInformation(SystemPerformanceInformation) also supports its + * older version by filling in as much of the whole structure as possible, + * and returns STATUS_SUCCESS. However, Windows 7 x64 WOW64 has a bug, in + * wow64.dll!whNtQuerySystemInformation_SystemPerformanceInformation(), + * that fails to handle the different structures sizes, only supporting + * the largest possible one, and fails if the structure uses its legacy + * size (no data is copied, and STATUS_INFO_LENGTH_MISMATCH is returned). + * This problem thus happens only for 32-bit compiled code, but does not + * happen with native 64-bit compiled code. This problems does not happen + * on 32-bit Windows 7. + */ + // ZeroMemory(&SysPerfInfoData, sizeof(SysPerfInfoData)); + status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfoData, sizeof(SysPerfInfoData), NULL); if (!NT_SUCCESS(status)) - return; + *pSysPerfInfo = SystemPerfInfo; /* Get system cache information */ status = NtQuerySystemInformation(SystemFileCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL); if (!NT_SUCCESS(status)) - return; - - /* Get processor time information */ - SysProcessorTimeInfo = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)HeapAlloc(GetProcessHeap(), 0, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors); - status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors, &ulSize); - - if (!NT_SUCCESS(status)) - { - if (SysProcessorTimeInfo != NULL) - HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo); - return; - } + SysCacheInfo = SystemCacheInfo; - /* Get handle information - * Number of handles is enough, no need for data array. - */ - status = NtQuerySystemInformation(SystemHandleInformation, &SysHandleInfoData, sizeof(SysHandleInfoData), NULL); - /* On unexpected error, reuse previous value. - * STATUS_SUCCESS (0-1 handle) should never happen. - */ - if (status != STATUS_INFO_LENGTH_MISMATCH) - SysHandleInfoData.NumberOfHandles = SystemNumberOfHandles; + /* Get handle information. Number of handles is enough, no need for data array. */ + status = NtQuerySystemInformation(SystemHandleInformation, &SysHandleInfo, sizeof(SysHandleInfo), NULL); + if (!NT_SUCCESS(status) && (status != STATUS_INFO_LENGTH_MISMATCH)) + SysHandleInfo.NumberOfHandles = SystemNumberOfHandles; - /* Get process information + /* Get process information. * We don't know how much data there is so just keep - * increasing the buffer size until the call succeeds + * increasing the buffer size until the call succeeds. */ BufferSize = 0; do @@ -224,110 +300,170 @@ void PerfDataRefresh(void) pBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(), 0, BufferSize); status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize); - - if (status == STATUS_INFO_LENGTH_MISMATCH) { + if (status == STATUS_INFO_LENGTH_MISMATCH) HeapFree(GetProcessHeap(), 0, pBuffer); - } } while (status == STATUS_INFO_LENGTH_MISMATCH); EnterCriticalSection(&PerfDataCriticalSection); - /* - * Save system performance info - */ - memcpy(&SystemPerfInfo, &SysPerfInfo, sizeof(SYSTEM_PERFORMANCE_INFORMATION)); + /* Save system performance, cache, and handle information */ + SystemPerfInfo = *pSysPerfInfo; + SystemCacheInfo = SysCacheInfo; + SystemNumberOfHandles = SysHandleInfo.NumberOfHandles; - /* - * Save system cache info - */ - memcpy(&SystemCacheInfo, &SysCacheInfo, sizeof(SYSTEM_FILECACHE_INFORMATION)); - - /* - * Save system processor time info - */ - if (SystemProcessorTimeInfo) { - HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo); + /* If it's a first call, skip idle time calcs */ + if (OldSystemTime.QuadPart != 0) + { + liCurrentTime.QuadPart = SysTimeInfo.CurrentTime.QuadPart - OldSystemTime.QuadPart; + dbSystemTime = Li2Double(liCurrentTime); + } + /* Store the system time */ + OldSystemTime = SysTimeInfo.CurrentTime; + + /* Get system processor time information. In case of failure, keep the old data. */ + ulSize = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors; + status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, + SystemProcessorTimeInfo, + ulSize, + NULL); + if (!NT_SUCCESS(status)) + { + /* Keep the same data as before */ + // ZeroMemory(SystemProcessorTimeInfo, ulSize); } - SystemProcessorTimeInfo = SysProcessorTimeInfo; - /* - * Save system handle info - */ - SystemNumberOfHandles = SysHandleInfoData.NumberOfHandles; + MeanIdleTime.QuadPart = 0; + MeanKernelTime.QuadPart = 0; + for (Idx = 0; Idx < SystemBasicInfo.NumberOfProcessors; Idx++) + { + /* IDLE Time */ + CurrentIdleTime = SystemProcessorTimeInfo[Idx].IdleTime; - for (CurrentKernelTime=0, Idx=0; Idx<(ULONG)SystemBasicInfo.NumberOfProcessors; Idx++) { - CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime); - CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].DpcTime); - CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].InterruptTime); - } + /* Kernel Time */ + CurrentKernelTime = SystemProcessorTimeInfo[Idx].KernelTime; + CurrentKernelTime.QuadPart += SystemProcessorTimeInfo[Idx].DpcTime.QuadPart; + CurrentKernelTime.QuadPart += SystemProcessorTimeInfo[Idx].InterruptTime.QuadPart; + + /* Save the per-CPU times */ + if (ProcessorTimes != &ProcessorMeanTimes) + { + /* If it's a first call, skip idle time calcs */ + if (ProcessorMeanTimes.OldIdleTime.QuadPart != 0) + { + /* CurrentValue = NewValue - OldValue */ + liCurrentTime.QuadPart = CurrentIdleTime.QuadPart; + liCurrentTime.QuadPart -= ProcessorTimes[Idx].OldIdleTime.QuadPart; + ProcessorTimes[Idx].dbIdleTime = Li2Double(liCurrentTime); + + liCurrentTime.QuadPart = CurrentKernelTime.QuadPart; + liCurrentTime.QuadPart -= ProcessorTimes[Idx].OldKernelTime.QuadPart; + ProcessorTimes[Idx].dbKernelTime = Li2Double(liCurrentTime); + + /* CurrentCpuIdle = IdleTime / SystemTime */ + ProcessorTimes[Idx].dbIdleTime /= dbSystemTime; + ProcessorTimes[Idx].dbKernelTime /= dbSystemTime; + + /* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) */ + ProcessorTimes[Idx].dbIdleTime = + 100.0 - ProcessorTimes[Idx].dbIdleTime * 100.0; /* + 0.5; */ + ProcessorTimes[Idx].dbKernelTime = + 100.0 - ProcessorTimes[Idx].dbKernelTime * 100.0; /* + 0.5; */ + + /* Sanitize the values (percentages between 0 and 100) */ + ProcessorTimes[Idx].dbIdleTime = min(max(ProcessorTimes[Idx].dbIdleTime, 0.), 100.); + ProcessorTimes[Idx].dbKernelTime = min(max(ProcessorTimes[Idx].dbKernelTime, 0.), 100.); + } - /* If it's a first call - skip idle time calcs */ - if (liOldIdleTime.QuadPart != 0) { - /* CurrentValue = NewValue - OldValue */ - dbIdleTime = Li2Double(SysPerfInfo.IdleProcessTime) - Li2Double(liOldIdleTime); - dbKernelTime = CurrentKernelTime - OldKernelTime; - dbSystemTime = Li2Double(SysTimeInfo.CurrentTime) - Li2Double(liOldSystemTime); + /* Store new CPU's idle and kernel times */ + ProcessorTimes[Idx].OldIdleTime = CurrentIdleTime; + ProcessorTimes[Idx].OldKernelTime = CurrentKernelTime; + } - /* CurrentCpuIdle = IdleTime / SystemTime */ - dbIdleTime = dbIdleTime / dbSystemTime; - dbKernelTime = dbKernelTime / dbSystemTime; + /* Calculate the mean values as well */ + MeanIdleTime.QuadPart += CurrentIdleTime.QuadPart; + MeanKernelTime.QuadPart += CurrentKernelTime.QuadPart; + } - /* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */ - dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */ - dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */ + /* If it's a first call, skip idle time calcs */ + if (ProcessorMeanTimes.OldIdleTime.QuadPart != 0) + { + /* CurrentValue = NewValue - OldValue */ + liCurrentTime.QuadPart = MeanIdleTime.QuadPart - ProcessorMeanTimes.OldIdleTime.QuadPart; + ProcessorMeanTimes.dbIdleTime = Li2Double(liCurrentTime); + + liCurrentTime.QuadPart = MeanKernelTime.QuadPart - ProcessorMeanTimes.OldKernelTime.QuadPart; + ProcessorMeanTimes.dbKernelTime = Li2Double(liCurrentTime); + + /* CurrentCpuIdle = IdleTime / SystemTime */ + ProcessorMeanTimes.dbIdleTime /= dbSystemTime; + ProcessorMeanTimes.dbKernelTime /= dbSystemTime; + + /* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */ + ProcessorMeanTimes.dbIdleTime = + 100.0 - ProcessorMeanTimes.dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */ + ProcessorMeanTimes.dbKernelTime = + 100.0 - ProcessorMeanTimes.dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */ + + /* Sanitize the values (percentages between 0 and 100) */ + ProcessorMeanTimes.dbIdleTime = min(max(ProcessorMeanTimes.dbIdleTime, 0.), 100.); + ProcessorMeanTimes.dbKernelTime = min(max(ProcessorMeanTimes.dbKernelTime, 0.), 100.); } - /* Store new CPU's idle and system time */ - liOldIdleTime = SysPerfInfo.IdleProcessTime; - liOldSystemTime = SysTimeInfo.CurrentTime; - OldKernelTime = CurrentKernelTime; + /* Store the mean CPU times */ + ProcessorMeanTimes.OldIdleTime = MeanIdleTime; + ProcessorMeanTimes.OldKernelTime = MeanKernelTime; - /* Determine the process count + /* Determine the process count. * We loop through the data we got from NtQuerySystemInformation - * and count how many structures there are (until RelativeOffset is 0) + * and count how many structures there are (until NextEntryOffset is 0) */ ProcessCountOld = ProcessCount; ProcessCount = 0; - pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer; - while (pSPI) { + for (pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer; + pSPI && (pSPI->NextEntryOffset != 0); + pSPI = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)pSPI + pSPI->NextEntryOffset)) + { ProcessCount++; - if (pSPI->NextEntryOffset == 0) - break; - pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset); } /* Now alloc a new PERFDATA array and fill in the data */ pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA) * ProcessCount); pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer; - for (Idx=0; IdxUniqueProcessId) { + if (pPerfDataOld) + { + for (Idx2=0; Idx2UniqueProcessId) + { pPDOld = &pPerfDataOld[Idx2]; break; } } } - if (pSPI->ImageName.Buffer) { - /* Don't assume a UNICODE_STRING Buffer is zero terminated: */ - int len = pSPI->ImageName.Length / 2; - /* Check against max size and allow for terminating zero (already zeroed): */ - if(len >= MAX_PATH)len=MAX_PATH - 1; - wcsncpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer, len); - } else { - LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName, - _countof(pPerfData[Idx].ImageName)); + if (pSPI->ImageName.Buffer) + { + StringCbCopyNW(pPerfData[Idx].ImageName, sizeof(pPerfData[Idx].ImageName), + pSPI->ImageName.Buffer, pSPI->ImageName.Length); + } + else + { + LoadStringW(hInst, IDS_IDLE_PROCESS, + pPerfData[Idx].ImageName, + _countof(pPerfData[Idx].ImageName)); } pPerfData[Idx].ProcessId = pSPI->UniqueProcessId; - if (pPDOld) { + if (pPDOld) + { double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime); double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime); double CpuTime = (CurTime - OldTime) / dbSystemTime; @@ -337,15 +473,19 @@ void PerfDataRefresh(void) pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart; pPerfData[Idx].WorkingSetSizeBytes = pSPI->WorkingSetSize; pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSize; + if (pPDOld) pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->WorkingSetSize - (LONG)pPDOld->WorkingSetSizeBytes); else pPerfData[Idx].WorkingSetSizeDelta = 0; + pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount; + if (pPDOld) pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount); else pPerfData[Idx].PageFaultCountDelta = 0; + pPerfData[Idx].VirtualMemorySizeBytes = pSPI->VirtualSize; pPerfData[Idx].PagedPoolUsagePages = pSPI->QuotaPeakPagedPoolUsage; pPerfData[Idx].NonPagedPoolUsagePages = pSPI->QuotaPeakNonPagedPoolUsage; @@ -359,11 +499,13 @@ void PerfDataRefresh(void) ProcessUser = SystemUserSid; ProcessSD = NULL; - if (pSPI->UniqueProcessId != NULL) { + if (pSPI->UniqueProcessId != NULL) + { hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | READ_CONTROL, FALSE, PtrToUlong(pSPI->UniqueProcessId)); - if (hProcess) { - /* don't query the information of the system process. It's possible but - returns Administrators as the owner of the process instead of SYSTEM */ + if (hProcess) + { + /* Don't query the information of the system process. It's possible but + * returns Administrators as the owner of the process instead of SYSTEM. */ if (pSPI->UniqueProcessId != (HANDLE)0x4) { if (OpenProcessToken(hProcess, TOKEN_QUERY, &hProcessToken)) @@ -391,12 +533,16 @@ void PerfDataRefresh(void) GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); CloseHandle(hProcess); - } else { + } + else + { goto ClearInfo; } - } else { + } + else + { ClearInfo: - /* clear information we were unable to fetch */ + /* Clear information we were unable to fetch */ ZeroMemory(&pPerfData[Idx].IOCounters, sizeof(IO_COUNTERS)); } @@ -404,19 +550,27 @@ void PerfDataRefresh(void) CachedGetUserFromSid(ProcessUser, pPerfData[Idx].UserName, &cwcUserName); if (ProcessSD != NULL) - { LocalFree((HLOCAL)ProcessSD); - } pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart; - pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset); + pSPI = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)pSPI + pSPI->NextEntryOffset); } HeapFree(GetProcessHeap(), 0, pBuffer); - if (pPerfDataOld) { + if (pPerfDataOld) HeapFree(GetProcessHeap(), 0, pPerfDataOld); - } pPerfDataOld = pPerfData; + + LeaveCriticalSection(&PerfDataCriticalSection); +} + +VOID PerfDataAcquireLock(VOID) +{ + EnterCriticalSection(&PerfDataCriticalSection); +} + +VOID PerfDataReleaseLock(VOID) +{ LeaveCriticalSection(&PerfDataCriticalSection); } @@ -452,24 +606,45 @@ ULONG PerfDataGetProcessCount(void) return Result; } -ULONG PerfDataGetProcessorUsage(void) +ULONG PerfDataGetProcessorCount(VOID) +{ + /* Note: No need for locking since this is a one-time initialized data */ + // TODO: Investigate how this should be fixed with NUMA support. + return SystemBasicInfo.NumberOfProcessors; +} + +ULONG PerfDataGetProcessorUsage(VOID) { ULONG Result; EnterCriticalSection(&PerfDataCriticalSection); - Result = (ULONG)min(max(dbIdleTime, 0.), 100.); + Result = (ULONG)ProcessorMeanTimes.dbIdleTime; LeaveCriticalSection(&PerfDataCriticalSection); return Result; } -ULONG PerfDataGetProcessorSystemUsage(void) +ULONG PerfDataGetProcessorSystemUsage(VOID) { ULONG Result; EnterCriticalSection(&PerfDataCriticalSection); - Result = (ULONG)min(max(dbKernelTime, 0.), 100.); + Result = (ULONG)ProcessorMeanTimes.dbKernelTime; LeaveCriticalSection(&PerfDataCriticalSection); return Result; } +ULONG PerfDataGetProcessorUsagePerCPU(ULONG CPUIndex) +{ + if (CPUIndex >= SystemBasicInfo.NumberOfProcessors) + return 0; + return (ULONG)ProcessorTimes[CPUIndex].dbIdleTime; +} + +ULONG PerfDataGetProcessorSystemUsagePerCPU(ULONG CPUIndex) +{ + if (CPUIndex >= SystemBasicInfo.NumberOfProcessors) + return 0; + return (ULONG)ProcessorTimes[CPUIndex].dbKernelTime; +} + BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount) { BOOL bSuccessful; @@ -916,161 +1091,86 @@ BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters) return bSuccessful; } -ULONG PerfDataGetCommitChargeTotalK(void) +VOID +PerfDataGetCommitChargeK( + _Out_opt_ PULONGLONG ChargeTotal, + _Out_opt_ PULONGLONG ChargeLimit, + _Out_opt_ PULONGLONG ChargePeak) { - ULONG Total; - ULONG PageSize; + ULONG Total; + ULONG Limit; + ULONG Peak; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); Total = SystemPerfInfo.CommittedPages; - PageSize = SystemBasicInfo.PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - Total = Total * (PageSize / 1024); - - return Total; -} - -ULONG PerfDataGetCommitChargeLimitK(void) -{ - ULONG Limit; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - Limit = SystemPerfInfo.CommitLimit; + Peak = SystemPerfInfo.PeakCommitment; PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); - Limit = Limit * (PageSize / 1024); - - return Limit; -} - -ULONG PerfDataGetCommitChargePeakK(void) -{ - ULONG Peak; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - - Peak = SystemPerfInfo.PeakCommitment; - PageSize = SystemBasicInfo.PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - Peak = Peak * (PageSize / 1024); - - return Peak; + if (ChargeTotal) + *ChargeTotal = (ULONGLONG)Total * (PageSize / 1024); + if (ChargeLimit) + *ChargeLimit = (ULONGLONG)Limit * (PageSize / 1024); + if (ChargePeak) + *ChargePeak = (ULONGLONG)Peak * (PageSize / 1024); } -ULONG PerfDataGetKernelMemoryTotalK(void) -{ - ULONG Total; - ULONG Paged; - ULONG NonPaged; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - - Paged = SystemPerfInfo.PagedPoolPages; - NonPaged = SystemPerfInfo.NonPagedPoolPages; - PageSize = SystemBasicInfo.PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - Paged = Paged * (PageSize / 1024); - NonPaged = NonPaged * (PageSize / 1024); - - Total = Paged + NonPaged; - - return Total; -} - -ULONG PerfDataGetKernelMemoryPagedK(void) -{ - ULONG Paged; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - - Paged = SystemPerfInfo.PagedPoolPages; - PageSize = SystemBasicInfo.PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - Paged = Paged * (PageSize / 1024); - - return Paged; -} - -ULONG PerfDataGetKernelMemoryNonPagedK(void) +VOID +PerfDataGetKernelMemoryK( + _Out_opt_ PULONGLONG MemTotal, + _Out_opt_ PULONGLONG MemPaged, + _Out_opt_ PULONGLONG MemNonPaged) { - ULONG NonPaged; - ULONG PageSize; + ULONG Paged; + ULONG NonPaged; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); + Paged = SystemPerfInfo.PagedPoolPages; NonPaged = SystemPerfInfo.NonPagedPoolPages; PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); - NonPaged = NonPaged * (PageSize / 1024); - - return NonPaged; + if (MemTotal) + *MemTotal = (ULONGLONG)(Paged + NonPaged) * (PageSize / 1024); + if (MemPaged) + *MemPaged = (ULONGLONG)Paged * (PageSize / 1024); + if (MemNonPaged) + *MemNonPaged = (ULONGLONG)NonPaged * (PageSize / 1024); } -ULONG PerfDataGetPhysicalMemoryTotalK(void) +VOID +PerfDataGetPhysicalMemoryK( + _Out_opt_ PULONGLONG MemTotal, + _Out_opt_ PULONGLONG MemAvailable, + _Out_opt_ PULONGLONG MemSysCache) { - ULONG Total; - ULONG PageSize; + ULONG Total; + ULONG Available; + ULONG SystemCache; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); Total = SystemBasicInfo.NumberOfPhysicalPages; + Available = SystemPerfInfo.AvailablePages; + SystemCache = SystemCacheInfo.CurrentSizeIncludingTransitionInPages; PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); - Total = Total * (PageSize / 1024); - - return Total; -} - -ULONG PerfDataGetPhysicalMemoryAvailableK(void) -{ - ULONG Available; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - - Available = SystemPerfInfo.AvailablePages; - PageSize = SystemBasicInfo.PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - Available = Available * (PageSize / 1024); - - return Available; -} - -ULONG PerfDataGetPhysicalMemorySystemCacheK(void) -{ - ULONG SystemCache; - ULONG PageSize; - - EnterCriticalSection(&PerfDataCriticalSection); - - PageSize = SystemBasicInfo.PageSize; - SystemCache = SystemCacheInfo.CurrentSizeIncludingTransitionInPages * PageSize; - - LeaveCriticalSection(&PerfDataCriticalSection); - - return SystemCache / 1024; + if (MemTotal) + *MemTotal = (ULONGLONG)Total * (PageSize / 1024); + if (MemAvailable) + *MemAvailable = (ULONGLONG)Available * (PageSize / 1024); + if (MemSysCache) + *MemSysCache = (ULONGLONG)SystemCache * (PageSize / 1024); } ULONG PerfDataGetSystemHandleCount(void) diff --git a/base/applications/taskmgr/perfdata.h b/base/applications/taskmgr/perfdata.h index 0a06c4d5cf289..0d14eb6e56139 100644 --- a/base/applications/taskmgr/perfdata.h +++ b/base/applications/taskmgr/perfdata.h @@ -45,15 +45,24 @@ typedef struct _CMD_LINE_CACHE struct _CMD_LINE_CACHE* pnext; } CMD_LINE_CACHE, *PCMD_LINE_CACHE; -BOOL PerfDataInitialize(void); -void PerfDataUninitialize(void); -void PerfDataRefresh(void); +BOOL PerfDataInitialize(VOID); +VOID PerfDataUninitialize(VOID); +VOID PerfDataRefresh(VOID); + +VOID PerfDataAcquireLock(VOID); +VOID PerfDataReleaseLock(VOID); BOOL PerfDataGet(ULONG Index, PPERFDATA *lppData); ULONG PerfDataGetProcessIndex(ULONG pid); ULONG PerfDataGetProcessCount(void); -ULONG PerfDataGetProcessorUsage(void); -ULONG PerfDataGetProcessorSystemUsage(void); + +ULONG PerfDataGetProcessorCount(VOID); +ULONG PerfDataGetProcessorUsage(VOID); +ULONG PerfDataGetProcessorSystemUsage(VOID); +/****/ +ULONG PerfDataGetProcessorUsagePerCPU(ULONG CPUIndex); +ULONG PerfDataGetProcessorSystemUsagePerCPU(ULONG CPUIndex); +/****/ BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount); ULONG PerfDataGetProcessId(ULONG Index); @@ -80,17 +89,23 @@ ULONG PerfDataGetUSERObjectCount(ULONG Index); ULONG PerfDataGetGDIObjectCount(ULONG Index); BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters); -ULONG PerfDataGetCommitChargeTotalK(void); -ULONG PerfDataGetCommitChargeLimitK(void); -ULONG PerfDataGetCommitChargePeakK(void); +VOID +PerfDataGetCommitChargeK( + _Out_opt_ PULONGLONG Total, + _Out_opt_ PULONGLONG Limit, + _Out_opt_ PULONGLONG Peak); -ULONG PerfDataGetKernelMemoryTotalK(void); -ULONG PerfDataGetKernelMemoryPagedK(void); -ULONG PerfDataGetKernelMemoryNonPagedK(void); +VOID +PerfDataGetKernelMemoryK( + _Out_opt_ PULONGLONG MemTotal, + _Out_opt_ PULONGLONG MemPaged, + _Out_opt_ PULONGLONG MemNonPaged); -ULONG PerfDataGetPhysicalMemoryTotalK(void); -ULONG PerfDataGetPhysicalMemoryAvailableK(void); -ULONG PerfDataGetPhysicalMemorySystemCacheK(void); +VOID +PerfDataGetPhysicalMemoryK( + _Out_opt_ PULONGLONG MemTotal, + _Out_opt_ PULONGLONG MemAvailable, + _Out_opt_ PULONGLONG MemSysCache); ULONG PerfDataGetSystemHandleCount(void); diff --git a/base/applications/taskmgr/perfpage.c b/base/applications/taskmgr/perfpage.c index 005bc6e2e4046..8f710dcf9758b 100644 --- a/base/applications/taskmgr/perfpage.c +++ b/base/applications/taskmgr/perfpage.c @@ -8,57 +8,48 @@ #include "precomp.h" #include -TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph; -TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph; - -HWND hPerformancePage; /* Performance Property Page */ -static HWND hCpuUsageGraph; /* CPU Usage Graph */ -static HWND hMemUsageGraph; /* MEM Usage Graph */ -HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */ -HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */ -static HWND hTotalsFrame; /* Totals Frame */ -static HWND hCommitChargeFrame; /* Commit Charge Frame */ -static HWND hKernelMemoryFrame; /* Kernel Memory Frame */ -static HWND hPhysicalMemoryFrame; /* Physical Memory Frame */ -static HWND hCpuUsageFrame; -static HWND hMemUsageFrame; -static HWND hCpuUsageHistoryFrame; -static HWND hMemUsageHistoryFrame; -static HWND hCommitChargeTotalEdit; /* Commit Charge Total Edit Control */ -static HWND hCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */ -static HWND hCommitChargePeakEdit; /* Commit Charge Peak Edit Control */ -static HWND hKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */ -static HWND hKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */ -static HWND hKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */ -static HWND hPhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */ -static HWND hPhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */ -static HWND hPhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */ -static HWND hTotalsHandleCountEdit; /* Total Handles Edit Control */ -static HWND hTotalsProcessCountEdit; /* Total Processes Edit Control */ -static HWND hTotalsThreadCountEdit; /* Total Threads Edit Control */ - -#ifdef RUN_PERF_PAGE -static HANDLE hPerformanceThread = NULL; -static DWORD dwPerformanceThread; -#endif +#define MAX_CPU_PER_LINE 16 // TODO: Make this selectable in submenu. + +// typedef struct _CPU_GRAPH CPU_GRAPH, *PCPU_GRAPH; +static ULONG CpuTotalPanes = 0; +static PTM_GRAPH_CONTROL CpuUsageHistoryGraphs = NULL; /* CPU Usage History Graphs Array */ + +static HWND hCpuUsageHistoryGraph; /* CPU Usage History Graph */ +static TM_GRAPH_CONTROL CpuUsageHistoryGraph; /* CPU Usage History Graph template control */ +static RECT rcCpuGraphArea; /* Rectangle area for CPU graphs */ + +static HWND hMemUsageHistoryGraph; /* Memory Usage History Graph */ +static TM_GRAPH_CONTROL MemUsageHistoryGraph; + +static HWND hCpuUsageGraph; /* CPU Usage Graph */ +static HWND hMemUsageGraph; /* MEM Usage Graph */ +static TM_GAUGE_CONTROL CpuUsageGraph = {0}; +static TM_GAUGE_CONTROL MemUsageGraph = {0}; +HWND hPerformancePage; /* Performance Property Page */ static int nPerformancePageWidth; static int nPerformancePageHeight; static int lastX, lastY; -DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter); -void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos) +static void +AdjustFrameSize(HDWP* phdwp, HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int posFlag) { - RECT rc; - int cx, cy, sx, sy; + RECT rc; + int cx, cy, sx, sy; + + if (!phdwp || !*phdwp) + return; - GetClientRect(hCntrl, &rc); - MapWindowPoints(hCntrl, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT)); - if (pos) { + GetWindowRect(hCntrl, &rc); + MapWindowPoints(NULL, hDlg, (LPPOINT)&rc, sizeof(RECT) / sizeof(POINT)); + + if (posFlag) + { cx = rc.left; cy = rc.top; sx = rc.right - rc.left; - switch (pos) { + switch (posFlag) + { case 1: break; case 2: @@ -73,44 +64,38 @@ void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, break; } sy = rc.bottom - rc.top + nYDifference / 2; - SetWindowPos(hCntrl, NULL, cx, cy, sx, sy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER); - } else { + *phdwp = DeferWindowPos(*phdwp, + 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); + *phdwp = DeferWindowPos(*phdwp, + hCntrl, NULL, + cx, cy, 0, 0, + SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); } InvalidateRect(hCntrl, NULL, TRUE); } +// AdjustControlPosition static inline -void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference) -{ - AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0); -} - -static inline -void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference) +void AdjustCntrlPos(HDWP* phdwp, int ctrl_id, HWND hDlg, int nXDifference, int nYDifference) { - AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0); + AdjustFrameSize(phdwp, GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0); } INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - RECT rc; - switch (message) { - case WM_DESTROY: - GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph); - GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph); -#ifdef RUN_PERF_PAGE - EndLocalThread(&hPerformanceThread, dwPerformanceThread); -#endif - break; - case WM_INITDIALOG: { + RECT rc; BOOL bGraph; TM_FORMAT fmt; @@ -122,84 +107,194 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Update window position */ SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); - /* - * Get handles to all the controls - */ - hTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME); - hCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME); - hKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME); - hPhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME); - - hCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME); - hMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME); - hCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME); - hMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME); - - hCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL); - hCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT); - hCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK); - hKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL); - hKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED); - hKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED); - hPhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL); - hPhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE); - hPhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE); - hTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT); - hTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT); - hTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT); - + /* Get handles to the graph controls */ hCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH); hMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH); - hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH); - hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); + hCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); + hMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH); + + /* Create the graph controls */ + CpuUsageGraph.bIsCPU = TRUE; + // CpuUsageGraph.hWnd = hCpuUsageGraph; + MemUsageGraph.bIsCPU = FALSE; + // MemUsageGraph.hWnd = hMemUsageGraph; - /* Create the controls */ fmt.clrBack = RGB(0, 0, 0); fmt.clrGrid = RGB(0, 128, 64); + fmt.clrPlot0 = RGB(0, 255, 0); fmt.clrPlot1 = RGB(255, 0, 0); fmt.GridCellWidth = fmt.GridCellHeight = 12; fmt.DrawSecondaryPlot = TaskManagerSettings.ShowKernelTimes; - bGraph = GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, &fmt); - if (!bGraph) + + /* Retrieve the size of the single original CPU graph control, + * that will serve as our overall CPU graph area where the + * per-CPU graph panels will reside. */ + GetWindowRect(hCpuUsageHistoryGraph, &rcCpuGraphArea); + MapWindowPoints(NULL, hDlg, (LPPOINT)&rcCpuGraphArea, sizeof(RECT) / sizeof(POINT)); + + /* Initialize the number of total CPU history graph panes to the number of CPUs on the system */ + CpuTotalPanes = PerfDataGetProcessorCount(); + + /* Initialize the CPU history graph panes */ + if (CpuTotalPanes > 1) + { + /* + * Inherit the characteristics of the new per-CPU graph panes + * from the main original one, and create their corresponding panes. + */ + LPCWSTR lpClassAtom = (LPCWSTR)GetClassLongPtrW(hCpuUsageHistoryGraph, GCW_ATOM); + DWORD dwExStyle = GetWindowLongPtrW(hCpuUsageHistoryGraph, GWL_EXSTYLE); + DWORD dwStyle = GetWindowLongPtrW(hCpuUsageHistoryGraph, GWL_STYLE); + HWND hwndParent = GetParent(hCpuUsageHistoryGraph); + + HWND hwndCPU; + ULONG i; + + CpuUsageHistoryGraphs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(TM_GRAPH_CONTROL) * CpuTotalPanes); + if (!CpuUsageHistoryGraphs) + goto oneCPUGraph; /* Fall back to one graph for all CPUs */ + + /* Initialize the first entry for CPU #0 */ + bGraph = GraphCtrl_Create(&CpuUsageHistoryGraphs[0], hCpuUsageHistoryGraph, hDlg, &fmt); + if (!bGraph) + { + /* Ignore graph creation failure (may happen under low memory resources) */ + // CpuUsageHistoryGraphs[0].hWnd = hCpuUsageHistoryGraph; + // NOTHING; + } + + /* Start the loop at 1 for the other CPUs */ + ASSERT(CpuTotalPanes <= MAXWORD); + for (i = 1; i < CpuTotalPanes; ++i) + { + /* Allocate a new window, inheriting its class and style + * from the single original CPU graph control. Its actual + * position will be determined at the first WM_SIZE event + * after the property sheet page gets created. */ + hwndCPU = CreateWindowExW(dwExStyle, lpClassAtom, L"CPU Graph", dwStyle, + rcCpuGraphArea.left, rcCpuGraphArea.top, + 0, 0, + hwndParent, + /* Specifies child ID */ + (HMENU)ULongToHandle(MAKELONG(IDC_CPU_USAGE_HISTORY_GRAPH, (WORD)i)), + hInst, NULL); + if (!hwndCPU) + continue; + + bGraph = GraphCtrl_Create(&CpuUsageHistoryGraphs[i], hwndCPU, hDlg, &fmt); + if (!bGraph) + { + /* Ignore graph creation failure (may happen under low memory resources) */ + // CpuUsageHistoryGraphs[i].hWnd = hwndCPU; + // NOTHING; + } + + ShowWindow(hwndCPU, TaskManagerSettings.CPUHistory_OneGraphPerCPU ? SW_SHOW : SW_HIDE); + } + } + else { - EndDialog(hDlg, 0); - return FALSE; + HMENU hCPUHistoryMenu; +oneCPUGraph: + /* Fall back to one graph for all CPUs */ + CpuTotalPanes = 1; + CpuUsageHistoryGraphs = &CpuUsageHistoryGraph; + bGraph = GraphCtrl_Create(&CpuUsageHistoryGraphs[0], hCpuUsageHistoryGraph, hDlg, &fmt); + if (!bGraph) + { + /* Ignore graph creation failure (may happen under low memory resources) */ + // NOTHING; + } + + /* Select one graph for all CPUs and disable the per-CPU graph menu item */ + PerformancePage_OnViewCPUHistoryGraph(TRUE); + hCPUHistoryMenu = GetSubMenu(GetSubMenu(GetMenu(hMainWnd), 2), 3); + EnableMenuItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND | MF_DISABLED); } fmt.clrPlot0 = RGB(255, 255, 0); fmt.clrPlot1 = RGB(100, 255, 255); fmt.DrawSecondaryPlot = TRUE; - bGraph = GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, &fmt); + bGraph = GraphCtrl_Create(&MemUsageHistoryGraph, hMemUsageHistoryGraph, hDlg, &fmt); if (!bGraph) { - EndDialog(hDlg, 0); - return FALSE; + /* Ignore graph creation failure (may happen under low memory resources) */ + // NOTHING; } - /* Start our refresh thread */ -#ifdef RUN_PERF_PAGE - hPerformanceThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, &dwPerformanceThread); -#endif - - /* - * Subclass graph buttons - */ - OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc); - SetWindowLongPtrW(hMemUsageGraph, 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: + case WM_DESTROY: + { + if (CpuUsageHistoryGraphs && (CpuUsageHistoryGraphs != &CpuUsageHistoryGraph)) + { + ULONG i; + for (i = 0; i < CpuTotalPanes; ++i) + { + HWND hwnd = CpuUsageHistoryGraphs[i].hWnd; + GraphCtrl_Dispose(&CpuUsageHistoryGraphs[i]); + DestroyWindow(hwnd); + } + HeapFree(GetProcessHeap(), 0, CpuUsageHistoryGraphs); + CpuUsageHistoryGraphs = NULL; + } + GraphCtrl_Dispose(&CpuUsageHistoryGraph); + GraphCtrl_Dispose(&MemUsageHistoryGraph); + break; + } + + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; + + if (LOWORD(drawItem->CtlID) == IDC_CPU_USAGE_HISTORY_GRAPH) + { + ULONG i = HIWORD(drawItem->CtlID); + if ((i < CpuTotalPanes) && + (drawItem->hwndItem == CpuUsageHistoryGraphs[i].hWnd)) + { + GraphCtrl_OnDraw(drawItem->hwndItem, + &CpuUsageHistoryGraphs[i], + (WPARAM)drawItem->hDC, 0); + } + } + else if (drawItem->CtlID == IDC_MEM_USAGE_HISTORY_GRAPH) + { + ASSERT(drawItem->hwndItem == MemUsageHistoryGraph.hWnd); + GraphCtrl_OnDraw(drawItem->hwndItem, + &MemUsageHistoryGraph, + (WPARAM)drawItem->hDC, 0); + } + else if (drawItem->CtlID == IDC_CPU_USAGE_GRAPH) + { + Graph_DrawUsageGraph(drawItem->hwndItem, + &CpuUsageGraph, + (WPARAM)drawItem->hDC, 0); + } + else if (drawItem->CtlID == IDC_MEM_USAGE_GRAPH) + { + Graph_DrawUsageGraph(drawItem->hwndItem, + &MemUsageGraph, + (WPARAM)drawItem->hDC, 0); + } + break; + // return TRUE; + } case WM_SIZE: { - int cx, cy; - int nXDifference; - int nYDifference; + int cx, cy; + int nXDifference; + int nYDifference; + HDWP hdwp; + RECT rcClient; + + ULONG CPUPanes; + ULONG i; if (wParam == SIZE_MINIMIZED) return 0; @@ -211,36 +306,40 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) nPerformancePageWidth = cx; nPerformancePageHeight = cy; + CPUPanes = (TaskManagerSettings.CPUHistory_OneGraphPerCPU ? CpuTotalPanes : 1); + + hdwp = BeginDeferWindowPos(16 + 12 + 6 + CPUPanes + 1); + /* Reposition the performance page's controls */ - AdjustFrameSize(hTotalsFrame, hDlg, 0, nYDifference, 0); - AdjustFrameSize(hCommitChargeFrame, hDlg, 0, nYDifference, 0); - AdjustFrameSize(hKernelMemoryFrame, hDlg, 0, nYDifference, 0); - AdjustFrameSize(hPhysicalMemoryFrame, 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(hCommitChargeTotalEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hCommitChargeLimitEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hCommitChargePeakEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hKernelMemoryTotalEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hKernelMemoryPagedEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hKernelMemoryNonPagedEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hPhysicalMemoryTotalEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hPhysicalMemoryAvailableEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hPhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hTotalsHandleCountEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hTotalsProcessCountEdit, hDlg, 0, nYDifference); - AdjustControlPosition(hTotalsThreadCountEdit, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_TOTALS_FRAME, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_COMMIT_CHARGE_FRAME, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_KERNEL_MEMORY_FRAME, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_PHYSICAL_MEMORY_FRAME, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference); + + AdjustCntrlPos(&hdwp, IDC_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference); + AdjustCntrlPos(&hdwp, IDC_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference); nXDifference += lastX; nYDifference += lastY; @@ -271,38 +370,129 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lastY--; } } - AdjustFrameSize(hCpuUsageFrame, hDlg, nXDifference, nYDifference, 1); - AdjustFrameSize(hMemUsageFrame, hDlg, nXDifference, nYDifference, 2); - AdjustFrameSize(hCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3); - AdjustFrameSize(hMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4); - AdjustFrameSize(hCpuUsageGraph, hDlg, nXDifference, nYDifference, 1); - AdjustFrameSize(hMemUsageGraph, hDlg, nXDifference, nYDifference, 2); - AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3); - AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4); + + AdjustFrameSize(&hdwp, GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME), hDlg, nXDifference, nYDifference, 1); + AdjustFrameSize(&hdwp, GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME), hDlg, nXDifference, nYDifference, 2); + AdjustFrameSize(&hdwp, GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME), hDlg, nXDifference, nYDifference, 3); + AdjustFrameSize(&hdwp, GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME), hDlg, nXDifference, nYDifference, 4); + AdjustFrameSize(&hdwp, hCpuUsageGraph, hDlg, nXDifference, nYDifference, 1); + AdjustFrameSize(&hdwp, hMemUsageGraph, hDlg, nXDifference, nYDifference, 2); + + /* Lay out the CPU graphs */ + // if (CPUPanes > 1) + { + int nWidth, nHeight; + + /* Lay out the several CPU graphs in a grid-like manner */ + rcCpuGraphArea.right += nXDifference; + rcCpuGraphArea.bottom += nYDifference / 2; + nWidth = (rcCpuGraphArea.right - rcCpuGraphArea.left) / min(CPUPanes, MAX_CPU_PER_LINE); // - GetSystemMetrics(SM_CXBORDER); + nHeight = (rcCpuGraphArea.bottom - rcCpuGraphArea.top) / (1 + (CPUPanes-1) / MAX_CPU_PER_LINE); // - GetSystemMetrics(SM_CYBORDER); + + for (i = 0; i < CPUPanes; ++i) + { + hdwp = DeferWindowPos(hdwp, + CpuUsageHistoryGraphs[i].hWnd, + NULL, + rcCpuGraphArea.left + (i % MAX_CPU_PER_LINE) * nWidth, + rcCpuGraphArea.top + (i / MAX_CPU_PER_LINE) * nHeight, + nWidth, + nHeight, + SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER); + + InvalidateRect(CpuUsageHistoryGraphs[i].hWnd, NULL, TRUE); + } + } +#if 0 + else + { + /* The single CPU graph takes the whole CPU graph area */ + AdjustFrameSize(&hdwp, CpuUsageHistoryGraphs[0].hWnd, hDlg, nXDifference, nYDifference, 3); + } +#endif + + AdjustFrameSize(&hdwp, hMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4); + + if (hdwp) + EndDeferWindowPos(hdwp); + + /* Resize the graphs */ + for (i = 0; i < CPUPanes; ++i) + { + GetClientRect(CpuUsageHistoryGraphs[i].hWnd, &rcClient); + GraphCtrl_OnSize(CpuUsageHistoryGraphs[i].hWnd, + &CpuUsageHistoryGraphs[i], + wParam, + MAKELPARAM(rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top)); + } + + GetClientRect(hMemUsageHistoryGraph, &rcClient); + GraphCtrl_OnSize(hMemUsageHistoryGraph, + &MemUsageHistoryGraph, + wParam, + MAKELPARAM(rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top)); + break; } } return 0; } -void RefreshPerformancePage(void) +static void +UpdatePerfStatusBar( + _In_ ULONG TotalProcesses, + _In_ ULONG CpuUsage, + _In_ ULONGLONG CommitChargeTotal, + _In_ ULONGLONG CommitChargeLimit) { -#ifdef RUN_PERF_PAGE - /* Signal the event so that our refresh thread - * will wake up and refresh the performance page */ - PostThreadMessage(dwPerformanceThread, WM_TIMER, 0, 0); -#endif + extern BOOL bTrackMenu; // From taskmgr.c + + static WCHAR szProcesses[256] = L""; + static WCHAR szCpuUsage[256] = L""; + static WCHAR szMemUsage[256] = L""; + + WCHAR szChargeTotalFormat[256]; + WCHAR szChargeLimitFormat[256]; + WCHAR Text[260]; + + /* Do nothing if the status bar is used to show menu hints */ + if (bTrackMenu) + return; + + if (!*szProcesses) + LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, ARRAYSIZE(szProcesses)); + if (!*szCpuUsage) + LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, ARRAYSIZE(szCpuUsage)); + if (!*szMemUsage) + LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, ARRAYSIZE(szMemUsage)); + + wsprintfW(Text, szProcesses, TotalProcesses); + SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)Text); + + wsprintfW(Text, szCpuUsage, CpuUsage); + SendMessageW(hStatusWnd, SB_SETTEXT, 1, (LPARAM)Text); + + StrFormatByteSizeW(CommitChargeTotal * 1024, + szChargeTotalFormat, + ARRAYSIZE(szChargeTotalFormat)); + + StrFormatByteSizeW(CommitChargeLimit * 1024, + szChargeLimitFormat, + ARRAYSIZE(szChargeLimitFormat)); + + wsprintfW(Text, szMemUsage, szChargeTotalFormat, szChargeLimitFormat, + (CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0)); + SendMessageW(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); } -DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter) +void RefreshPerformancePage(void) { ULONGLONG CommitChargeTotal; ULONGLONG CommitChargeLimit; ULONGLONG CommitChargePeak; - ULONG CpuUsage; - ULONG CpuKernelUsage; - ULONGLONG KernelMemoryTotal; ULONGLONG KernelMemoryPaged; ULONGLONG KernelMemoryNonPaged; @@ -315,191 +505,194 @@ DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter) ULONG TotalThreads; ULONG TotalProcesses; - MSG msg; + ULONG CpuUsage; + ULONG CpuKernelUsage; + ULONG i; WCHAR Text[260]; - WCHAR szMemUsage[256], szCpuUsage[256], szProcesses[256]; - - LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, _countof(szCpuUsage)); - LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, _countof(szMemUsage)); - LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, _countof(szProcesses)); - while (1) + int nBarsUsed1; + int nBarsUsed2; + + /* + * Update the commit charge info + */ + PerfDataGetCommitChargeK(&CommitChargeTotal, + &CommitChargeLimit, + &CommitChargePeak); + + _ui64tow(CommitChargeTotal, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_COMMIT_CHARGE_TOTAL, Text); + _ui64tow(CommitChargeLimit, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_COMMIT_CHARGE_LIMIT, Text); + _ui64tow(CommitChargePeak, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_COMMIT_CHARGE_PEAK, Text); + + /* + * Update the kernel memory info + */ + PerfDataGetKernelMemoryK(&KernelMemoryTotal, + &KernelMemoryPaged, + &KernelMemoryNonPaged); + + _ui64tow(KernelMemoryTotal, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_KERNEL_MEMORY_TOTAL, Text); + _ui64tow(KernelMemoryPaged, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_KERNEL_MEMORY_PAGED, Text); + _ui64tow(KernelMemoryNonPaged, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_KERNEL_MEMORY_NONPAGED, Text); + + /* + * Update the physical memory info + */ + PerfDataGetPhysicalMemoryK(&PhysicalMemoryTotal, + &PhysicalMemoryAvailable, + &PhysicalMemorySystemCache); + + _ui64tow(PhysicalMemoryTotal, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_PHYSICAL_MEMORY_TOTAL, Text); + _ui64tow(PhysicalMemoryAvailable, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_PHYSICAL_MEMORY_AVAILABLE, Text); + _ui64tow(PhysicalMemorySystemCache, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE, Text); + + /* + * Update the totals info + */ + TotalHandles = PerfDataGetSystemHandleCount(); + TotalThreads = PerfDataGetTotalThreadCount(); + TotalProcesses = PerfDataGetProcessCount(); + + _ultow(TotalHandles, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_TOTALS_HANDLE_COUNT, Text); + _ultow(TotalThreads, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_TOTALS_THREAD_COUNT, Text); + _ultow(TotalProcesses, Text, 10); + SetDlgItemTextW(hPerformancePage, IDC_TOTALS_PROCESS_COUNT, Text); + + /* + * Get the CPU usage + */ + CpuUsage = PerfDataGetProcessorUsage(); + CpuKernelUsage = PerfDataGetProcessorSystemUsage(); + if (CpuUsageHistoryGraphs) { - extern BOOL bTrackMenu; // From taskmgr.c - - int nBarsUsed1; - int nBarsUsed2; - - WCHAR szChargeTotalFormat[256]; - WCHAR szChargeLimitFormat[256]; + PerfDataAcquireLock(); - /* Wait for an the event or application close */ - if (GetMessage(&msg, NULL, 0, 0) <= 0) - return 0; - - if (msg.message == WM_TIMER) + for (i = 0; i < CpuTotalPanes; ++i) { - /* - * Update the commit charge info - */ - CommitChargeTotal = PerfDataGetCommitChargeTotalK(); - CommitChargeLimit = PerfDataGetCommitChargeLimitK(); - CommitChargePeak = PerfDataGetCommitChargePeakK(); - _ultow(CommitChargeTotal, Text, 10); - SetWindowTextW(hCommitChargeTotalEdit, Text); - _ultow(CommitChargeLimit, Text, 10); - SetWindowTextW(hCommitChargeLimitEdit, Text); - _ultow(CommitChargePeak, Text, 10); - SetWindowTextW(hCommitChargePeakEdit, Text); - - StrFormatByteSizeW(CommitChargeTotal * 1024, - szChargeTotalFormat, - _countof(szChargeTotalFormat)); - - StrFormatByteSizeW(CommitChargeLimit * 1024, - szChargeLimitFormat, - _countof(szChargeLimitFormat)); - - if (!bTrackMenu) - { - wsprintfW(Text, szMemUsage, szChargeTotalFormat, szChargeLimitFormat, - (CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0)); - SendMessageW(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); - } + GraphCtrl_AddPoint(&CpuUsageHistoryGraphs[i], + PerfDataGetProcessorUsagePerCPU(i), + PerfDataGetProcessorSystemUsagePerCPU(i)); + InvalidateRect(CpuUsageHistoryGraphs[i].hWnd, NULL, FALSE); + } - /* - * Update the kernel memory info - */ - KernelMemoryTotal = PerfDataGetKernelMemoryTotalK(); - KernelMemoryPaged = PerfDataGetKernelMemoryPagedK(); - KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK(); - _ultow(KernelMemoryTotal, Text, 10); - SetWindowTextW(hKernelMemoryTotalEdit, Text); - _ultow(KernelMemoryPaged, Text, 10); - SetWindowTextW(hKernelMemoryPagedEdit, Text); - _ultow(KernelMemoryNonPaged, Text, 10); - SetWindowTextW(hKernelMemoryNonPagedEdit, Text); - - /* - * Update the physical memory info - */ - PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); - PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); - PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK(); - _ultow(PhysicalMemoryTotal, Text, 10); - SetWindowTextW(hPhysicalMemoryTotalEdit, Text); - _ultow(PhysicalMemoryAvailable, Text, 10); - SetWindowTextW(hPhysicalMemoryAvailableEdit, Text); - _ultow(PhysicalMemorySystemCache, Text, 10); - SetWindowTextW(hPhysicalMemorySystemCacheEdit, Text); - - /* - * Update the totals info - */ - TotalHandles = PerfDataGetSystemHandleCount(); - TotalThreads = PerfDataGetTotalThreadCount(); - TotalProcesses = PerfDataGetProcessCount(); - _ultow(TotalHandles, Text, 10); - SetWindowTextW(hTotalsHandleCountEdit, Text); - _ultow(TotalThreads, Text, 10); - SetWindowTextW(hTotalsThreadCountEdit, Text); - _ultow(TotalProcesses, Text, 10); - SetWindowTextW(hTotalsProcessCountEdit, Text); - if (!bTrackMenu) - { - wsprintfW(Text, szProcesses, TotalProcesses); - SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)Text); - } + PerfDataReleaseLock(); + } + else + { + GraphCtrl_AddPoint(&CpuUsageHistoryGraph, CpuUsage, CpuKernelUsage); + InvalidateRect(CpuUsageHistoryGraph.hWnd, NULL, FALSE); + } - /* - * Redraw the graphs - */ - InvalidateRect(hCpuUsageGraph, NULL, FALSE); - InvalidateRect(hMemUsageGraph, NULL, FALSE); + /* + * Update the graphs + */ + nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0; + nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0; + // nBarsUsed2 = PhysicalMemoryTotal ? (((PhysicalMemoryTotal - PhysicalMemoryAvailable) * 100) / PhysicalMemoryTotal) : 0; + GraphCtrl_AddPoint(&MemUsageHistoryGraph, nBarsUsed1, nBarsUsed2); + + // CpuUsageGraph.Maximum = 100; + CpuUsageGraph.Current1 = CpuUsage; + CpuUsageGraph.Current2 = CpuKernelUsage; + + // + // TODO: The memory gauge may show the commit charge (Win2000/XP/2003), + // or show the **physical** memory amount (Windows Vista+). Have something + // to set the preference... + // + Meter_CommitChargeTotal = (PhysicalMemoryTotal - PhysicalMemoryAvailable); // CommitChargeTotal; + Meter_CommitChargeLimit = PhysicalMemoryTotal; // CommitChargeLimit; + + // MemUsageGraph.Maximum = Meter_CommitChargeLimit; + if (Meter_CommitChargeLimit) + MemUsageGraph.Current1 = (ULONG)((Meter_CommitChargeTotal * 100) / Meter_CommitChargeLimit); + else + MemUsageGraph.Current1 = 0; - /* - * Get the CPU usage - */ - CpuUsage = PerfDataGetProcessorUsage(); - CpuKernelUsage = PerfDataGetProcessorSystemUsage(); + /* Update the status bar */ + UpdatePerfStatusBar(TotalProcesses, CpuUsage, CommitChargeTotal, CommitChargeLimit); - if (!bTrackMenu) - { - wsprintfW(Text, szCpuUsage, CpuUsage); - SendMessageW(hStatusWnd, SB_SETTEXT, 1, (LPARAM)Text); - } + /** Down below, that's what we do IIF we are actually active and need to repaint stuff **/ - /* - * Get the memory usage - */ - CommitChargeTotal = PerfDataGetCommitChargeTotalK(); - CommitChargeLimit = PerfDataGetCommitChargeLimitK(); - nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0; - - PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); - PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); - nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0; - - GraphCtrl_AddPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage); - GraphCtrl_AddPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2); - InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE); - InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE); - } + /* + * Redraw the graphs + */ + InvalidateRect(hCpuUsageGraph, NULL, FALSE); + InvalidateRect(hMemUsageGraph, NULL, FALSE); + + // InvalidateRect(CpuUsageHistoryGraph.hwndGraph, NULL, FALSE); +#if 0 + for (i = 0; i < (TaskManagerSettings.CPUHistory_OneGraphPerCPU ? CpuTotalPanes : 1); ++i) + { + InvalidateRect(CpuUsageHistoryGraphs[i].hWnd, NULL, FALSE); } - return 0; +#endif + InvalidateRect(hMemUsageHistoryGraph, NULL, FALSE); } void PerformancePage_OnViewShowKernelTimes(void) { - HMENU hMenu; HMENU hViewMenu; + ULONG i; - hMenu = GetMenu(hMainWnd); - hViewMenu = GetSubMenu(hMenu, 2); + hViewMenu = GetSubMenu(GetMenu(hMainWnd), 2); - /* Check or uncheck the show 16-bit tasks menu item */ + /* Check or uncheck the show kernel times menu item */ if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED) { CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED); TaskManagerSettings.ShowKernelTimes = FALSE; - PerformancePageCpuUsageHistoryGraph.DrawSecondaryPlot = FALSE; } else { CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED); TaskManagerSettings.ShowKernelTimes = TRUE; - PerformancePageCpuUsageHistoryGraph.DrawSecondaryPlot = TRUE; } - GraphCtrl_RedrawBitmap(&PerformancePageCpuUsageHistoryGraph, PerformancePageCpuUsageHistoryGraph.BitmapHeight); + for (i = 0; i < CpuTotalPanes; ++i) + { + CpuUsageHistoryGraphs[i].DrawSecondaryPlot = TaskManagerSettings.ShowKernelTimes; + GraphCtrl_RedrawBitmap(&CpuUsageHistoryGraphs[i], CpuUsageHistoryGraphs[i].BitmapHeight); + } + RefreshPerformancePage(); } -void PerformancePage_OnViewCPUHistoryOneGraphAll(void) +VOID +PerformancePage_OnViewCPUHistoryGraph( + _In_ BOOL bShowAll) { - HMENU hMenu; - HMENU hViewMenu; HMENU hCPUHistoryMenu; + ULONG i; - 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); -} + hCPUHistoryMenu = GetSubMenu(GetSubMenu(GetMenu(hMainWnd), 2), 3); -void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void) -{ - HMENU hMenu; - HMENU hViewMenu; - HMENU hCPUHistoryMenu; + TaskManagerSettings.CPUHistory_OneGraphPerCPU = !bShowAll; + CheckMenuRadioItem(hCPUHistoryMenu, + ID_VIEW_CPUHISTORY_ONEGRAPHALL, + ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, + bShowAll ? ID_VIEW_CPUHISTORY_ONEGRAPHALL + : ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, + MF_BYCOMMAND); - hMenu = GetMenu(hMainWnd); - hViewMenu = GetSubMenu(hMenu, 2); - hCPUHistoryMenu = GetSubMenu(hViewMenu, 3); + /* Start the loop at 1 for the other CPUs; always keep the first CPU pane around */ + // ShowWindow(CpuUsageHistoryGraphs[0].hwndGraph, SW_SHOW); + for (i = 1; i < CpuTotalPanes; ++i) + { + ShowWindow(CpuUsageHistoryGraphs[i].hWnd, TaskManagerSettings.CPUHistory_OneGraphPerCPU ? SW_SHOW : SW_HIDE); + } - TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE; - CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND); + // RefreshPerformancePage(); } diff --git a/base/applications/taskmgr/perfpage.h b/base/applications/taskmgr/perfpage.h index fcf270eece349..8ec884b229e98 100644 --- a/base/applications/taskmgr/perfpage.h +++ b/base/applications/taskmgr/perfpage.h @@ -12,5 +12,11 @@ INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, void RefreshPerformancePage(void); void PerformancePage_OnViewShowKernelTimes(void); -void PerformancePage_OnViewCPUHistoryOneGraphAll(void); -void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void); + +VOID +PerformancePage_OnViewCPUHistoryGraph( + _In_ BOOL bShowAll); + +#ifdef __cplusplus +}; +#endif diff --git a/base/applications/taskmgr/precomp.h b/base/applications/taskmgr/precomp.h index 6b5aa223ed708..61f6603b1663b 100644 --- a/base/applications/taskmgr/precomp.h +++ b/base/applications/taskmgr/precomp.h @@ -16,6 +16,9 @@ #include #include +#include +#define ASSERT assert + #define WIN32_NO_STATUS #include @@ -33,8 +36,9 @@ #include "column.h" #include "taskmgr.h" #include "perfdata.h" -#include "procpage.h" #include "applpage.h" +#include "procpage.h" +#include "perfpage.h" #include "endproc.h" #include "graph.h" #include "graphctl.h" diff --git a/base/applications/taskmgr/procpage.c b/base/applications/taskmgr/procpage.c index 1d16f2a3b83a2..45d2ac5a1057c 100644 --- a/base/applications/taskmgr/procpage.c +++ b/base/applications/taskmgr/procpage.c @@ -33,10 +33,6 @@ BOOL bProcessPageSelectionMade = FALSE; /* Is item in ListCtrl selected */ static int nProcessPageWidth; static int nProcessPageHeight; -#ifdef RUN_PROC_PAGE -static HANDLE hProcessThread = NULL; -static DWORD dwProcessThread; -#endif int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); void AddProcess(ULONG Index); @@ -45,7 +41,7 @@ void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam); void ProcessPageShowContextMenu(DWORD dwProcessId); BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, ULONG nMaxCount); -DWORD WINAPI ProcessPageRefreshThread(void *lpParameter); +DWORD WINAPI ProcessPageRefreshThread(PVOID Parameter); int ProcessRunning(ULONG ProcessId); void Cleanup(void) @@ -158,22 +154,12 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) */ OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc); -#ifdef RUN_PROC_PAGE - /* Start our refresh thread */ - hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, &dwProcessThread); -#endif - /* Refresh page */ ProcessPageUpdate(); return TRUE; case WM_DESTROY: - /* Close the event handle, this will make the */ - /* refresh thread exit when the wait fails */ -#ifdef RUN_PROC_PAGE - EndLocalThread(&hProcessThread, dwProcessThread); -#endif SaveColumnSettings(); Cleanup(); break; @@ -447,24 +433,21 @@ void ProcessPageShowContextMenu(DWORD dwProcessId) void RefreshProcessPage(void) { -#ifdef RUN_PROC_PAGE - /* Signal the event so that our refresh thread */ - /* will wake up and refresh the process page */ - PostThreadMessage(dwProcessThread, WM_TIMER, 0, 0); -#endif + ProcessPageRefreshThread(NULL); } -DWORD WINAPI ProcessPageRefreshThread(void *lpParameter) +DWORD WINAPI ProcessPageRefreshThread(PVOID Parameter) { - MSG msg; + //MSG msg; - while (1) { - /* Wait for an the event or application close */ - if (GetMessage(&msg, NULL, 0, 0) <= 0) - return 0; - - if (msg.message == WM_TIMER) { + //while (1) + { + ///* Wait for an the event or application close */ + //if (GetMessage(&msg, NULL, 0, 0) <= 0) + // return 0; + //if (msg.message == WM_TIMER) + { UpdateProcesses(); if (IsWindowVisible(hProcessPage)) diff --git a/base/applications/taskmgr/resource.h b/base/applications/taskmgr/resource.h index ebfc0ebbbaf57..f78fd9e528ae5 100644 --- a/base/applications/taskmgr/resource.h +++ b/base/applications/taskmgr/resource.h @@ -122,8 +122,8 @@ #define IDC_MEM_USAGE_GRAPH2 1048 #define IDC_MEM_USAGE_GRAPH 1048 #define IDC_CPU30 1049 -#define IDC_MEM_USAGE_HISTORY_GRAPH 1049 -#define IDC_CPU_USAGE_HISTORY_GRAPH 1050 +#define IDC_CPU_USAGE_HISTORY_GRAPH 1049 +#define IDC_MEM_USAGE_HISTORY_GRAPH 1050 #define IDC_CPU31 1051 #define IDS_TOTALS_HANDLE_COUNT 1060 diff --git a/base/applications/taskmgr/taskmgr.c b/base/applications/taskmgr/taskmgr.c index 686abc37352ba..56fe65d674a64 100644 --- a/base/applications/taskmgr/taskmgr.c +++ b/base/applications/taskmgr/taskmgr.c @@ -233,10 +233,10 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) PerformancePage_OnViewShowKernelTimes(); break; case ID_VIEW_CPUHISTORY_ONEGRAPHALL: - PerformancePage_OnViewCPUHistoryOneGraphAll(); + PerformancePage_OnViewCPUHistoryGraph(TRUE); break; case ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU: - PerformancePage_OnViewCPUHistoryOneGraphPerCPU(); + PerformancePage_OnViewCPUHistoryGraph(FALSE); break; case ID_VIEW_UPDATESPEED_HIGH: case ID_VIEW_UPDATESPEED_NORMAL: @@ -497,7 +497,8 @@ void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr) static void SetUpdateSpeed(HWND hWnd) { /* Setup update speed (pause=fall down) */ - switch (TaskManagerSettings.UpdateSpeed) { + switch (TaskManagerSettings.UpdateSpeed) + { case ID_VIEW_UPDATESPEED_HIGH: SetTimer(hWnd, 1, 500, NULL); break; @@ -693,9 +694,8 @@ BOOL OnCreate(HWND hWnd) SetUpdateSpeed(hWnd); /* - * Refresh the performance data - * Sample it twice so we can establish - * the delta values & cpu usage + * Refresh the performance data. Sample it twice + * so we can establish the delta values & cpu usage. */ PerfDataRefresh(); PerfDataRefresh(); @@ -1106,6 +1106,7 @@ LPWSTR GetLastErrorText(LPWSTR lpszBuf, DWORD dwSize) return lpszBuf; } +#if 0 DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread) { DWORD dwExitCodeThread = 0; @@ -1128,4 +1129,4 @@ DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread) } return dwExitCodeThread; } - +#endif diff --git a/base/applications/taskmgr/taskmgr.h b/base/applications/taskmgr/taskmgr.h index 58eee4692b256..8064491f9dde5 100644 --- a/base/applications/taskmgr/taskmgr.h +++ b/base/applications/taskmgr/taskmgr.h @@ -9,10 +9,6 @@ #include "resource.h" -#define RUN_APPS_PAGE -#define RUN_PROC_PAGE -#define RUN_PERF_PAGE - #define STATUS_WINDOW 2001 #define STATUS_SIZE1 85 #define STATUS_SIZE2 157 // he-IL.rc determines minimum width: 72 == 157 - 85