Replace timers with a templated one

They all do the same thing, the only difference
is the method they call on oro::Api, so
template on that
This commit is contained in:
King_DuckZ 2020-08-10 19:19:06 +01:00
parent 4b3d88b2f0
commit 5bf036f056
10 changed files with 51 additions and 207 deletions

View file

@ -16,9 +16,7 @@
*/
#include "evloop.hpp"
#include "timer_items.hpp"
#include "timer_icons.hpp"
#include "timer_shops.hpp"
#include "timer_generic.hpp"
#include "eventia/eventia.hpp"
#include "roar11/ThreadPool.hpp"
#include "oro/api.hpp"
@ -46,6 +44,10 @@ void join(roar11::ThreadPool& pool) {
} //unnamed namespace
void test(oro::Api* api, oro::OriginsDB* db) {
typedef TimerGeneric<&oro::Api::market_list> TimerShops;
typedef TimerGeneric<&oro::Api::items_list> TimerItems;
typedef TimerGeneric<&oro::Api::items_icons> TimerIcons;
const std::size_t thread_count = 2U; //std::min(std::max(3U, std::thread::hardware_concurrency()) - 1, 4U);
std::cout << "Running with " << thread_count << " worker threads\n";
roar11::ThreadPool pool(thread_count);