Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More node information #15

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions include/kth/node/executor/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@

namespace kth::node {


static constexpr
std::string_view march_names();

static constexpr
std::string_view node_version();

static constexpr
std::string_view currency_symbol();

static constexpr
std::string_view currency();

static constexpr
std::string_view db_type();

class executor {
public:
executor(kth::node::configuration const& config, bool stdout_enabled = true);
Expand Down
44 changes: 36 additions & 8 deletions src/executor/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@ static constexpr int directory_exists = 0;
static constexpr int directory_not_found = 2;
static auto const mode = std::ofstream::out | std::ofstream::app;


static constexpr
std::string_view microarchitecture() {
return KTH_MICROARCHITECTURE_STR;
}

static constexpr
std::string_view march_names() {
#if defined(KTH_MARCH_NAMES_FULL_STR)
return KTH_MARCH_NAMES_FULL_STR;
#else
return "unknown";
#endif
}

static constexpr
std::string_view node_version() {
return KTH_NODE_VERSION;
}

static constexpr
std::string_view currency_symbol() {
return KTH_CURRENCY_SYMBOL_STR;
}

static constexpr
std::string_view currency() {
return KTH_CURRENCY_STR;
}

static constexpr
std::string_view db_type() {
return KTH_DB_TYPE;
}


std::promise<kth::code> executor::stopping_; //NOLINT

executor::executor(kth::node::configuration const& config, bool stdout_enabled /*= true*/)
Expand Down Expand Up @@ -115,14 +151,6 @@ executor::executor(kth::node::configuration const& config, bool stdout_enabled /
//handle_stop(initialize_stop);
}

static constexpr std::string_view march_names() {
#if defined(KTH_MARCH_NAMES_FULL_STR)
return KTH_MARCH_NAMES_FULL_STR;
#else
return "unknown";
#endif
}

void executor::print_version(std::string_view extra) {
std::cout << fmt::format(KTH_VERSION_MESSAGE, KTH_NODE_VERSION, extra, KTH_CURRENCY_SYMBOL_STR, KTH_MICROARCHITECTURE_STR, march_names(), KTH_DB_TYPE) << std::endl;
}
Expand Down