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

Merge branch 'extend-print-info' into 'master'

Extend emper::printInfo()

See merge request i4/manycore/emper!355
parents 11f20753 581e494b
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;
}
...@@ -28,6 +28,12 @@ echoclient_exe = executable( ...@@ -28,6 +28,12 @@ echoclient_exe = executable(
dependencies: emper_dep, dependencies: emper_dep,
) )
emper_info_exe = executable(
'emper-info',
'EmperInfo.cpp',
dependencies: emper_dep,
)
qsort = executable( qsort = executable(
'qsort', 'qsort',
'qsort.cpp', 'qsort.cpp',
......
...@@ -49,12 +49,95 @@ void async(const Fiber::fiber_fun0_t& function, workeraffinity_t* affinity) { ...@@ -49,12 +49,95 @@ void async(const Fiber::fiber_fun0_t& function, workeraffinity_t* affinity) {
namespace emper { namespace emper {
void printInfo(std::ostream strm) { auto operator<<(std::ostream& out, const ContinuationStealingMode& cont_stealing_mode)
// clang-format: off -> std::ostream& {
strm << "Extensible Massive-Parallelism Execution Realm (EMPER)" << std::endl 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 << "Version: " << getFullVersion() << std::endl
<< "Context Size: " << eu::bytesToHumanReadableString(Context::CONTEXT_SIZE) << std::endl; << "Debug: " << DEBUG << std::endl
// clang-format: on << "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"); const bool IO_MUST_INVALIDATE_BROKEN_CHAIN = EMPER_LINUX_LT("5.15.0");
......
...@@ -257,6 +257,9 @@ enum class ContinuationStealingMode { ...@@ -257,6 +257,9 @@ enum class ContinuationStealingMode {
locked, locked,
waitfree, 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 = const ContinuationStealingMode CONTINUATION_STEALING_MODE =
ContinuationStealingMode::EMPER_CONTINUATION_STEALING_MODE; ContinuationStealingMode::EMPER_CONTINUATION_STEALING_MODE;
...@@ -271,6 +274,11 @@ enum class ContinuationStealingMadviseStack { ...@@ -271,6 +274,11 @@ enum class ContinuationStealingMadviseStack {
dontneed, dontneed,
free, 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 = const enum ContinuationStealingMadviseStack CONTINUATION_STEALING_MADVISE_STACK =
ContinuationStealingMadviseStack::EMPER_CONTINUATION_STEALING_MADVISE_STACK; ContinuationStealingMadviseStack::EMPER_CONTINUATION_STEALING_MADVISE_STACK;
...@@ -291,7 +299,8 @@ const bool CONTEXT_MANAGER_WITH_MEMORY_MANAGER = ...@@ -291,7 +299,8 @@ const bool CONTEXT_MANAGER_WITH_MEMORY_MANAGER =
#endif #endif
; ;
constexpr float MEMORY_MANAGER_VICTIM_PERCENTAGE = EMPER_MEMORY_MANAGER_VICTIM_PERCENTAGE / 100; constexpr float MEMORY_MANAGER_VICTIM_PERCENTAGE =
static_cast<float>(EMPER_MEMORY_MANAGER_VICTIM_PERCENTAGE) / 100;
static_assert(MEMORY_MANAGER_VICTIM_PERCENTAGE >= 0 && MEMORY_MANAGER_VICTIM_PERCENTAGE <= 1); static_assert(MEMORY_MANAGER_VICTIM_PERCENTAGE >= 0 && MEMORY_MANAGER_VICTIM_PERCENTAGE <= 1);
const size_t ASSUME_PAGE_SIZE = EMPER_ASSUME_PAGE_SIZE; const size_t ASSUME_PAGE_SIZE = EMPER_ASSUME_PAGE_SIZE;
......
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