Sampling use SIGRTMIN + N signals (#104)

* Use SIGRTMIN instead of SIGALRM for sampling

* Config options + fully working SIGRTMIN sampling

- OMNITRACE_SAMPLING_KEEP_INTERNAL config option
- OMNITRACE_PROCESS_SAMPLING_FREQ config option
- OMNITRACE_SAMPLING_REALTIME config option
- OMNITRACE_SAMPLING_CPUTIME config option
- OMNITRACE_SAMPLING_REALTIME_OFFSET config option

* Fix omnitrace-avail-regex-negation test

- OMNITRACE_PROCESS_SAMPLING_FREQ was causing failure

[ROCm/rocprofiler-systems commit: d27f22ea37]
This commit is contained in:
Jonathan R. Madsen authored and GitHub committed 2022-07-22 14:17:27 -05:00
1 parent f2bcca54f6
commit df20526aac
10 files changed
+198 -45

No files matched your search

@@ -51,6 +51,43 @@
namespace omnitrace
{
int
get_realtime_signal()
{
return SIGRTMIN + config::get_sampling_rtoffset();
}
int
get_cputime_signal()
{
return SIGPROF;
}
std::set<int>
get_sampling_signals(int64_t _tid)
{
auto _sigreal = get_realtime_signal();
auto _sigprof = get_cputime_signal();
// on the main thread, typically use both real-time and cpu-time
// on secondary threads, typically use only cpu-time.
if(_tid < 1)
{
if(config::get_use_sampling_cputime()) return std::set<int>{ _sigreal, _sigprof };
return std::set<int>{ _sigreal };
}
if(config::get_use_sampling_realtime() && config::get_use_sampling_cputime())
return std::set<int>{ _sigreal, _sigprof };
else if(config::get_use_sampling_realtime())
return std::set<int>{ _sigreal };
else if(config::get_use_sampling_cputime())
return std::set<int>{ _sigprof };
return std::set<int>{};
}
std::atomic<uint64_t>&
get_cpu_cid()
{