Address and thread sanitizer fixes (#250)
* Address and thread sanitizer fixes
- Fix compilation with clang
- Tweak perfetto copy to build tree
- Added suppression files to scripts
- fix LD_PRELOAD support in omnitrace-causal and omnitrace-sample
- use spin_mutex and spin_lock from timemory instead of atomic_mutex and atomic_lock
- state uses atomic
- fix some memory leaks
- tweak testing
- mpi tests do not use preload
- increase timeout when using sanitizers
- add env LD_PRELOAD when using sanitizers
* Tweak perfetto build
* Update timemory submodule
* Update version to 1.8.1
* Update omnitrace-leak.supp
* Update timemory submodule
- fixed spin_mutex implementation
* Remove previously added addr_space->allowTraps(instr_traps)
- this appears to cause errors during binary rewrite
* causal testing updates
- relaxed causal validation on CI systems (to account for hyperthreading decreasing prediction)
- improved impact calculation
- other general improvements to validate-causal-json.py
* Improve fork handling for perfetto
- numerous updates changing perfetto:: to ::perfetto::
- added perfetto_fwd.hpp
* Updated fork example
- user API for validation that stopping/starting perfetto is valid
* Misc fixes to perfetto + fork support
- tweak regions in fork example
- handle disabling tmp files
- get rid of stop/start with perfetto before/after fork
- fixed sampling support during fork
- tweak env of fork test
* Fix find_package in build-tree
* Fix buildtree export
* Fix buildtree export
* Restructured ConfigInstall before adding examples
* Guard against creating tmp file in sampling when disabled
* Fix buildtree package
* formatting
* exit handlers on child processes
- quick exit to avoid perfetto cleanup
* Further tweaking of causal tests for reliability
- enable PROCESSOR_AFFINITY
- decrease to 5 iterations
* Further tweaking of causal tests for reliability
- disable PROCESSOR_AFFINITY for fast func e2e tests
- enabling affinity results in (valid) speedup predictions greater than zero
* Fixes to fork handling
- use pthread_atfork for redundancy if fork_gotcha fails
* cmake formatting
* Fix fork init settings + install components
- remove dl from PROJECT_BUILD_TARGETS
* Testing tweaks
- fix mpi-binary-rewrite-run regex when OMNITRACE_VERBOSE set > 1 in env
- increase causal e2e iterations to 8
* Fix "Test User API"
- test-find-package.sh included dl component
* Further tweaks to causal validation
- further considerations of variance
[ROCm/rocprofiler-systems commit: 846301bcaf]
This commit is contained in:
committed by
GitHub
parent
7d0fb66465
commit
49851b05ae
@@ -53,6 +53,7 @@
|
||||
#include <atomic>
|
||||
#include <csignal>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
@@ -280,7 +281,8 @@ configure_settings(bool _init)
|
||||
std::string, "OMNITRACE_MODE",
|
||||
"Data collection mode. Used to set default values for OMNITRACE_USE_* options. "
|
||||
"Typically set by omnitrace binary instrumenter.",
|
||||
std::string{ "trace" }, "backend", "advanced");
|
||||
std::string{ "trace" }, "backend", "advanced")
|
||||
->set_choices({ "trace", "sampling", "causal", "coverage" });
|
||||
|
||||
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_CI",
|
||||
"Enable some runtime validation checks (typically enabled "
|
||||
@@ -2164,7 +2166,7 @@ get_trace_hsa_api_types()
|
||||
}
|
||||
|
||||
std::string&
|
||||
get_backend()
|
||||
get_perfetto_backend()
|
||||
{
|
||||
// select inprocess, system, or both (i.e. all)
|
||||
static auto _v = get_config()->find("OMNITRACE_PERFETTO_BACKEND");
|
||||
@@ -2435,7 +2437,7 @@ tmp_file::~tmp_file()
|
||||
remove();
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
tmp_file::open(std::ios::openmode _mode)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str());
|
||||
@@ -2448,23 +2450,67 @@ tmp_file::open(std::ios::openmode _mode)
|
||||
}
|
||||
|
||||
stream.open(filename, _mode);
|
||||
|
||||
return (stream.is_open() && stream.good());
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
tmp_file::fopen(const char* _mode)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str());
|
||||
|
||||
if(!filepath::exists(filename))
|
||||
{
|
||||
// if the filepath does not exist, open in out mode to create it
|
||||
std::ofstream _ofs{};
|
||||
filepath::open(_ofs, filename);
|
||||
}
|
||||
|
||||
file = filepath::fopen(filename, _mode);
|
||||
if(file) fd = ::fileno(file);
|
||||
|
||||
return (file != nullptr && fd > 0);
|
||||
}
|
||||
|
||||
bool
|
||||
tmp_file::close()
|
||||
{
|
||||
if(stream.is_open()) stream.close();
|
||||
if(stream.is_open())
|
||||
{
|
||||
stream.close();
|
||||
return !stream.is_open();
|
||||
}
|
||||
else if(file != nullptr)
|
||||
{
|
||||
auto _ret = fclose(file);
|
||||
if(_ret == 0)
|
||||
{
|
||||
file = nullptr;
|
||||
fd = -1;
|
||||
}
|
||||
return (_ret == 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
tmp_file::remove()
|
||||
{
|
||||
close();
|
||||
if(filepath::exists(filename))
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(2, "Removing temporary file '%s'...\n", filename.c_str());
|
||||
::remove(filename.c_str());
|
||||
auto _ret = ::remove(filename.c_str());
|
||||
return (_ret == 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
tmp_file::operator bool() const
|
||||
{
|
||||
return (stream.is_open() && stream.good()) || (file != nullptr && fd > 0);
|
||||
}
|
||||
|
||||
std::shared_ptr<tmp_file>
|
||||
@@ -2508,7 +2554,6 @@ get_tmp_file(std::string _basename, std::string _ext)
|
||||
if(itr != _existing_files.end()) return itr->second;
|
||||
|
||||
auto _v = std::make_shared<tmp_file>(_fname);
|
||||
_v->open();
|
||||
_existing_files.emplace(_fname, std::move(_v));
|
||||
return _existing_files.at(_fname);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user