Skip to main content

parse_instance

Function parse_instance 

Source
pub fn parse_instance(name: &str) -> Option<ParsedInstance>
Expand description

Parse a PDH GPU counter-instance name, e.g. pid_1234_luid_0x00000000_0x0000C739_phys_0_eng_3_engtype_3D.

Grammar (mirrors windows_exporter’s production parser, §3.2): split on _; keyword tokens consume their values — pid/phys/part/eng one decimal, luid two hex DWORDs, engtype the rest of the string (underscores preserved — the engtype set is open and future names may contain them). The grammar is keyword-driven, not positional, so token reordering still parses. Anything malformed → None: an instance we cannot read is an instance we must not guess about (it counts as unattributed, same as a LUID mismatch).