Revert BaseTime reduction as GH runners can receive low CPU

This commit is contained in:
Ion Gaztañaga
2024-01-14 18:05:11 +01:00
parent efb6c36567
commit 747ab51363
3 changed files with 8 additions and 11 deletions

View File

@@ -24,16 +24,14 @@ namespace test{
inline void get_process_id_name(std::string &str)
{
std::stringstream sstr;
sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_rand_"
<< boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends;
sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << std::ends;
str = sstr.str().c_str();
}
inline void get_process_id_ptr_name(std::string &str, const void *ptr)
{
std::stringstream sstr;
sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_" << ptr << "_rand_"
<< boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends;
sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_" << ptr << std::ends;
str = sstr.str().c_str();
}
@@ -94,8 +92,7 @@ namespace test {
inline void get_process_id_wname(std::wstring &str)
{
std::wstringstream sstr;
sstr << L"process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_rand_"
<< boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends;
sstr << L"process_" << boost::interprocess::ipcdetail::get_current_process_id() << std::ends;
str = sstr.str().c_str();
}

View File

@@ -96,14 +96,14 @@ void test_plain_sharable_mutex()
boost::interprocess::ipcdetail::thread_launch(tw1, thread_adapter<SM>(plain_exclusive, &e1, mtx));
//Give time to e1 to grab the mutex
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs));
// Writer two launches, tries to grab the lock, "clearly"
// after Writer one will already be holding it.
boost::interprocess::ipcdetail::OS_thread_t tw2;
boost::interprocess::ipcdetail::thread_launch(tw2, thread_adapter<SM>(plain_exclusive, &e2, mtx));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs));
// Readers launche, "clearly" after writer two, and "clearly"
// while writer 1 still holds the lock
@@ -139,7 +139,7 @@ void test_plain_sharable_mutex()
boost::interprocess::ipcdetail::thread_launch(thr2, thread_adapter<SM>(plain_shared,&s2, mtx));
//Make sure they try to hold the sharable lock
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2u));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs));
// We launch two writers, that should block until the readers end
boost::interprocess::ipcdetail::OS_thread_t tw1;
@@ -177,7 +177,7 @@ void test_try_sharable_mutex()
boost::interprocess::ipcdetail::OS_thread_t tw1;
boost::interprocess::ipcdetail::thread_launch(tw1, thread_adapter<SM>(try_exclusive,&e1,mtx));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2u));
boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs));
// Reader one launches, "clearly" after writer #1 holds the lock
// and before it releases the lock.

View File

@@ -143,7 +143,7 @@ struct data
};
int shared_val = 0;
static const unsigned BaseMs = 300;
static const unsigned BaseMs = 1000;
} //namespace test {
} //namespace interprocess {