Browse Source

instrumentation: Use null when CPU load is unknown

Tyler Yankee 3 weeks ago
parent
commit
11f67d416a
2 changed files with 7 additions and 4 deletions
  1. 5 3
      Help/manual/cmake-instrumentation.7.rst
  2. 2 1
      Source/cmInstrumentation.cxx

+ 5 - 3
Help/manual/cmake-instrumentation.7.rst

@@ -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

+ 2 - 1
Source/cmInstrumentation.cxx

@@ -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,