Fix thread index values (#287)

* Update PTL

- PTL submodule waits for threads to start before proceeding

* Initialize perfetto after init_bundle

- perfetto thread creation after pthread_create wrapped

* backtrace component update

- exclude gotcha call-tree

* callchain component update

- callchain::get sorts based on timestamp
- callchain::sample supports duplicate IPs (recursion)

* Bump version to 1.10.1

[ROCm/rocprofiler-systems commit: de9f0e4c10]
This commit is contained in:
Jonathan R. Madsen
2023-06-15 22:37:33 -05:00
committato da GitHub
parent 973f5bc348
commit 97011ea642
6 ha cambiato i file con 24 aggiunte e 13 eliminazioni
+1 -1
Vedi File
@@ -1 +1 @@
1.10.0
1.10.1
Submodule projects/rocprofiler-systems/external/PTL updated: 37d896f255...f0205c1935
@@ -492,13 +492,6 @@ omnitrace_init_tooling_hidden()
OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false);
// perfetto initialization
if(get_use_perfetto())
{
OMNITRACE_VERBOSE_F(1, "Setting up Perfetto...\n");
omnitrace::perfetto::setup();
}
// ideally these have already been started
omnitrace_preinit_hidden();
@@ -507,6 +500,13 @@ omnitrace_init_tooling_hidden()
if(get_use_sampling()) sampling::block_signals();
// perfetto initialization
if(get_use_perfetto())
{
OMNITRACE_VERBOSE_F(1, "Setting up Perfetto...\n");
omnitrace::perfetto::setup();
}
tasking::setup();
if(get_use_causal()) causal::start_experimenting();
@@ -120,7 +120,6 @@ backtrace::filter_and_patch(const std::vector<entry_type>& _data)
const auto _npos = std::string::npos;
if(_keep_internal) return 1;
if(_lbl.find("omnitrace_main") != _npos) return 0;
if(_lbl.find("omnitrace::common::") != _npos) return 0;
if(_lbl.find("omnitrace::") != _npos) return 0;
if(_lbl.find("tim::") != _npos) return 0;
if(_lbl.find("DYNINST_") != _npos) return 0;
@@ -129,6 +128,7 @@ backtrace::filter_and_patch(const std::vector<entry_type>& _data)
if(_lbl.find("roctracer_") != _npos) return -1;
if(_lbl.find("perfetto::") != _npos) return -1;
if(_lbl.find("protozero::") == 0) return -1;
if(_lbl.find("gotcha_") != _npos) return -1;
return 1;
};
@@ -120,6 +120,9 @@ callchain::get() const
itr.second.pop_back();
}
std::sort(_v.begin(), _v.end(),
[](const auto& _lhs, const auto& _rhs) { return _lhs.first < _rhs.first; });
return _v;
}
@@ -193,9 +196,15 @@ callchain::sample(int signo)
auto _data = record{};
_data.timestamp = itr.get_time();
_data.data.emplace_back(_ip);
bool _skip_ip = true;
for(auto ditr : itr.get_callchain())
{
if(ditr != _ip) _data.data.emplace_back(ditr);
// skip the first instance of current IP but allow after that since this
// might be a recursive call
if(ditr == _ip && _skip_ip)
_skip_ip = false;
else
_data.data.emplace_back(ditr);
if(_data.data.size() == _data.data.capacity()) break;
}
if(!_data.data.empty()) m_data.emplace_back(_data);
@@ -96,8 +96,9 @@ get_thread_pool_state()
PTL::ThreadPool&
get_thread_pool()
{
static auto* _v = (get_thread_pool_state() = State::Active,
new PTL::ThreadPool{ _thread_pool_cfg() });
static auto _cfg = _thread_pool_cfg();
static auto* _v =
(get_thread_pool_state() = State::Active, new PTL::ThreadPool{ _cfg });
return *_v;
}
} // namespace
@@ -145,6 +146,7 @@ void
setup()
{
OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal);
OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false);
(void) get_thread_pool();
}