omnitrace -> omnitrace-instrument (#256)
* omnitrace-exe -> omnitrace-instrument
- Renamed omnitrace executable to omnitrace-instrument
- Provided dummy omnitrace exe which forwards onto omnitrace-instrument
- updated all docs to reflect the name change of the executable
- however, it is possible some were missed
* Update dyninst submodule
- correctly handle BOOST_LINK_STATIC in DyninstBoost.cmake
* Disable IPO for omnitrace-instrument
[ROCm/rocprofiler-systems commit: ab0e5d9b44]
This commit is contained in:
gecommit door
GitHub
bovenliggende
81b67dcb88
commit
61a050fd1d
@@ -18,7 +18,9 @@ add_subdirectory(omnitrace-avail)
|
||||
add_subdirectory(omnitrace-critical-trace)
|
||||
add_subdirectory(omnitrace-causal)
|
||||
add_subdirectory(omnitrace-sample)
|
||||
add_subdirectory(omnitrace)
|
||||
add_subdirectory(omnitrace-instrument)
|
||||
# omnitrace-exe is deprecated
|
||||
add_subdirectory(omnitrace-exe)
|
||||
|
||||
if(OMNITRACE_BUILD_TESTING OR "$ENV{OMNITRACE_CI}" MATCHES "[1-9]+|ON|on|y|yes")
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-exe target (deprecated 'omnitrace' executable, now 'omnitrace-instrument')
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(omnitrace-exe ${CMAKE_CURRENT_LIST_DIR}/omnitrace.cpp)
|
||||
|
||||
target_link_libraries(omnitrace-exe PRIVATE omnitrace::omnitrace-threading)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-exe
|
||||
PROPERTIES OUTPUT_NAME omnitrace
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
omnitrace_strip_target(omnitrace-exe)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-exe
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
@@ -0,0 +1,161 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <future>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <pthread.h>
|
||||
#include <regex>
|
||||
#include <signal.h>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
static const char* _warning = R"warning(
|
||||
|
||||
WWWWWWWW WWWWWWWW iiii !!!
|
||||
W::::::W W::::::W i::::i !!:!!
|
||||
W::::::W W::::::W iiii !:::!
|
||||
W::::::W W::::::W !:::!
|
||||
W:::::W WWWWW W:::::Waaaaaaaaaaaaa rrrrr rrrrrrrrr nnnn nnnnnnnn iiiiiiinnnn nnnnnnnn ggggggggg ggggg!:::!
|
||||
W:::::W W:::::W W:::::W a::::::::::::a r::::rrr:::::::::r n:::nn::::::::nn i:::::in:::nn::::::::nn g:::::::::ggg::::g!:::!
|
||||
W:::::W W:::::::W W:::::W aaaaaaaaa:::::ar:::::::::::::::::r n::::::::::::::nn i::::in::::::::::::::nn g:::::::::::::::::g!:::!
|
||||
W:::::W W:::::::::W W:::::W a::::arr::::::rrrrr::::::rnn:::::::::::::::n i::::inn:::::::::::::::ng::::::ggggg::::::gg!:::!
|
||||
W:::::W W:::::W:::::W W:::::W aaaaaaa:::::a r:::::r r:::::r n:::::nnnn:::::n i::::i n:::::nnnn:::::ng:::::g g:::::g !:::!
|
||||
W:::::W W:::::W W:::::W W:::::W aa::::::::::::a r:::::r rrrrrrr n::::n n::::n i::::i n::::n n::::ng:::::g g:::::g !:::!
|
||||
W:::::W:::::W W:::::W:::::W a::::aaaa::::::a r:::::r n::::n n::::n i::::i n::::n n::::ng:::::g g:::::g !!:!!
|
||||
W:::::::::W W:::::::::W a::::a a:::::a r:::::r n::::n n::::n i::::i n::::n n::::ng::::::g g:::::g !!!
|
||||
W:::::::W W:::::::W a::::a a:::::a r:::::r n::::n n::::ni::::::i n::::n n::::ng:::::::ggggg:::::g
|
||||
W:::::W W:::::W a:::::aaaa::::::a r:::::r n::::n n::::ni::::::i n::::n n::::n g::::::::::::::::g !!!
|
||||
W:::W W:::W a::::::::::aa:::ar:::::r n::::n n::::ni::::::i n::::n n::::n gg::::::::::::::g !!:!!
|
||||
WWW WWW aaaaaaaaaa aaaarrrrrrr nnnnnn nnnnnniiiiiiii nnnnnn nnnnnn gggggggg::::::g !!!
|
||||
g:::::g
|
||||
gggggg g:::::g
|
||||
g:::::gg gg:::::g
|
||||
g::::::ggg:::::::g
|
||||
gg:::::::::::::g
|
||||
ggg::::::ggg
|
||||
gggggg
|
||||
|
||||
|
||||
OmniTrace has renamed the "omnitrace" executable to "omnitrace-instrument" to reduce confusion.
|
||||
|
||||
This executable only exists to provide this deprecation warning and maintain backwards compatibility for a few releases.
|
||||
This executable will soon invoke "omnitrace-instrument" with the arguments you just provided after we've given you
|
||||
a chance to read this message.
|
||||
|
||||
If you are running this job interactively, please acknowledge that you've read this message and whether you want to continue.
|
||||
If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or OMNITRACE_CI is defined
|
||||
in the environment, in which case, we will throw an error.
|
||||
|
||||
Thanks for using OmniTrace and happy optimizing!
|
||||
)warning";
|
||||
|
||||
auto _completed = std::promise<void>{};
|
||||
bool _acknowledged = false;
|
||||
auto _emit_warning = []() {
|
||||
// emit warning
|
||||
std::cerr << _warning << std::endl;
|
||||
};
|
||||
auto _get_env = [](const char* _var) {
|
||||
auto* _val = getenv(_var);
|
||||
if(_val == nullptr) return false;
|
||||
return !std::regex_match(
|
||||
_val, std::regex{ "0|false|off|no", std::regex_constants::icase });
|
||||
};
|
||||
auto _env_failure = [_emit_warning, argv](std::string_view _env_var) {
|
||||
// emit warning
|
||||
_emit_warning();
|
||||
std::cerr << "[" << argv[0] << "] Detected " << _env_var
|
||||
<< " environment variable. Exiting to prevent consuming CI resources. "
|
||||
"Use \"omnitrace-instrument\" executable instead of \"omnitrace\" "
|
||||
"to prevent this error."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
};
|
||||
auto _wait_for_input = [&_completed, &_acknowledged, _emit_warning]() {
|
||||
// emit warning and wait for input
|
||||
_emit_warning();
|
||||
|
||||
std::cerr << "Do you want to continue? [Y/n] " << std::flush;
|
||||
auto _input = char{};
|
||||
std::cin.get(_input);
|
||||
|
||||
_input = tolower(_input);
|
||||
if(_input == 'n') std::exit(EXIT_SUCCESS);
|
||||
|
||||
_acknowledged = true;
|
||||
_completed.set_value();
|
||||
};
|
||||
|
||||
for(const auto* itr : { "CI", "OMNITRACE_CI" })
|
||||
{
|
||||
if(_get_env(itr)) _env_failure(itr);
|
||||
}
|
||||
|
||||
{
|
||||
auto _thr = std::thread{ _wait_for_input };
|
||||
|
||||
_completed.get_future().wait_for(std::chrono::seconds{ 60 });
|
||||
|
||||
if(!_acknowledged)
|
||||
{
|
||||
std::cerr << "[" << argv[0]
|
||||
<< "] No acknowledgement after 1 minute. Continuing..."
|
||||
<< std::endl;
|
||||
_thr.detach();
|
||||
}
|
||||
else
|
||||
_thr.join();
|
||||
}
|
||||
|
||||
// generate the new command
|
||||
auto _argv = std::vector<char*>{};
|
||||
_argv.emplace_back(
|
||||
strdup(std::string{ std::string{ argv[0] } + "-instrument" }.c_str()));
|
||||
for(int i = 1; i < argc; ++i)
|
||||
_argv.emplace_back(argv[i]);
|
||||
|
||||
// echo the new command for diagnostic purposes
|
||||
auto _cmdss = std::stringstream{};
|
||||
for(const auto& itr : _argv)
|
||||
if(itr) _cmdss << " " << itr;
|
||||
|
||||
auto _cmd = _cmdss.str();
|
||||
if(!_cmd.empty())
|
||||
std::cerr << "[" << argv[0] << "] Executing: \"" << _cmd.substr(1) << "\"...\n"
|
||||
<< std::endl;
|
||||
|
||||
// make sure command ends with nullptr
|
||||
_argv.emplace_back(nullptr);
|
||||
|
||||
return execvp(_argv.front(), _argv.data());
|
||||
}
|
||||
+12
-13
@@ -1,15 +1,15 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-exe target
|
||||
# omnitrace-instrument target (formerly omnitrace-exe target prior to 1.8.1)
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
|
||||
add_executable(omnitrace-exe)
|
||||
add_executable(omnitrace-instrument)
|
||||
|
||||
target_sources(
|
||||
omnitrace-exe
|
||||
omnitrace-instrument
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
|
||||
@@ -21,11 +21,11 @@ target_sources(
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-instrument.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-instrument.hpp)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-exe
|
||||
omnitrace-instrument
|
||||
PRIVATE omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-dyninst
|
||||
omnitrace::omnitrace-compile-options
|
||||
@@ -36,24 +36,23 @@ target_link_libraries(
|
||||
timemory::timemory-core)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-exe
|
||||
PROPERTIES OUTPUT_NAME omnitrace
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
omnitrace-instrument
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
if(OMNITRACE_BUILD_DYNINST)
|
||||
target_compile_definitions(omnitrace-exe PRIVATE OMNITRACE_BUILD_DYNINST=1)
|
||||
target_compile_definitions(omnitrace-instrument PRIVATE OMNITRACE_BUILD_DYNINST=1)
|
||||
endif()
|
||||
|
||||
omnitrace_strip_target(omnitrace-exe)
|
||||
omnitrace_strip_target(omnitrace-instrument)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(DEBUG|Debug)")
|
||||
string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
target_compile_options(omnitrace-exe PRIVATE ${_FLAGS})
|
||||
target_compile_options(omnitrace-instrument PRIVATE ${_FLAGS})
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-exe
|
||||
TARGETS omnitrace-instrument
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include "function_signature.hpp"
|
||||
#include "fwd.hpp"
|
||||
#include "log.hpp"
|
||||
#include "omnitrace.hpp"
|
||||
#include "omnitrace-instrument.hpp"
|
||||
|
||||
#include <timemory/components/rusage/components.hpp>
|
||||
#include <timemory/components/timing/wall_clock.hpp>
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#include "fwd.hpp"
|
||||
#include "internal_libs.hpp"
|
||||
#include "log.hpp"
|
||||
#include "omnitrace.hpp"
|
||||
#include "omnitrace-instrument.hpp"
|
||||
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace.hpp"
|
||||
#include "omnitrace-instrument.hpp"
|
||||
#include "common/defines.h"
|
||||
#include "fwd.hpp"
|
||||
#include "internal_libs.hpp"
|
||||
@@ -453,7 +453,7 @@ main(int argc, char** argv)
|
||||
// it is unrecognized, then set the errflag to report an error. When we come to a
|
||||
// non '-' charcter, then we must be at the application name.
|
||||
using parser_t = tim::argparse::argument_parser;
|
||||
parser_t parser("omnitrace");
|
||||
parser_t parser("omnitrace-instrument");
|
||||
string_t extra_help = "-- <CMD> <ARGS>";
|
||||
|
||||
parser.enable_help();
|
||||
@@ -147,13 +147,13 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
endfunction()
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-help
|
||||
TARGET omnitrace-exe
|
||||
NAME omnitrace-instrument-help
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --help
|
||||
LABELS omnitrace-exe
|
||||
LABELS omnitrace-instrument
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
".*\\\[omnitrace\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
|
||||
".*\\\[omnitrace-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
|
||||
)
|
||||
|
||||
# on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls`
|
||||
@@ -166,8 +166,8 @@ else()
|
||||
endif()
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-simulate-ls
|
||||
TARGET omnitrace-exe
|
||||
NAME omnitrace-instrument-simulate-ls
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --simulate
|
||||
--print-format
|
||||
json
|
||||
@@ -183,9 +183,9 @@ omnitrace_add_bin_test(
|
||||
TIMEOUT 240)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-simulate-ls-check
|
||||
DEPENDS omnitrace-exe-simulate-ls
|
||||
COMMAND ls omnitrace-tests-output/omnitrace-exe-simulate-ls/instrumentation
|
||||
NAME omnitrace-instrument-simulate-ls-check
|
||||
DEPENDS omnitrace-instrument-simulate-ls
|
||||
COMMAND ls omnitrace-tests-output/omnitrace-instrument-simulate-ls/instrumentation
|
||||
TIMEOUT 60
|
||||
PASS_REGEX
|
||||
".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*"
|
||||
@@ -193,8 +193,8 @@ omnitrace_add_bin_test(
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
ADD_INVERSE
|
||||
NAME omnitrace-exe-simulate-lib
|
||||
TARGET omnitrace-exe
|
||||
NAME omnitrace-instrument-simulate-lib
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --print-available functions -v 2 -- $<TARGET_FILE:omnitrace-user-library>
|
||||
LABELS "simulate"
|
||||
TIMEOUT 120
|
||||
@@ -205,14 +205,14 @@ omnitrace_add_bin_test(
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-simulate-lib-basename
|
||||
TARGET omnitrace-exe
|
||||
NAME omnitrace-instrument-simulate-lib-basename
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --print-available
|
||||
functions
|
||||
-v
|
||||
2
|
||||
-o
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-exe-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:omnitrace-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:omnitrace-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
--
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:omnitrace-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
LABELS "simulate"
|
||||
@@ -220,8 +220,8 @@ omnitrace_add_bin_test(
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-write-log
|
||||
TARGET omnitrace-exe
|
||||
NAME omnitrace-instrument-write-log
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --print-instrumented
|
||||
functions
|
||||
-v
|
||||
@@ -236,9 +236,10 @@ omnitrace_add_bin_test(
|
||||
PASS_REGEX "Opening .*/instrumentation/user.log")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-exe-write-log-check
|
||||
DEPENDS omnitrace-exe-write-log
|
||||
COMMAND ls omnitrace-tests-output/omnitrace-exe-write-log/instrumentation/user.log
|
||||
NAME omnitrace-instrument-write-log-check
|
||||
DEPENDS omnitrace-instrument-write-log
|
||||
COMMAND ls
|
||||
omnitrace-tests-output/omnitrace-instrument-write-log/instrumentation/user.log
|
||||
LABELS "log"
|
||||
TIMEOUT 60
|
||||
PASS_REGEX "user.log"
|
||||
|
||||
Verwijs in nieuw issue
Block a user