reactos/base/applications/taskmgr/perfdata.h

95 lines
3 KiB
C
Raw Normal View History

/*
[0.4.7][TASKMGR] Backport many fixes and improvements Some commits I do port back all the way down till releases/0.4.7: partially 0.4.15-dev-6768-g 63eaf2bd529f5bf94cde65afc26944e98b47850b [TASKMGR] *.rc Deduplicate dynamic menu strings (#5772) (I left out the FIXME-comments) 0.4.15-dev-6712-g 46b4b5581d1fc4c1b50cfc0ee8b82b77be182dc6 [TASKMGR] Favor _countof(), no functional change intended (#5757) 0.4.15-dev-6703-g 6528ab8fcb41eb47ee17cf738760126e6758af94 [TASKMGR] de-DE.rc Update part 3 0.4.15-dev-6702-g 65ce20896afa19032612871506dd5d1e8eb73119 [TASKMGR] *.rc Strip unused IDD_DEBUG_CHANNELS_DIALOG 0.4.15-dev-6700-g e15d68ba5d9906674b363cf8362ed08494e53a76 [TASKMGR] de-DE German Update & bug-fixes partially 0.4.15-dev-6447-g 016acd170dd75a7a24af235339a5321e2c24bf5a [TASKMGR] Do not free shared icon for ShellAbout() calls (I picked just the taskmgr part) (was part of larger PR5519) 0.4.15-dev-6297-g 831288fe691ec311c5b910f05d9b833b4b952261 [TASKMGR] Fix text truncation for fr-FR.rc (#5380) CORE-18523 0.4.15-dev-6127-g c706222f3f1b2a63e8cc969ee756c8be92527853 [TASKMGR] Fix the license. Turns out it's LGPL-2.1-or-later from the texts. 0.4.15-dev-6124-g 9927163455b83fea29c6420a688535b8e233bff6 [TASKMGR] Reorder page controls to have natural TAB-ordering. 0.4.15-dev-6122-g d5707eefe2f08d230c07ab4693ac0bd59e809f85 [TASKMGR] High speed update is twice per second, and not every second. 0.4.15-dev-6121-g 2da0506f2a9fc02acede7d7ff479399013830fad [TASKMGR] Remove more dead code. partially 0.4.15-dev-6120-g 6e77747b305add73133faa2049b8bd34e3e2534e [TASKMGR] Simplify tray icon code. (I left out using the strsafe.h-dependent stuff, as this is safe also in old-style) 0.4.15-dev-6119-g 0b4c8bdd1cb4cf1a50c1076c7ded19ee7e9f9198 [TASKMGR] Clamp the values returned from PerfDataGetProcessorUsage() and PerfDataGetProcessorSystemUsage() inside these functions. 0.4.15-dev-6118-g 7b53126375ee8889cf24615fa2ea646feabee0ae [TASKMGR] Completely reformat perfpage.c, perfpage.h, procpage.h and trayicon.c partially 0.4.15-dev-6117-g da7dcec6a06c052339120ed4baa3caf24594f163 [TASKMGR] Reformat the files' headers 0.4.15-dev-6115-g 36aea8e56eb6eb9f1cab5fd6ce040b80ef6a302f [TASKMGR] affinity.c: Use _countof instead of sizeof/sizeof (was part of the larger CORE18991) partially 0.4.15-dev-6109-g 99fb812be4ba86139438bf7961f2030ac9e016be [TASKMGR] Refactor trayicon.c 0.4.15-dev-5404-g c093d4f8038e7ddec1ca193edc573c48e12f12ff [TASKMGR] Prevent context menu on idle process (#4889) CORE-18640 0.4.15-dev-5031-g 46ea5171bdfaba2606486e27821fdd9ee88e551a [TASKMGR] Pixel-perfection for left border (#4680) CORE-18061 0.4.15-dev-4988-g de5af76811bbd318cdef46e193f306833e3fa740 [TASKMGR] Fix overlapping controls (French only) (#4658) 0.4.15-dev-4987-g f8c28b977363444ad31124a6794347c53532b43f [TASKMGR] Fix UI on SwitchTo for multiple application (#4652) 0.4.15-dev-3497-g e8a7e0da2bcbd842f95e4224e72bfb5d748dbd05 [TASKMGR] Make 'Hide When Minimized' non-default (#4169) 0.4.15-dev-3085-g 515e0cf38f8d07e59bb003f930eb08d33dc5f85d [TASKMGR] Handles: Get number only, skip data (#3910) and a few *.rc improvements that are not explicitly mentioned here, especially I stripped the menuLoop-statusbar-help-texts within the older branches. A few improvements are still left to be done in a future commit (mostly around the plotgraphs and the trayicon-handling), but I need to have a closer look at them and their impact on binary size, so I do not want to squash them into this bigger backport, where I concentrated on the safe/obvious and easy things. Binary size decreases for all branches: master taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg 708.608 -> 696.832 (0.4.15-dev-6768-g63eaf2b) 0.4.14 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 660.992 -> 549.888 0.4.13 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 659.968 -> 542.720 0.4.12 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 662.016 -> 545.792 0.4.11 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 662.016 -> 545.792 0.4.10 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 645.120 -> 532.480 0.4. 9 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 645.120 -> 532.480 0.4. 8 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 645.120 -> 532.480 0.4. 7 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 645.120 -> 531.456 taskmgr.exe MS XPSP3 german 140.800 Bytes 0.4.14 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=de-DE -> 110.080 Bytes (my current taskmgr of choice) 0.4. 8 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US -> 108.032 Bytes 0.4. 7 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US -> 107.520 Bytes
2023-10-19 15:25:14 +02:00
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* COPYRIGHT: 1999-2001 Brian Palmer <brianp@reactos.org>
*/
#pragma once
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
typedef struct _PERFDATA
{
WCHAR ImageName[MAX_PATH];
HANDLE ProcessId;
WCHAR UserName[MAX_PATH];
ULONG SessionId;
ULONG CPUUsage;
LARGE_INTEGER CPUTime;
ULONG WorkingSetSizeBytes;
ULONG PeakWorkingSetSizeBytes;
ULONG WorkingSetSizeDelta;
ULONG PageFaultCount;
ULONG PageFaultCountDelta;
ULONG VirtualMemorySizeBytes;
ULONG PagedPoolUsagePages;
ULONG NonPagedPoolUsagePages;
ULONG BasePriority;
ULONG HandleCount;
ULONG ThreadCount;
ULONG USERObjectCount;
ULONG GDIObjectCount;
IO_COUNTERS IOCounters;
LARGE_INTEGER UserTime;
LARGE_INTEGER KernelTime;
} PERFDATA, *PPERFDATA;
typedef struct _CMD_LINE_CACHE
{
[0.4.7][TASKMGR] Mainly Graph-stuff backports 2023-10-31 This backports the following commits: 0.4.15-dev-6770-g ddd1d19b3fbf6731eb5339d5834f7f519caeae39 [TASKMGR] Get rid of cplusplus extern c (#5808) partially 0.4.15-dev-6120-g 6e77747b305add73133faa2049b8bd34e3e2534e [TASKMGR] Simplify tray icon code 0.4.15-dev-6114-g 9a6c85f68aa0e2ec4595d4673e59f5ade2521a6f [TASKMGR] Fix PerfDataDeallocCommandLineCache, part of CORE-18014 (unresolved still) 0.4.15-dev-6113-g 7989e3f26cafd74c9d8fdeef64deece0da591634 [TASKMGR] GraphCtrl_Dispose: Delete hdcGraph first, part of CORE-18014 (unresolved still) 0.4.15-dev-6112-g dc14a9f6e0d9b6ce3ccc84daba923edb1cc0167f [TASKMGR] GraphCtrl: Use DeleteDC instead of DeleteObject to delete inst->hdcGraph, part of CORE-18014 (unresolved still) partially 0.4.15-dev-4994-g 15a0f7adb0694107b981bbf6c5292036f1e55d79 picked a tiny part from PR4657 (I picked only the refactoring to switch-statement, no functional changes. Especially NOT the formatting changes which would require the additional winnls.h-include) 0.4.15-dev-3737-g f8faa0b660da189ce00c614e19aa0a47a05d2520 [TASKMGR] Fix a heap corruption bug (#4311), just an addendum to PR4141 which is picked with this backport as well. Older branches were never affected. partially 0.4.15-dev-3514-g 1c82bf032498d3d107aae7174c5fb179680f0eb5 [TASKMGR] Avoid freezing in getting icons, from (PR4180) CORE17894. I picked only the 1000ms->100ms part and the stripping of WM_QUERYDRAGICON call. Therefore I don't consider CORE17894 as fully covered. 0.4.15-dev-3486-g 545e1190f2caf714ff897d909645adc04178e3a6 [TASKMGR] Avoid hangs as much as possible (#4166) CORE17894 partially 0.4.15-dev-3483-g 403222dd4f73836b38c11a42fa6c3fc1614681d7 [TASKMGR] Preserve graphs history on resizes (#4141). I left aside the structs type renaming and OOM-Handling upon graph creation. Picked all the logical changes though. 0.4.15-dev-3269-g 0ed04e36406fc24b3d08e795a89962c253226f1f [TASKMGR] Make performance graph grid scroll (#3581) 0.4.15-dev-3268-g a4ab9a1e196a21633349496c211756f1e5cdbaf2 [TASKMGR] Formatting only (#3581). Covers the last bits of that PR. Main motivation was getting the toggling of ShowKernelTimes in the Performance tab switch on and off in realtime without introducing gaps in the graph. It also makes the grid scroll together with the data, like on Windows. Most other parts I picked solely for their binary-shrinking effect. I decided to strip the ID_HELP_TOPICS from the rc files, as this was not implemented, and I would never port that back later. So it is one less non-functional-button in the older branches. I favored memset() over Zeromemory() in this usermode-app everywhere, and favored for (;;) over while(1). Binary size shrinks slightly on all branches: master taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg 696.832 (0.4.15-dev-6820-gb3194e3) 0.4.14 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 549.888 -> 548.864 0.4.13 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 542.720 -> 542.208 0.4.12 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 545.792 -> 543.232 0.4.11 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 545.792 -> 543.232 0.4.10 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 9 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 8 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 7 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 531.456 -> 529.408 taskmgr.exe MS XPSP3 german 140.800 Bytes 0.4.14 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=de-DE 110.080 Bytes -> 109.056 Bytes (my current taskmgr of choice) 0.4. 8 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US 108.032 Bytes -> 105.984 Bytes 0.4. 7 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US 107.520 Bytes -> 105.472 Bytes
2023-10-31 21:09:58 +01:00
DWORD idx;
LPWSTR str;
[0.4.7][TASKMGR] Mainly Graph-stuff backports 2023-10-31 This backports the following commits: 0.4.15-dev-6770-g ddd1d19b3fbf6731eb5339d5834f7f519caeae39 [TASKMGR] Get rid of cplusplus extern c (#5808) partially 0.4.15-dev-6120-g 6e77747b305add73133faa2049b8bd34e3e2534e [TASKMGR] Simplify tray icon code 0.4.15-dev-6114-g 9a6c85f68aa0e2ec4595d4673e59f5ade2521a6f [TASKMGR] Fix PerfDataDeallocCommandLineCache, part of CORE-18014 (unresolved still) 0.4.15-dev-6113-g 7989e3f26cafd74c9d8fdeef64deece0da591634 [TASKMGR] GraphCtrl_Dispose: Delete hdcGraph first, part of CORE-18014 (unresolved still) 0.4.15-dev-6112-g dc14a9f6e0d9b6ce3ccc84daba923edb1cc0167f [TASKMGR] GraphCtrl: Use DeleteDC instead of DeleteObject to delete inst->hdcGraph, part of CORE-18014 (unresolved still) partially 0.4.15-dev-4994-g 15a0f7adb0694107b981bbf6c5292036f1e55d79 picked a tiny part from PR4657 (I picked only the refactoring to switch-statement, no functional changes. Especially NOT the formatting changes which would require the additional winnls.h-include) 0.4.15-dev-3737-g f8faa0b660da189ce00c614e19aa0a47a05d2520 [TASKMGR] Fix a heap corruption bug (#4311), just an addendum to PR4141 which is picked with this backport as well. Older branches were never affected. partially 0.4.15-dev-3514-g 1c82bf032498d3d107aae7174c5fb179680f0eb5 [TASKMGR] Avoid freezing in getting icons, from (PR4180) CORE17894. I picked only the 1000ms->100ms part and the stripping of WM_QUERYDRAGICON call. Therefore I don't consider CORE17894 as fully covered. 0.4.15-dev-3486-g 545e1190f2caf714ff897d909645adc04178e3a6 [TASKMGR] Avoid hangs as much as possible (#4166) CORE17894 partially 0.4.15-dev-3483-g 403222dd4f73836b38c11a42fa6c3fc1614681d7 [TASKMGR] Preserve graphs history on resizes (#4141). I left aside the structs type renaming and OOM-Handling upon graph creation. Picked all the logical changes though. 0.4.15-dev-3269-g 0ed04e36406fc24b3d08e795a89962c253226f1f [TASKMGR] Make performance graph grid scroll (#3581) 0.4.15-dev-3268-g a4ab9a1e196a21633349496c211756f1e5cdbaf2 [TASKMGR] Formatting only (#3581). Covers the last bits of that PR. Main motivation was getting the toggling of ShowKernelTimes in the Performance tab switch on and off in realtime without introducing gaps in the graph. It also makes the grid scroll together with the data, like on Windows. Most other parts I picked solely for their binary-shrinking effect. I decided to strip the ID_HELP_TOPICS from the rc files, as this was not implemented, and I would never port that back later. So it is one less non-functional-button in the older branches. I favored memset() over Zeromemory() in this usermode-app everywhere, and favored for (;;) over while(1). Binary size shrinks slightly on all branches: master taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg 696.832 (0.4.15-dev-6820-gb3194e3) 0.4.14 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 549.888 -> 548.864 0.4.13 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 542.720 -> 542.208 0.4.12 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 545.792 -> 543.232 0.4.11 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 545.792 -> 543.232 0.4.10 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 9 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 8 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 532.480 -> 530.432 0.4. 7 taskmgr.exe RosBEWin2.1.6 GCC4.7.2dbg 531.456 -> 529.408 taskmgr.exe MS XPSP3 german 140.800 Bytes 0.4.14 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=de-DE 110.080 Bytes -> 109.056 Bytes (my current taskmgr of choice) 0.4. 8 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US 108.032 Bytes -> 105.984 Bytes 0.4. 7 taskmgr.exe RosBEWin2.1.6 MSVC2010SP1rls I18N=en-US 107.520 Bytes -> 105.472 Bytes
2023-10-31 21:09:58 +01:00
ULONG len;
struct _CMD_LINE_CACHE* pnext;
} CMD_LINE_CACHE, *PCMD_LINE_CACHE;
BOOL PerfDataInitialize(void);
void PerfDataUninitialize(void);
void PerfDataRefresh(void);
BOOL PerfDataGet(ULONG Index, PPERFDATA *lppData);
ULONG PerfDataGetProcessIndex(ULONG pid);
ULONG PerfDataGetProcessCount(void);
ULONG PerfDataGetProcessorUsage(void);
ULONG PerfDataGetProcessorSystemUsage(void);
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount);
ULONG PerfDataGetProcessId(ULONG Index);
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount);
BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount);
void PerfDataDeallocCommandLineCache();
ULONG PerfDataGetSessionId(ULONG Index);
ULONG PerfDataGetCPUUsage(ULONG Index);
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index);
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index);
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index);
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index);
ULONG PerfDataGetPageFaultCount(ULONG Index);
ULONG PerfDataGetPageFaultCountDelta(ULONG Index);
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index);
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index);
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index);
ULONG PerfDataGetBasePriority(ULONG Index);
ULONG PerfDataGetHandleCount(ULONG Index);
ULONG PerfDataGetThreadCount(ULONG Index);
ULONG PerfDataGetUSERObjectCount(ULONG Index);
ULONG PerfDataGetGDIObjectCount(ULONG Index);
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters);
ULONG PerfDataGetCommitChargeTotalK(void);
ULONG PerfDataGetCommitChargeLimitK(void);
ULONG PerfDataGetCommitChargePeakK(void);
ULONG PerfDataGetKernelMemoryTotalK(void);
ULONG PerfDataGetKernelMemoryPagedK(void);
ULONG PerfDataGetKernelMemoryNonPagedK(void);
ULONG PerfDataGetPhysicalMemoryTotalK(void);
ULONG PerfDataGetPhysicalMemoryAvailableK(void);
ULONG PerfDataGetPhysicalMemorySystemCacheK(void);
ULONG PerfDataGetSystemHandleCount(void);
ULONG PerfDataGetTotalThreadCount(void);