Fix rocprofv3 output filename containing sub-directory (#1062)
* Fix -d option broken by hostname * Fix rocprofv3 output filename containing directory * Fix TID handling in Perfetto and OTF2 output * Revert changes which removed hostname * Revise tests/rocprofv3/tracing output filenames - specify an output filename for tests which include a subdirectory --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
37e0d7efce
Коммит
a4b3a57ecc
@@ -401,11 +401,17 @@ write_otf2(tool_table* tool
|
||||
tids.emplace(itr.thread_id);
|
||||
|
||||
for(auto itr : *memory_copy_data)
|
||||
{
|
||||
tids.emplace(itr.thread_id);
|
||||
agent_thread_ids[itr.thread_id].emplace(itr.dst_agent_id);
|
||||
}
|
||||
|
||||
for(auto itr : *kernel_dispatch_data)
|
||||
{
|
||||
tids.emplace(itr.thread_id);
|
||||
agent_queue_ids[itr.thread_id][itr.dispatch_info.agent_id].emplace(
|
||||
itr.dispatch_info.queue_id);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -157,10 +157,16 @@ write_perfetto(
|
||||
tids.emplace(itr.thread_id);
|
||||
|
||||
for(auto itr : *memory_copy_data)
|
||||
{
|
||||
tids.emplace(itr.thread_id);
|
||||
agent_thread_ids[itr.dst_agent_id].emplace(itr.thread_id);
|
||||
}
|
||||
|
||||
for(auto itr : *kernel_dispatch_data)
|
||||
{
|
||||
tids.emplace(itr.thread_id);
|
||||
agent_queue_ids[itr.dispatch_info.agent_id].emplace(itr.dispatch_info.queue_id);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t nthrn = 0;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "output_file.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
#include "lib/common/filesystem.hpp"
|
||||
#include "lib/common/logging.hpp"
|
||||
|
||||
#include <fmt/core.h>
|
||||
@@ -54,12 +56,31 @@ get_output_filename(std::string_view fname, std::string_view ext)
|
||||
auto output_prefix = tool::format(tool::get_config().output_file);
|
||||
|
||||
if(fs::exists(output_path) && !fs::is_directory(fs::status(output_path)))
|
||||
throw std::runtime_error{
|
||||
fmt::format("ROCPROFILER_OUTPUT_PATH ({}) already exists and is not a directory",
|
||||
output_path.string())};
|
||||
if(!fs::exists(output_path)) fs::create_directories(output_path);
|
||||
{
|
||||
ROCP_FATAL << fmt::format(
|
||||
"ROCPROFILER_OUTPUT_PATH ({}) already exists and is not a directory",
|
||||
output_path.string());
|
||||
}
|
||||
else if(!fs::exists(output_path))
|
||||
{
|
||||
fs::create_directories(output_path);
|
||||
}
|
||||
|
||||
return tool::format(output_path / fmt::format("{}_{}{}", output_prefix, fname, _ext));
|
||||
auto _ofname = tool::format(output_path / fmt::format("{}_{}{}", output_prefix, fname, _ext));
|
||||
|
||||
// the prefix may contain a subdirectory
|
||||
if(auto _ofname_path = fs::path{_ofname}.parent_path(); !fs::exists(_ofname_path))
|
||||
{
|
||||
fs::create_directories(_ofname_path);
|
||||
}
|
||||
else if(fs::exists(_ofname_path) && !fs::is_directory(fs::status(_ofname_path)))
|
||||
{
|
||||
ROCP_FATAL << fmt::format(
|
||||
"ROCPROFILER_OUTPUT_PATH ({}) already exists and is not a directory",
|
||||
output_path.string());
|
||||
}
|
||||
|
||||
return _ofname;
|
||||
}
|
||||
|
||||
output_stream_t
|
||||
|
||||
Ссылка в новой задаче
Block a user