Just so you know, if you’re poking around in the SQLite data, it might help to issue the commands .header on and .mode column. The first command will turn on display of column headers, and the second will make the output more human readable.
The .schema command will also help with exploration. If we look at the structure of the GPU_METRICS table, you can see a references to the TARGET_INFO_GPU_METRICS table.
sqlite> .schema GPU_METRICS
CREATE TABLE GPU_METRICS (
-- GPU Metrics, events and values.
rawTimestamp INTEGER NOT NULL, -- Raw event timestamp recorded during profiling.
timestamp INTEGER NOT NULL, -- Event timestamp (ns).
typeId INTEGER NOT NULL, -- REFERENCES TARGET_INFO_GPU_METRICS(typeId) and GENERIC_EVENT_TYPES(typeId)
metricId INTEGER NOT NULL, -- REFERENCES TARGET_INFO_GPU_METRICS(metricId)
value INTEGER NOT NULL -- Counter data value
);
The TARGET_INFO_GPU_METRICS table references GENERIC_EVENT_SOURCES via the sourceId, which is the value you want.
sqlite> .schema TARGET_INFO_GPU_METRICS
CREATE TABLE TARGET_INFO_GPU_METRICS (
-- GPU Metrics, metric names and ids.
typeId INTEGER NOT NULL, -- REFERENCES GENERIC_EVENT_TYPES(typeId)
sourceId INTEGER NOT NULL, -- REFERENCES GENERIC_EVENT_SOURCES(sourceId)
typeName TEXT NOT NULL, -- Name of event type.
metricId INTEGER NOT NULL, -- Id of metric in event; not assumed to be stable.
metricName TEXT NOT NULL -- Definitive name of metric.
);
According to the schema of the GENERIC_EVENT_SOURCES table, the sourceId is a GlobalID value:
sqlite> .schema GENERIC_EVENT_SOURCES
CREATE TABLE GENERIC_EVENT_SOURCES (
-- Generic event source modules
sourceId INTEGER NOT NULL PRIMARY KEY, -- Serialized GlobalId.
nameId INTEGER NOT NULL, -- REFERENCES StringIds(id) -- Event source name
timeSourceId INTEGER NOT NULL, -- REFERENCES ENUM_NSYS_GENERIC_EVENT_SOURCE(id)
sourceGroupId INTEGER NOT NULL, -- REFERENCES ENUM_NSYS_GENERIC_EVENT_GROUP(id)
hyperType TEXT, -- Hypervisor Type
hyperVersion TEXT, -- Hypervisor Version
hyperStructPrefix TEXT, -- Hypervisor Struct Prefix
hyperMacroPrefix TEXT, -- Hypervisor Macro Prefix
hyperFilterFlags INTEGER, -- Hypervisor Custom Filter Flags
hyperDomain TEXT, -- Hypervisor Domain
data TEXT -- JSON encoded generic event source description.
);
The exact format of a GlobalID value depends on how it is used, but it tends to be a compound number made up of bit fields. For this sourceId, I believe it has an 8-bit VmId field (which is actually virtual GPU, not a traditional virtual machine) and an 8-bit GPU HwId. It helps to look at GlobalID values in hex, for example SELECT format('0x%X', sourceId) AS sourceId FROM TARGET_INFO_GPU_METRICS. You should be able to spot a correspondence between that value and the vmId and/or id values in TARGET_INFO_GPU. The TARGET_INFO_GPU:vmId is also a GlobalID, so looking in hex will help.
Let us know if that’s not working out or still confusing.