Merge topic 'instrumentation-snippet-names'
39f365ec3c
instrumentation: Unique snippet file names
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10491
This commit is contained in:
commit
deb44bdf73
@ -236,11 +236,11 @@ Example:
|
|||||||
}
|
}
|
||||||
|
|
||||||
In this example, after every ``cmake --build`` or ``cmake --install``
|
In this example, after every ``cmake --build`` or ``cmake --install``
|
||||||
invocation, an index file ``index-<hash>.json`` will be generated in
|
invocation, an index file ``index-<timestamp>.json`` will be generated in
|
||||||
``<build>/.cmake/instrumentation/v1/data`` containing a list of data snippet
|
``<build>/.cmake/instrumentation/v1/data`` containing a list of data snippet
|
||||||
files created since the previous indexing. The commands
|
files created since the previous indexing. The commands
|
||||||
``/usr/bin/python callback.py index-<hash>.json`` and
|
``/usr/bin/python callback.py index-<timestamp>.json`` and
|
||||||
``/usr/bin/cmake -P callback.cmake arg index-<hash>.json`` will be executed in
|
``/usr/bin/cmake -P callback.cmake arg index-<timestamp>.json`` will be executed in
|
||||||
that order. The index file will contain the ``staticSystemInformation`` data and
|
that order. The index file will contain the ``staticSystemInformation`` data and
|
||||||
each snippet file listed in the index will contain the
|
each snippet file listed in the index will contain the
|
||||||
``dynamicSystemInformation`` data. Once both callbacks have completed, the index
|
``dynamicSystemInformation`` data. Once both callbacks have completed, the index
|
||||||
@ -275,7 +275,7 @@ the command executed. Additionally, snippet files are created for the following:
|
|||||||
These files remain in the build tree until after `Indexing`_ occurs and any
|
These files remain in the build tree until after `Indexing`_ occurs and any
|
||||||
user-specified `Callbacks`_ are executed.
|
user-specified `Callbacks`_ are executed.
|
||||||
|
|
||||||
Snippet files have a filename with the syntax ``<role>-<timestamp>-<hash>.json``
|
Snippet files have a filename with the syntax ``<role>-<hash>-<timestamp>.json``
|
||||||
and contain the following data:
|
and contain the following data:
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
@ -285,6 +285,9 @@ and contain the following data:
|
|||||||
``command``
|
``command``
|
||||||
The full command executed. Excluded when ``role`` is ``build``.
|
The full command executed. Excluded when ``role`` is ``build``.
|
||||||
|
|
||||||
|
``workingDir``
|
||||||
|
The working directory in which the ``command`` was executed.
|
||||||
|
|
||||||
``result``
|
``result``
|
||||||
The exit-value of the command, an integer.
|
The exit-value of the command, an integer.
|
||||||
|
|
||||||
@ -450,14 +453,14 @@ Example:
|
|||||||
"buildDir": "<build>",
|
"buildDir": "<build>",
|
||||||
"dataDir": "<build>/.cmake/instrumentation/v1/data",
|
"dataDir": "<build>/.cmake/instrumentation/v1/data",
|
||||||
"snippets": [
|
"snippets": [
|
||||||
"configure-<timestamp>-<hash>.json",
|
"configure-<hash>-<timestamp>.json",
|
||||||
"generate-<timestamp>-<hash>.json",
|
"generate-<hash>-<timestamp>.json",
|
||||||
"compile-<timestamp>-<hash>.json",
|
"compile-<hash>-<timestamp>.json",
|
||||||
"compile-<timestamp>-<hash>.json",
|
"compile-<hash>-<timestamp>.json",
|
||||||
"link-<timestamp>-<hash>.json",
|
"link-<hash>-<timestamp>.json",
|
||||||
"install-<timestamp>-<hash>.json",
|
"install-<hash>-<timestamp>.json",
|
||||||
"ctest-<timestamp>-<hash>.json",
|
"ctest-<hash>-<timestamp>.json",
|
||||||
"test-<timestamp>-<hash>.json",
|
"test-<hash>-<timestamp>.json",
|
||||||
"test-<timestamp>-<hash>.json",
|
"test-<hash>-<timestamp>.json",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -409,6 +409,7 @@ std::string cmInstrumentation::InstrumentTest(
|
|||||||
root["testName"] = name;
|
root["testName"] = name;
|
||||||
root["result"] = static_cast<Json::Value::Int64>(result);
|
root["result"] = static_cast<Json::Value::Int64>(result);
|
||||||
root["config"] = config;
|
root["config"] = config;
|
||||||
|
root["workingDir"] = cmSystemTools::GetLogicalWorkingDirectory();
|
||||||
|
|
||||||
// Post-Command
|
// Post-Command
|
||||||
this->InsertTimingData(root, steadyStart, systemStart);
|
this->InsertTimingData(root, steadyStart, systemStart);
|
||||||
@ -417,9 +418,11 @@ std::string cmInstrumentation::InstrumentTest(
|
|||||||
this->InsertDynamicSystemInformation(root, "after");
|
this->InsertDynamicSystemInformation(root, "after");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string file_name =
|
cmsys::SystemInformation info;
|
||||||
cmStrCat("test-", this->ComputeSuffixHash(command_str),
|
std::string file_name = cmStrCat(
|
||||||
this->ComputeSuffixTime(), ".json");
|
"test-",
|
||||||
|
this->ComputeSuffixHash(cmStrCat(command_str, info.GetProcessId())),
|
||||||
|
this->ComputeSuffixTime(), ".json");
|
||||||
this->WriteInstrumentationJson(root, "data", file_name);
|
this->WriteInstrumentationJson(root, "data", file_name);
|
||||||
return file_name;
|
return file_name;
|
||||||
}
|
}
|
||||||
@ -534,11 +537,14 @@ int cmInstrumentation::InstrumentCommand(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
root["role"] = command_type;
|
root["role"] = command_type;
|
||||||
|
root["workingDir"] = cmSystemTools::GetLogicalWorkingDirectory();
|
||||||
|
|
||||||
// Write Json
|
// Write Json
|
||||||
std::string const& file_name =
|
cmsys::SystemInformation info;
|
||||||
cmStrCat(command_type, "-", this->ComputeSuffixHash(command_str),
|
std::string const& file_name = cmStrCat(
|
||||||
this->ComputeSuffixTime(), ".json");
|
command_type, "-",
|
||||||
|
this->ComputeSuffixHash(cmStrCat(command_str, info.GetProcessId())),
|
||||||
|
this->ComputeSuffixTime(), ".json");
|
||||||
this->WriteInstrumentationJson(root, "data", file_name);
|
this->WriteInstrumentationJson(root, "data", file_name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ function(snippet_has_fields snippet contents)
|
|||||||
get_filename_component(filename "${snippet}" NAME)
|
get_filename_component(filename "${snippet}" NAME)
|
||||||
has_key("${snippet}" "${contents}" role)
|
has_key("${snippet}" "${contents}" role)
|
||||||
has_key("${snippet}" "${contents}" result)
|
has_key("${snippet}" "${contents}" result)
|
||||||
|
has_key("${snippet}" "${contents}" workingDir)
|
||||||
if (NOT filename MATCHES "^build-*")
|
if (NOT filename MATCHES "^build-*")
|
||||||
has_key("${snippet}" "${contents}" command)
|
has_key("${snippet}" "${contents}" command)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user