Skip to content

Commit

Permalink
'tasker' library in a module is used instead of 'mt' and 'scheduler'
Browse files Browse the repository at this point in the history
  • Loading branch information
tyoma committed Sep 13, 2024
1 parent 1fb1b5e commit afb4c7d
Show file tree
Hide file tree
Showing 120 changed files with 181 additions and 5,632 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
strategy:
matrix:
config:
- os: ubuntu-20.04
- os: windows-latest
- os: macos-latest
- os: ubuntu-22.04
# - os: windows-2019
# - os: macos-12

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
path = libraries/utfia
url = ../utfia.git
branch = origin/master
[submodule "libraries/tasker"]
path = libraries/tasker
url = ../tasker.git
branch = master
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ include_directories($<$<PLATFORM_ID:Windows>:${CMAKE_CURRENT_LIST_DIR}/compat/wi
set(AGGE_NO_TESTS ON)
set(POLYQ_NO_TESTS ON)
set(STRMD_NO_TESTS ON)
set(TASKER_NO_TESTS ON)
set(UTEE_NO_TESTS ON)
set(UTFIA_NO_TESTS ON)
set(WPL_NO_TESTS ON)
Expand Down Expand Up @@ -127,6 +128,7 @@ add_subdirectory(libraries/utee)

add_subdirectory(libraries/polyq)
add_subdirectory(libraries/strmd)
add_subdirectory(libraries/tasker)
add_subdirectory(libraries/utfia)

add_subdirectory(libraries/agge)
Expand All @@ -139,11 +141,9 @@ add_subdirectory(frontend/src)
add_subdirectory(ipc/src)
add_subdirectory(logger/src)
add_subdirectory(math/src)
add_subdirectory(mt/src)
add_subdirectory(patcher/src)
add_subdirectory(playground)
add_subdirectory(sandbox/src)
add_subdirectory(scheduler/src)
add_subdirectory(sqlite++/src)

if (NOT MP_NO_TESTS)
Expand All @@ -155,11 +155,9 @@ if (NOT MP_NO_TESTS)
add_subdirectory(math/tests)
add_subdirectory(micro-profiler.tests/guineapigs)
add_subdirectory(micro-profiler.tests)
add_subdirectory(mt/tests)
add_subdirectory(patcher/benchmark)
add_subdirectory(patcher/tests)
add_subdirectory(reqm/tests)
add_subdirectory(scheduler/tests)
add_subdirectory(sdb/tests)
add_subdirectory(sqlite++/tests)
add_subdirectory(test-helpers/src)
Expand All @@ -186,7 +184,7 @@ endif()

if (NOT MP_NO_TESTS)
# Declare tests/benchmarks
set(MP_TEST_SUITES frontend ipc logger math micro-profiler mt patcher reqm savant_db scheduler sqlite++ views)
set(MP_TEST_SUITES frontend ipc logger math micro-profiler patcher reqm savant_db sqlite++ views)
if (NOT APPLE)
set(MP_TEST_SUITES ${MP_TEST_SUITES} collector common)
endif()
Expand Down
8 changes: 4 additions & 4 deletions collector/active_server_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <memory>
#include <mt/chrono.h>
#include <mt/thread.h>
#include <scheduler/scheduler.h>
#include <scheduler/task_queue.h>
#include <tasker/scheduler.h>
#include <tasker/task_queue.h>

namespace micro_profiler
{
Expand All @@ -38,7 +38,7 @@ namespace micro_profiler
typedef std::shared_ptr<channel> channel_ptr_t;
}

class active_server_app : public scheduler::queue, noncopyable
class active_server_app : public tasker::queue, noncopyable
{
public:
struct events;
Expand All @@ -60,7 +60,7 @@ namespace micro_profiler
events &_events;
ipc::server_session *_session;
bool _exit_requested, _exit_confirmed;
scheduler::task_queue _queue;
tasker::task_queue _queue;
std::unique_ptr<ipc::marshalled_active_session> _active_session;
mt::thread _thread;
};
Expand Down
2 changes: 1 addition & 1 deletion collector/collector_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace micro_profiler

void connect(const active_server_app::client_factory_t &factory, bool injected);

scheduler::queue &get_queue();
tasker::queue &get_queue();

private:
virtual void initialize_session(ipc::server_session &session) override;
Expand Down
4 changes: 2 additions & 2 deletions collector/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ add_custom_target(dbghelp_redist

add_library(collector STATIC ${COLLECTOR_LIB_SOURCES})
target_compile_definitions(collector PUBLIC SDB_NO_SIGNALS)
target_link_libraries(collector polyq strmd)
target_link_libraries(collector polyq strmd mt tasker)

add_library(${micro-profiler} SHARED ${COLLECTOR_SOURCES} $<TARGET_OBJECTS:mt.thread_callbacks>)
add_dependencies(${micro-profiler} dbghelp_redist)

target_link_libraries(${micro-profiler} collector patcher ipc common logger scheduler $<$<PLATFORM_ID:Windows>:injector>)
target_link_libraries(${micro-profiler} collector patcher ipc common logger $<$<PLATFORM_ID:Windows>:injector>)
target_link_options(${micro-profiler} PRIVATE "-DEF:${CMAKE_CURRENT_SOURCE_DIR}/collector.def;-IMPLIB:${MP_OUTDIR}/${micro-profiler}.lib")

set_source_files_properties(${CALIBRATION_SOURCES} PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion collector/src/active_server_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <ipc/marshalled_session.h>
#include <ipc/server_session.h>
#include <logger/log.h>
#include <scheduler/scheduler.h>
#include <tasker/scheduler.h>

#define PREAMBLE "Active server: "

Expand Down
2 changes: 1 addition & 1 deletion collector/src/collector_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace micro_profiler
_server.connect(factory);
}

scheduler::queue &collector_app::get_queue()
tasker::queue &collector_app::get_queue()
{ return _server; }

void collector_app::initialize_session(ipc::server_session &session)
Expand Down
2 changes: 1 addition & 1 deletion collector/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ set(COLLECTOR_TESTS_SOURCES
)

add_library(collector.tests SHARED ${COLLECTOR_TESTS_SOURCES} $<TARGET_OBJECTS:mt.thread_callbacks>)
target_link_libraries(collector.tests collector common ipc patcher scheduler mt logger test-helpers)
target_link_libraries(collector.tests collector common ipc patcher logger test-helpers)
10 changes: 3 additions & 7 deletions common/nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@

namespace micro_profiler
{
template <typename T>
struct generate_value
{
static T value();
};

template <typename F, typename T>
struct invoke_result_1
{
typedef decltype(generate_value<F>::value()(generate_value<T>::value())) type;
static T value_t();
static F value_f();
typedef decltype(value_f()(value_t())) type;
};

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion common/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ elseif (APPLE)
endif()

add_library(common STATIC ${COMMON_SOURCES})
target_link_libraries(common PUBLIC strmd PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:dl> PRIVATE mt PRIVATE utfia)
target_link_libraries(common PUBLIC strmd PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:dl> mt PRIVATE utfia)
2 changes: 1 addition & 1 deletion common/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ if (NOT APPLE)
endif()

add_library(common.tests SHARED ${COMMON_TEST_SOURCES})
target_link_libraries(common.tests common mt test-helpers)
target_link_libraries(common.tests common test-helpers)
7 changes: 3 additions & 4 deletions explorer/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

#pragma once

#include <mt/chrono.h>
#include <common/types.h>
#include <cstdint>
#include <scheduler/private_queue.h>
#include <tasker/private_queue.h>
#include <sdb/table.h>

namespace micro_profiler
Expand Down Expand Up @@ -61,14 +60,14 @@ namespace micro_profiler
class process_explorer : public tables::processes
{
public:
process_explorer(mt::milliseconds update_interval, scheduler::queue &apartment_queue,
process_explorer(mt::milliseconds update_interval, tasker::queue &apartment_queue,
const std::function<mt::milliseconds ()> &clock);

private:
void update();

private:
scheduler::private_queue _apartment;
tasker::private_queue _apartment;
const std::function<mt::milliseconds ()> _clock;
const mt::milliseconds _update_interval;
mt::milliseconds _last_update;
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set(EXPLORER_SOURCES
)

add_library(explorer STATIC ${EXPLORER_SOURCES})
target_link_libraries(explorer wpl)
target_link_libraries(explorer wpl tasker)
2 changes: 1 addition & 1 deletion explorer/src/process_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace micro_profiler
}


process_explorer::process_explorer(mt::milliseconds update_interval, scheduler::queue &apartment_queue,
process_explorer::process_explorer(mt::milliseconds update_interval, tasker::queue &apartment_queue,
const function<mt::milliseconds ()> &clock)
: _apartment(apartment_queue), _clock(clock), _update_interval(update_interval), _cycle(0)
{ update(); }
Expand Down
2 changes: 1 addition & 1 deletion explorer/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ add_custom_command(OUTPUT copy-guineas.x
)

add_library(explorer.tests SHARED ${EXPLORER_TEST_SOURCES} copy-guineas.x)
target_link_libraries(explorer.tests explorer ipc scheduler logger mt test-helpers)
target_link_libraries(explorer.tests explorer ipc logger test-helpers)
add_dependencies(explorer.tests guinea_runner)
16 changes: 8 additions & 8 deletions frontend/async_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,36 @@
#pragma once

#include <common/file_stream.h>
#include <scheduler/private_queue.h>
#include <tasker/private_queue.h>

namespace micro_profiler
{
template <typename OperationCB, typename ReadyCB>
struct async_file_request
{
async_file_request(const std::string &path, const OperationCB &operation_, const ReadyCB &ready_,
scheduler::queue &worker, scheduler::queue &apartment);
tasker::queue &worker, tasker::queue &apartment);

const std::string path;
const OperationCB operation;
const ReadyCB ready;
scheduler::private_worker_queue queue;
tasker::private_worker_queue queue;
};



template <typename O, typename R>
inline async_file_request<O, R>::async_file_request(const std::string &path_, const O &operation_, const R &ready_,
scheduler::queue &worker, scheduler::queue &apartment)
tasker::queue &worker, tasker::queue &apartment)
: path(path_), operation(operation_), ready(ready_), queue(worker, apartment)
{ }


template <typename T, typename ReaderCB, typename ReadyCB>
inline void async_file_read(std::shared_ptr<void> &request, scheduler::queue &worker, scheduler::queue &apartment,
inline void async_file_read(std::shared_ptr<void> &request, tasker::queue &worker, tasker::queue &apartment,
const std::string &path, const ReaderCB &reader, const ReadyCB &ready)
{
using namespace scheduler;
using namespace tasker;

auto req = std::make_shared< async_file_request<ReaderCB, ReadyCB> >(path, reader, ready, worker, apartment);
auto &rreq = *req;
Expand All @@ -75,10 +75,10 @@ namespace micro_profiler
}

template <typename WriterCB, typename ReadyCB>
inline void async_file_write(std::shared_ptr<void> &request, scheduler::queue &worker, scheduler::queue &apartment,
inline void async_file_write(std::shared_ptr<void> &request, tasker::queue &worker, tasker::queue &apartment,
const std::string &path, const WriterCB &writer, const ReadyCB &ready)
{
using namespace scheduler;
using namespace tasker;

auto req = std::make_shared< async_file_request<WriterCB, ReadyCB> >(path, writer, ready, worker, apartment);
auto &rreq = *req;
Expand Down
6 changes: 3 additions & 3 deletions frontend/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <list>
#include <reqm/multiplexing_request.h>

namespace scheduler
namespace tasker
{
struct queue;
}
Expand All @@ -46,7 +46,7 @@ namespace micro_profiler

public:
frontend(ipc::channel &outbound, std::shared_ptr<profiling_cache> cache,
scheduler::queue &worker, scheduler::queue &apartment);
tasker::queue &worker, tasker::queue &apartment);
~frontend();

public:
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace micro_profiler
requests_t::iterator new_request_handle();

private:
scheduler::queue &_worker_queue, &_apartment_queue;
tasker::queue &_worker_queue, &_apartment_queue;
const std::shared_ptr<profiling_session> _db;
const std::shared_ptr<profiling_cache> _cache;
module_hashes_t _module_hashes;
Expand Down
4 changes: 2 additions & 2 deletions frontend/ipc_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <ipc/endpoint.h>
#include <ipc/misc.h>

namespace scheduler
namespace tasker
{
struct queue;
}
Expand All @@ -42,7 +42,7 @@ namespace micro_profiler
typedef std::pair<unsigned short /*start*/, unsigned short /*size*/> port_range;

public:
ipc_manager(std::shared_ptr<ipc::server> server, scheduler::queue &apartment_queue, port_range range_,
ipc_manager(std::shared_ptr<ipc::server> server, tasker::queue &apartment_queue, port_range range_,
const guid_t *com_server_id);
~ipc_manager();

Expand Down
6 changes: 3 additions & 3 deletions frontend/patch_moderator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "database.h"

namespace scheduler
namespace tasker
{
struct queue;
template <typename T> class task;
Expand All @@ -38,7 +38,7 @@ namespace micro_profiler
{
public:
patch_moderator(std::shared_ptr<profiling_session> session, std::shared_ptr<profiling_cache_tasks> mapping,
std::shared_ptr<profiling_cache> cache, scheduler::queue &worker, scheduler::queue &apartment);
std::shared_ptr<profiling_cache> cache, tasker::queue &worker, tasker::queue &apartment);

private:
enum patch_state { patch_saved, patch_added, patch_removed, };
Expand All @@ -52,7 +52,7 @@ namespace micro_profiler
std::shared_ptr<changes_log> changes, profiling_cache_tasks &tasks);

private:
scheduler::queue &_worker, &_apartment;
tasker::queue &_worker, &_apartment;
std::vector<wpl::slot_connection> _connection;
};
}
4 changes: 2 additions & 2 deletions frontend/profiling_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "database.h"

namespace scheduler
namespace tasker
{
template <typename T>
class task;
Expand All @@ -37,7 +37,7 @@ namespace micro_profiler

struct profiling_cache_tasks
{
virtual scheduler::task<id_t> persisted_module_id(unsigned int hash) = 0;
virtual tasker::task<id_t> persisted_module_id(unsigned int hash) = 0;
};

struct profiling_cache
Expand Down
Loading

0 comments on commit afb4c7d

Please sign in to comment.