Files
rocm-systems/projects/rocprofiler-systems/source/bin/tests/sleeper.cpp
T
systems-assistant[bot] 6755fa3a36 Add 'projects/rocprofiler-systems/' from commit '92e1d84c72c9321d79a1866e0090fae0215e6557'
git-subtree-dir: projects/rocprofiler-systems
git-subtree-mainline: ee9e74df21
git-subtree-split: 92e1d84c72
2025-07-17 18:13:44 +00:00

29 wiersze
555 B
C++

#include <chrono>
#include <ratio>
#include <sstream>
#include <thread>
using clock_type = std::chrono::steady_clock;
int
main(int argc, char** argv)
{
double _val = 0.0;
if(argc > 0)
{
auto _ss = std::stringstream{};
_ss << argv[1];
_ss >> _val;
}
intmax_t _nsec = _val * std::nano::den;
auto _end = clock_type::now() + std::chrono::nanoseconds{ _nsec };
while(clock_type::now() < _end)
{
std::this_thread::sleep_for(std::chrono::nanoseconds{ _nsec / 10 });
}
return 0;
}