Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Not for merging] Mapping different kinds of memory between System.Diagnostics.Process and Process Explorer #673

Closed

Conversation

Yun-Ting
Copy link
Contributor

@Yun-Ting Yun-Ting commented Sep 30, 2022

Used OTel Console Exporter to log out different fields of System.Diagnostics.Process and compare them with the values reported by Process Explorer.

The export interval of Console Exporter was set to be 1 second and so does the refresh interval of Process Explorer.
Process Explorer does not support exporting a snapshot at a given timestamp; therefore, the snapshot below from Process Explorer was taken from manually.
The timestamp difference between the console log from Console Exporter and the values observed from Process Explorer should be less than 2 seconds.

Refresh()

Export process.memory.usage, The amount of workingSet64, Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.0.0.0
(2022-09-30T21:20:25.4082092Z, 2022-09-30T21:20:43.4169199Z] DoubleGauge
Value: 32808960

Export process.memory.pagedMemorySize, The amount of pagedMemorySize, Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.0.0.0
(2022-09-30T21:20:25.4113453Z, 2022-09-30T21:20:43.4169202Z] DoubleGauge
Value: 17805312

Export process.memory.pagedSystemMemorySize, The amount of pagedSystemMemorySize, Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.0.0.0
(2022-09-30T21:20:25.4114016Z, 2022-09-30T21:20:43.4169206Z] DoubleGauge
Value: 226896

Export process.memory.nonPagedSystemMemorySize, The amount of nonPagedSystemMemorySize, Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.0.0.0
(2022-09-30T21:20:25.4114187Z, 2022-09-30T21:20:43.4169208Z] DoubleGauge
Value: 23872

Export process.memory.privateMemorySize, The amount of PrivateMemorySize, Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.0.0.0
(2022-09-30T21:20:25.4114391Z, 2022-09-30T21:20:43.4169209Z] DoubleGauge
Value: 17805312

image

This is the name-mapping table based on the above observation:

System.Diagnostics.Process field name column name in Process Explorer
pagedMemorySize64, privateMemorySize64 Private Bytes
pagedSystemMemorySize64 Paged Pool
nonpagedSystemMemorySize64 Nonpaged Pool
workingSet64 Working Set

From OTel Process Spec,
the "process.memory.virtual" instrument should be reflecting "The amount of committed virtual memory."

The definition of committed virtual memory from Mark Russinovich's blogpost is defined as:
"There are two types of process virtual memory that do count toward the commit limit: private and pagefile-backed."
Windows tracks the private bytes usage with the Private Bytes performance counter. While there are no process-specific counter to look for pagefile-backed virtual memory.

Due to the above mentioning reasons, and the fact that there is no existing field from System.Diagnostic.Process to get pagefile-backed virtual memory usage, I propose to use "private virtual memory dedicated to the currentProcess" as the description for the .NET implementation of the gauge "process.memory.virtual".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant