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

Merge branch 'add_ioc_prefix_to_log' into 'master'

[Debug] prefix log messages from the I/O completer thread with "IOC"

See merge request i4/manycore/emper!216
parents 7f845e8a 5a8bdbd3
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Copyright © 2020 Florian Schmaus // Copyright © 2020 Florian Schmaus
#include "Debug.hpp" #include "Debug.hpp"
#include <pthread.h>
#include <chrono> #include <chrono>
#include <ctime> // for localtime #include <ctime> // for localtime
#include <iomanip> // for operator<<, setfill, setw #include <iomanip> // for operator<<, setfill, setw
...@@ -10,9 +12,13 @@ ...@@ -10,9 +12,13 @@
#include "Common.hpp" #include "Common.hpp"
#include "Emper.hpp" #include "Emper.hpp"
#include "Worker.hpp" // for Runtime #include "Runtime.hpp"
#include "Worker.hpp"
#include "emper-common.h" // for workerid_t #include "emper-common.h" // for workerid_t
#include "emper-config.h" // for EMPER_LOG_LEVEL #include "emper-config.h" // for EMPER_LOG_LEVEL
#include "io/GlobalIoContext.hpp"
using emper::io::GlobalIoContext;
static std::mutex emper_log_mutex; static std::mutex emper_log_mutex;
...@@ -39,7 +45,14 @@ void emper_log(const std::string& prefix, const std::string& message) { ...@@ -39,7 +45,14 @@ void emper_log(const std::string& prefix, const std::string& message) {
std::string workerIdAsString = std::to_string(workerId); std::string workerIdAsString = std::to_string(workerId);
logMessage << std::setfill('0') << std::setw(3) << workerIdAsString << " "; logMessage << std::setfill('0') << std::setw(3) << workerIdAsString << " ";
} else { } else {
logMessage << " "; // Are we the global IO completer
Runtime* runtime = Runtime::getRuntime();
GlobalIoContext* gio = runtime ? runtime->globalIo : nullptr;
if (gio && pthread_self() == gio->globalCompleter) {
logMessage << "IOC ";
} else {
logMessage << " ";
}
} }
if constexpr (emper::LOG_TIMESTAMP) { if constexpr (emper::LOG_TIMESTAMP) {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <mutex> #include <mutex>
#include <optional> #include <optional>
#include <random> #include <random>
#include <string>
#include <vector> // for vector #include <vector> // for vector
#include "CallerEnvironment.hpp" #include "CallerEnvironment.hpp"
...@@ -194,4 +195,6 @@ class Runtime : public Logger<LogSubsystem::RUNTI> { ...@@ -194,4 +195,6 @@ class Runtime : public Logger<LogSubsystem::RUNTI> {
friend class MemoryManager; friend class MemoryManager;
template <typename> template <typename>
friend class WorkerLocalData; friend class WorkerLocalData;
friend void emper_log(const std::string& prefix, const std::string& message);
}; };
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <cassert> #include <cassert>
#include <cerrno> #include <cerrno>
#include <cstdio> #include <cstdio>
#include <memory>
#include <mutex> #include <mutex>
#include "CallerEnvironment.hpp" #include "CallerEnvironment.hpp"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <cstdint> #include <cstdint>
#include <mutex> #include <mutex>
#include <string>
#include "emper-common.h" #include "emper-common.h"
#include "io/IoContext.hpp" #include "io/IoContext.hpp"
...@@ -14,6 +15,7 @@ class Runtime; ...@@ -14,6 +15,7 @@ class Runtime;
namespace emper::io { namespace emper::io {
class GlobalIoContext : public IoContext { class GlobalIoContext : public IoContext {
friend Runtime; friend Runtime;
friend void ::emper_log(const std::string& prefix, const std::string& message);
friend class Future; friend class Future;
friend class SendFuture; friend class SendFuture;
friend class RecvFuture; friend class RecvFuture;
......
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