instrumentation: Use null when CPU load is unknown

This commit is contained in:
Tyler Yankee
2025-09-25 09:16:12 -04:00
committed by Brad King
parent f98e6109c0
commit 11f67d416a
2 changed files with 7 additions and 4 deletions

View File

@@ -410,13 +410,15 @@ and contain the following data:
The Host Memory Used in KiB at ``timeStart``.
``afterHostMemoryUsed``
The Host Memory Used in KiB at ``timeStop``.
The Host Memory Used in KiB at ``timeStart + duration``.
``beforeCPULoadAverage``
The Average CPU Load at ``timeStart``.
The Average CPU Load at ``timeStart``, or ``null`` if it cannot be
determined.
``afterCPULoadAverage``
The Average CPU Load at ``timeStop``.
The Average CPU Load at ``timeStart + duration``, or ``null`` if it cannot
be determined.
``configureContent``
The path to a :ref:`cmake_instrumentation Configure Content` file located

View File

@@ -416,7 +416,8 @@ void cmInstrumentation::InsertDynamicSystemInformation(
}
root["dynamicSystemInformation"][cmStrCat(prefix, "HostMemoryUsed")] =
memory;
root["dynamicSystemInformation"][cmStrCat(prefix, "CPULoadAverage")] = load;
root["dynamicSystemInformation"][cmStrCat(prefix, "CPULoadAverage")] =
load > 0 ? Json::Value(load) : Json::nullValue;
}
void cmInstrumentation::GetDynamicSystemInformation(double& memory,