chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.04k stars 890 forks source link

(ENGTASKS-3693) Prototype updating user agent with process information #3460

Open AdmiringWorm opened 3 weeks ago

AdmiringWorm commented 3 weeks ago

Description Of Changes

This PR includes a prototype changes of an investigation where we include additional information about the current process tree that choco.exe is part of, including additional information about what the current process is when needed.

Additionally, benchmarks have also been added as part of this investigation.

Below is the results from these benchmarks that was ran on a dedicated computer (This had been ran multiple times, but only one result is included).

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3593/23H2/2023Update/SunValley3) AMD Ryzen 7 2700X, 1 CPU, 16 logical and 8 physical cores [Host] : .NET Framework 4.8.1 (4.8.9241.0), X86 LegacyJIT Job-NBIXUS : .NET Framework 4.8.1 (4.8.9241.0), X64 LegacyJIT

Jit=LegacyJit Platform=X64 Runtime=.NET Framework 4.8

Method Mean Error StdDev Ratio Gen0 Gen1 Gen2 Allocated Alloc Ratio
GetParentProcessDocumentedPinvoke 25.297 ms 0.0724 ms 0.0677 ms 0.35 - - - 89.5 KB 0.010
GetParentProcessFilteredDocumentedPinvoke 26.714 ms 0.0955 ms 0.0894 ms 0.37 31.2500 - - 186.25 KB 0.020
GetParentProcessFilteredManaged 76.386 ms 0.1347 ms 0.1260 ms 1.06 2000.0000 1000.0000 1000.0000 9499.4 KB 1.014
GetParentProcessFilteredUndocumentedPinvoke 11.621 ms 0.0451 ms 0.0422 ms 0.16 31.2500 - - 155.88 KB 0.017
GetParentProcessManaged 72.269 ms 0.2458 ms 0.2179 ms 1.00 2000.0000 1000.0000 1000.0000 9371.36 KB 1.000
GetParentProcessTreeDocumentedPinvoke 27.000 ms 0.0896 ms 0.0838 ms 0.37 31.2500 - - 231.5 KB 0.025
GetParentProcessTreeManaged 75.331 ms 0.2134 ms 0.1997 ms 1.04 2000.0000 1000.0000 1000.0000 9370.23 KB 1.000
GetParentProcessTreeUndocumentedPinvoke 11.561 ms 0.1412 ms 0.1569 ms 0.16 46.8750 15.6250 - 199.76 KB 0.021
GetParentProcessUndocumentedPinvoke 7.860 ms 0.0649 ms 0.0607 ms 0.11 - - - 59.5 KB 0.006
GetParentProcessTreeImplemented 11.416 ms 0.0385 ms 0.0360 ms 0.16 46.8750 15.6250 - 199.76 KB 0.021
Method tree Mean Error StdDev Median Ratio RatioSD Gen0 Allocated Alloc Ratio
GetFirstFilteredProcessName chocolatey.benchmark 1.9503 ns 0.0040 ns 0.0033 ns 1.9511 ns ? ? - - ?
GetFirstProcessName chocolatey.benchmark 1.9536 ns 0.0056 ns 0.0047 ns 1.9540 ns ? ? - - ?
GetLastFilteredProcessName chocolatey.benchmark 1.9520 ns 0.0036 ns 0.0033 ns 1.9525 ns ? ? - - ?
GetLastProcessName chocolatey.benchmark 1.9546 ns 0.0079 ns 0.0066 ns 1.9531 ns ? ? - - ?
GetProcessesList chocolatey.benchmark 0.0002 ns 0.0008 ns 0.0007 ns 0.0000 ns ? ? - - ?
GetFirstFilteredProcessName choco(...)minal [63] 178.0415 ns 0.7922 ns 0.7411 ns 178.0618 ns ? ? 0.0153 64 B ?
GetFirstProcessName choco(...)minal [63] 2.9928 ns 0.0036 ns 0.0034 ns 2.9919 ns ? ? - - ?
GetLastFilteredProcessName choco(...)minal [63] 178.9408 ns 0.3029 ns 0.2685 ns 178.9092 ns ? ? 0.0153 64 B ?
GetLastProcessName choco(...)minal [63] 3.7814 ns 0.0060 ns 0.0056 ns 3.7821 ns ? ? - - ?
GetProcessesList choco(...)minal [63] 0.0000 ns 0.0000 ns 0.0000 ns 0.0000 ns ? ? - - ?
GetFirstFilteredProcessName choco(...)lorer [58] 163.7587 ns 0.3715 ns 0.3475 ns 163.8501 ns ? ? 0.0172 72 B ?
GetFirstProcessName choco(...)lorer [58] 2.9863 ns 0.0026 ns 0.0023 ns 2.9866 ns ? ? - - ?
GetLastFilteredProcessName choco(...)lorer [58] 193.6758 ns 0.5614 ns 0.4688 ns 193.5690 ns ? ? 0.0248 104 B ?
GetLastProcessName choco(...)lorer [58] 3.7737 ns 0.0127 ns 0.0112 ns 3.7711 ns ? ? - - ?
GetProcessesList choco(...)lorer [58] 0.0000 ns 0.0000 ns 0.0000 ns 0.0000 ns ? ? - - ?
GetFirstFilteredProcessName choco(...)Tabby [37] 189.7154 ns 1.0933 ns 0.9692 ns 189.5110 ns ? ? 0.0248 104 B ?
GetFirstProcessName choco(...)Tabby [37] 2.7607 ns 0.0054 ns 0.0045 ns 2.7617 ns ? ? - - ?
GetLastFilteredProcessName choco(...)Tabby [37] 166.6200 ns 0.3285 ns 0.3073 ns 166.6799 ns ? ? 0.0172 72 B ?
GetLastProcessName choco(...)Tabby [37] 3.3230 ns 0.0056 ns 0.0046 ns 3.3236 ns ? ? - - ?
GetProcessesList choco(...)Tabby [37] 0.0000 ns 0.0000 ns 0.0000 ns 0.0000 ns ? ? - - ?

Motivation and Context

To investigate possibilies that we have.

Testing

As this is just an investigation, there are no testing steps.

Operating Systems Testing

Change Types Made

Change Checklist

Related Issue

N/A