diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst index 4163150280..661ebe92cc 100644 --- a/Help/manual/cmake-instrumentation.7.rst +++ b/Help/manual/cmake-instrumentation.7.rst @@ -607,10 +607,10 @@ Snippet files have a filename with the syntax ``maxRSS`` Maximum resident set size in KiB. - ``userTimeUSec`` + ``userTime`` User CPU time in microseconds. - ``systemTimeUSec`` + ``systemTime`` System CPU time in microseconds. If the data could not be collected, this object is ``null``. @@ -660,8 +660,8 @@ Example: "processMetrics" : { "maxRSS" : 21032, - "userTimeUSec" : 18000, - "systemTimeUSec" : 5000 + "userTime" : 18000, + "systemTime" : 5000 }, "timeStart" : 1737053448177, "duration" : 31, diff --git a/Help/manual/instrumentation/snippet-v1-schema.json b/Help/manual/instrumentation/snippet-v1-schema.json index f10ba4f233..cf3bd3bc5d 100644 --- a/Help/manual/instrumentation/snippet-v1-schema.json +++ b/Help/manual/instrumentation/snippet-v1-schema.json @@ -400,8 +400,8 @@ "type": "object", "required": [ "maxRSS", - "userTimeUSec", - "systemTimeUSec" + "userTime", + "systemTime" ], "properties": { "maxRSS": { @@ -409,12 +409,12 @@ "description": "Maximum resident set size reported for wrapped child processes, in KiB.", "minimum": 0 }, - "userTimeUSec": { + "userTime": { "type": "integer", "description": "User CPU time reported for wrapped child processes, in microseconds.", "minimum": 0 }, - "systemTimeUSec": { + "systemTime": { "type": "integer", "description": "System CPU time reported for wrapped child processes, in microseconds.", "minimum": 0 diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 57aacc1f8e..551a149722 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -403,10 +403,10 @@ void cmCTestLaunch::WriteMetricsFile() const Json::Value processMetrics(Json::objectValue); processMetrics["maxRSS"] = static_cast(this->ChildResourceUsage->ru_maxrss); - processMetrics["userTimeUSec"] = static_cast( + processMetrics["userTime"] = static_cast( this->ChildResourceUsage->ru_utime.tv_sec * 1000000ULL + this->ChildResourceUsage->ru_utime.tv_usec); - processMetrics["systemTimeUSec"] = static_cast( + processMetrics["systemTime"] = static_cast( this->ChildResourceUsage->ru_stime.tv_sec * 1000000ULL + this->ChildResourceUsage->ru_stime.tv_usec); root["processMetrics"] = std::move(processMetrics); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index e8a1fdf2a4..43ccbdaa76 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -1175,8 +1175,8 @@ void cmCTestRunTest::FinalizeTest(bool started) ProcessMetrics usage{}; Json::Value const& processMetrics = root["processMetrics"]; usage.ru_maxrss = processMetrics["maxRSS"].asLargestUInt(); - auto userUSec = processMetrics["userTimeUSec"].asLargestUInt(); - auto systemUSec = processMetrics["systemTimeUSec"].asLargestUInt(); + auto userUSec = processMetrics["userTime"].asLargestUInt(); + auto systemUSec = processMetrics["systemTime"].asLargestUInt(); usage.ru_utime.tv_sec = static_cast(userUSec / 1000000ULL); usage.ru_utime.tv_usec = static_cast(userUSec % 1000000ULL); usage.ru_stime.tv_sec = static_cast(systemUSec / 1000000ULL); diff --git a/Source/cmInstrumentation.cxx b/Source/cmInstrumentation.cxx index a57cf970df..28b6c00b70 100644 --- a/Source/cmInstrumentation.cxx +++ b/Source/cmInstrumentation.cxx @@ -1272,9 +1272,9 @@ Json::Value cmInstrumentation::ResourceUsageToJSON(ProcessMetrics const& usage) { Json::Value root(Json::objectValue); root["maxRSS"] = static_cast(usage.ru_maxrss); - root["userTimeUSec"] = static_cast( + root["userTime"] = static_cast( usage.ru_utime.tv_sec * 1000000ULL + usage.ru_utime.tv_usec); - root["systemTimeUSec"] = static_cast( + root["systemTime"] = static_cast( usage.ru_stime.tv_sec * 1000000ULL + usage.ru_stime.tv_usec); return root; } diff --git a/Tests/RunCMake/Instrumentation/check-data-dir.cmake b/Tests/RunCMake/Instrumentation/check-data-dir.cmake index a8f9ea05c4..6f10bdc836 100644 --- a/Tests/RunCMake/Instrumentation/check-data-dir.cmake +++ b/Tests/RunCMake/Instrumentation/check-data-dir.cmake @@ -36,8 +36,8 @@ foreach(snippet IN LISTS snippets) json_has_key("${snippet}" "${contents}" processMetrics) string(JSON process_metrics GET "${contents}" processMetrics) json_has_key("${snippet}" "${process_metrics}" maxRSS) - json_has_key("${snippet}" "${process_metrics}" userTimeUSec) - json_has_key("${snippet}" "${process_metrics}" systemTimeUSec) + json_has_key("${snippet}" "${process_metrics}" userTime) + json_has_key("${snippet}" "${process_metrics}" systemTime) set(process_metrics_case "") if (filename MATCHES "^custom-") string(JSON outputs ERROR_VARIABLE noOutputs GET "${contents}" outputs) @@ -47,10 +47,10 @@ foreach(snippet IN LISTS snippets) set(process_metrics_case "cpu") endif() elseif (filename MATCHES "^test-") - string(JSON user_time_usec GET "${process_metrics}" userTimeUSec) + string(JSON user_time_usec GET "${process_metrics}" userTime) if (user_time_usec LESS 0) json_error("${snippet}" - "Expected process-metrics test userTimeUSec >= 0, got: ${user_time_usec}" + "Expected process-metrics test userTime >= 0, got: ${user_time_usec}" ) endif() string(JSON test_name GET "${contents}" testName) @@ -78,8 +78,8 @@ foreach(snippet IN LISTS snippets) ) endif() elseif (process_metrics_case STREQUAL "cpu") - string(JSON user_time_usec GET "${process_metrics}" userTimeUSec) - string(JSON system_time_usec GET "${process_metrics}" systemTimeUSec) + string(JSON user_time_usec GET "${process_metrics}" userTime) + string(JSON system_time_usec GET "${process_metrics}" systemTime) math(EXPR total_cpu_usec "${user_time_usec} + ${system_time_usec}") if (total_cpu_usec LESS 10000) json_error("${snippet}"