Skip to content
Snippets Groups Projects
Commit 581e494b authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Extend emper::printInfo(), add emper-info "app"

parent de9b370b
No related branches found
No related tags found
No related merge requests found
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2022 Florian Schmaus
#include <cstdlib>
#include "Emper.hpp"
#include "emper-common.h"
auto main(UNUSED_ARG int argc, UNUSED_ARG char* argv[]) -> int {
emper::printInfo();
return EXIT_SUCCESS;
}
......@@ -34,6 +34,12 @@ echoclient_exe = executable(
dependencies: emper_dep,
)
emper_info_exe = executable(
'emper-info',
'EmperInfo.cpp',
dependencies: emper_dep,
)
qsort = executable(
'qsort',
'qsort.cpp',
......
......@@ -49,12 +49,95 @@ void async(const Fiber::fiber_fun0_t& function, workeraffinity_t* affinity) {
namespace emper {
void printInfo(std::ostream strm) {
// clang-format: off
strm << "Extensible Massive-Parallelism Execution Realm (EMPER)" << std::endl
auto operator<<(std::ostream& out, const ContinuationStealingMode& cont_stealing_mode)
-> std::ostream& {
switch (cont_stealing_mode) {
case ContinuationStealingMode::disabled:
out << "disabled";
break;
case ContinuationStealingMode::locked:
out << "locked";
break;
case ContinuationStealingMode::waitfree:
out << "waitfree";
break;
}
return out;
}
auto operator>>(std::istream& in, ContinuationStealingMode& cont_stealing_mode) -> std::istream& {
std::string token;
in >> token;
if (token == "disabled") {
cont_stealing_mode = ContinuationStealingMode::disabled;
} else if (token == "locked") {
cont_stealing_mode = ContinuationStealingMode::locked;
} else if (token == "waitfree") {
cont_stealing_mode = ContinuationStealingMode::waitfree;
} else {
in.setstate(std::ios_base::failbit);
}
return in;
}
auto operator<<(std::ostream& out,
const ContinuationStealingMadviseStack& cont_stealing_madvise_stack)
-> std::ostream& {
switch (cont_stealing_madvise_stack) {
case ContinuationStealingMadviseStack::no:
out << "no";
break;
case ContinuationStealingMadviseStack::dontneed:
out << "dontneed";
break;
case ContinuationStealingMadviseStack::free:
out << "free";
break;
}
return out;
}
auto operator>>(std::istream& in, ContinuationStealingMadviseStack& cont_stealing_madvise_stack)
-> std::istream& {
std::string token;
in >> token;
if (token == "no") {
cont_stealing_madvise_stack = ContinuationStealingMadviseStack::no;
} else if (token == "dontneed") {
cont_stealing_madvise_stack = ContinuationStealingMadviseStack::dontneed;
} else if (token == "free") {
cont_stealing_madvise_stack = ContinuationStealingMadviseStack::free;
} else {
in.setstate(std::ios_base::failbit);
}
return in;
}
void printInfo(std::ostream& strm) {
// clang-format off
strm << std::boolalpha << "Extensible Massive-Parallelism Execution Realm (EMPER)" << std::endl
<< "Version: " << getFullVersion() << std::endl
<< "Context Size: " << eu::bytesToHumanReadableString(Context::CONTEXT_SIZE) << std::endl;
// clang-format: on
<< "Debug: " << DEBUG << std::endl
<< "IO: " << IO << std::endl
<< "IO Stealing: " << IO_STEALING << std::endl
<< "IO Lockless CQ: " << IO_LOCKLESS_CQ << std::endl
<< "Set Affinity on Block: " << SET_AFFINITY_ON_BLOCK << std::endl
<< "Work-Stealing Queue Default: " << TOSTRING(EMPER_WS_QUEUE_DEFAULT_TYPE) << std::endl
<< "Work-Stealing Queue Scheduler: " << TOSTRING(EMPER_WS_QUEUE_SCHEDULER_TYPE) << std::endl
<< "Continuation-Stealing: " << CONTINUATION_STEALING_MODE << std::endl
<< "Continuation-Stealing Madvise Stack: " << CONTINUATION_STEALING_MADVISE_STACK << std::endl
<< "Context Size: " << eu::bytesToHumanReadableString(Context::CONTEXT_SIZE) << std::endl
<< "Context Manager with Memory Manager: " << CONTEXT_MANAGER_WITH_MEMORY_MANAGER << std::endl
<< "Memory Manager Victim Percentage: " << MEMORY_MANAGER_VICTIM_PERCENTAGE << std::endl
<< "Stack Guard Page: " << STACK_GUARD_PAGE << std::endl
<< "Assume Cache Line Size: " << ASSUME_CACHE_LINE_SIZE << std::endl
<< "Stats: " << STATS << std::endl
<< "Worker Sleep: " << WORKER_SLEEP << std::endl
<< "Overflow Queue: " << OVERFLOW_QUEUE << std::endl
;
// clang-format on
}
const bool IO_MUST_INVALIDATE_BROKEN_CHAIN = EMPER_LINUX_LT("5.15.0");
......
......@@ -257,6 +257,9 @@ enum class ContinuationStealingMode {
locked,
waitfree,
};
auto operator<<(std::ostream& out, const ContinuationStealingMode& cont_stealing_mode)
-> std::ostream&;
auto operator>>(std::istream& in, ContinuationStealingMode& cont_stealing_mode) -> std::istream&;
const ContinuationStealingMode CONTINUATION_STEALING_MODE =
ContinuationStealingMode::EMPER_CONTINUATION_STEALING_MODE;
......@@ -271,6 +274,11 @@ enum class ContinuationStealingMadviseStack {
dontneed,
free,
};
auto operator<<(std::ostream& out,
const ContinuationStealingMadviseStack& cont_stealing_madvise_stack)
-> std::ostream&;
auto operator>>(std::istream& in, ContinuationStealingMadviseStack& cont_stealing_madvise_stack)
-> std::istream&;
const enum ContinuationStealingMadviseStack CONTINUATION_STEALING_MADVISE_STACK =
ContinuationStealingMadviseStack::EMPER_CONTINUATION_STEALING_MADVISE_STACK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment