mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
log: fix undefined intitialization order of static objects. fixes #799.
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
2d9bb26847
commit
cb085dbe23
83 changed files with 155 additions and 152 deletions
|
@ -31,7 +31,7 @@ public:
|
||||||
using Path = std::list<EdgeIdentifier>;
|
using Path = std::list<EdgeIdentifier>;
|
||||||
|
|
||||||
DirectedGraph(const std::string &name = "DirectedGraph")
|
DirectedGraph(const std::string &name = "DirectedGraph")
|
||||||
: lastVertexId(0), lastEdgeId(0), logger(logging.get(name)) {}
|
: lastVertexId(0), lastEdgeId(0), logger(Log::get(name)) {}
|
||||||
|
|
||||||
std::shared_ptr<VertexType> getVertex(VertexIdentifier vertexId) const {
|
std::shared_ptr<VertexType> getVertex(VertexIdentifier vertexId) const {
|
||||||
// Cannot use [] operator, because creates non-existing elements
|
// Cannot use [] operator, because creates non-existing elements
|
||||||
|
|
|
@ -60,11 +60,11 @@ struct Region {
|
||||||
|
|
||||||
class Device {
|
class Device {
|
||||||
public:
|
public:
|
||||||
Device(Id i, Slot s) : id(i), slot(s), log(logging.get("kernel:pci")) {}
|
Device(Id i, Slot s) : id(i), slot(s), log(Log::get("kernel:pci")) {}
|
||||||
|
|
||||||
Device(Id i) : id(i), log(logging.get("kernel:pci")) {}
|
Device(Id i) : id(i), log(Log::get("kernel:pci")) {}
|
||||||
|
|
||||||
Device(Slot s) : slot(s), log(logging.get("kernel:pci")) {}
|
Device(Slot s) : slot(s), log(Log::get("kernel:pci")) {}
|
||||||
|
|
||||||
bool operator==(const Device &other);
|
bool operator==(const Device &other);
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,7 @@
|
||||||
namespace villas {
|
namespace villas {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class Log;
|
|
||||||
|
|
||||||
using Logger = std::shared_ptr<spdlog::logger>;
|
using Logger = std::shared_ptr<spdlog::logger>;
|
||||||
|
|
||||||
extern Log logging;
|
|
||||||
|
|
||||||
class Log {
|
class Log {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -64,7 +59,19 @@ public:
|
||||||
|
|
||||||
void parse(json_t *json);
|
void parse(json_t *json);
|
||||||
|
|
||||||
Logger get(const std::string &name);
|
static Log &getInstance() {
|
||||||
|
// This will "leak" memory. Because we don't have a complex destructor it's okay
|
||||||
|
// that this will be cleaned up implicitly on program exit.
|
||||||
|
static auto log = new Log();
|
||||||
|
return *log;
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger getNewLogger(const std::string &name);
|
||||||
|
|
||||||
|
static Logger get(const std::string &name) {
|
||||||
|
static auto &log = getInstance();
|
||||||
|
return log.getNewLogger(name);
|
||||||
|
}
|
||||||
|
|
||||||
void setFormatter(const std::string &pattern, const std::string &pfx = "");
|
void setFormatter(const std::string &pattern, const std::string &pfx = "");
|
||||||
void setLevel(Level lvl);
|
void setLevel(Level lvl);
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
// CRTP
|
// CRTP
|
||||||
derivedAlloc = static_cast<DerivedAllocator *>(this);
|
derivedAlloc = static_cast<DerivedAllocator *>(this);
|
||||||
std::string loggerName = fmt::format("memory:", derivedAlloc->getName());
|
std::string loggerName = fmt::format("memory:", derivedAlloc->getName());
|
||||||
logger = logging.get(loggerName);
|
logger = Log::get(loggerName);
|
||||||
|
|
||||||
// Default deallocation callback
|
// Default deallocation callback
|
||||||
free = [&](MemoryBlock *mem) {
|
free = [&](MemoryBlock *mem) {
|
||||||
|
@ -249,10 +249,12 @@ public:
|
||||||
allocateBlock(size_t size);
|
allocateBlock(size_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
static HostRamAllocator &getAllocator() { return allocator; }
|
static HostRamAllocator &getAllocator() {
|
||||||
|
// This will "leak" memory. Because we don't have a complex destructor it's okay
|
||||||
private:
|
// that this will be cleaned up implicitly on program exit.
|
||||||
static HostRamAllocator allocator;
|
static auto allocator = new HostRamAllocator();
|
||||||
|
return *allocator;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class HostDmaRam {
|
class HostDmaRam {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class MemoryManager {
|
||||||
private:
|
private:
|
||||||
// This is a singleton, so private constructor ...
|
// This is a singleton, so private constructor ...
|
||||||
MemoryManager()
|
MemoryManager()
|
||||||
: memoryGraph("memory:graph"), logger(logging.get("memory:manager")) {
|
: memoryGraph("memory:graph"), logger(Log::get("memory:manager")) {
|
||||||
pathCheckFunc = [&](const MemoryGraph::Path &path) {
|
pathCheckFunc = [&](const MemoryGraph::Path &path) {
|
||||||
return this->pathCheck(path);
|
return this->pathCheck(path);
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ protected:
|
||||||
List<SubRegistry> registries;
|
List<SubRegistry> registries;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Logger getLogger() { return logging.get("plugin:registry"); }
|
Logger getLogger() { return Log::get("plugin:registry"); }
|
||||||
|
|
||||||
void add(Plugin *p) { plugins.push_back(p); }
|
void add(Plugin *p) { plugins.push_back(p); }
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public:
|
||||||
virtual Logger getLogger() {
|
virtual Logger getLogger() {
|
||||||
if (!logger) {
|
if (!logger) {
|
||||||
auto name = fmt::format("{}:{}", getType(), getName());
|
auto name = fmt::format("{}:{}", getType(), getName());
|
||||||
logger = logging.get(name);
|
logger = Log::get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return logger;
|
return logger;
|
||||||
|
|
|
@ -119,7 +119,7 @@ int villas::kernel::setModuleParam(const char *module, const char *param,
|
||||||
throw RuntimeError("Failed set parameter {} for kernel module {} to {}",
|
throw RuntimeError("Failed set parameter {} for kernel module {} to {}",
|
||||||
module, param, value);
|
module, param, value);
|
||||||
|
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->debug("Set parameter {} of kernel module {} to {}", module, param,
|
logger->debug("Set parameter {} of kernel module {} to {}", module, param,
|
||||||
value);
|
value);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ int villas::kernel::loadModule(const char *module) {
|
||||||
|
|
||||||
ret = isModuleLoaded(module);
|
ret = isModuleLoaded(module);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->debug("Kernel module {} already loaded...", module);
|
logger->debug("Kernel module {} already loaded...", module);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ int villas::kernel::getCmdlineParam(const char *param, char *buf, size_t len) {
|
||||||
do {
|
do {
|
||||||
ret = sscanf(tok, "%127[^=]=%127s", key, value);
|
ret = sscanf(tok, "%127[^=]=%127s", key, value);
|
||||||
if (ret >= 1) {
|
if (ret >= 1) {
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
if (ret >= 2)
|
if (ret >= 2)
|
||||||
logger->debug("Found kernel param: {}={}", key, value);
|
logger->debug("Found kernel param: {}={}", key, value);
|
||||||
else
|
else
|
||||||
|
@ -220,7 +220,7 @@ int villas::kernel::getNrHugepages() {
|
||||||
|
|
||||||
f = fopen(PROCFS_PATH "/sys/vm/nr_hugepages", "r");
|
f = fopen(PROCFS_PATH "/sys/vm/nr_hugepages", "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->error("Failed to open {}: {}", PROCFS_PATH "/sys/vm/nr_hugepages",
|
logger->error("Failed to open {}: {}", PROCFS_PATH "/sys/vm/nr_hugepages",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace kernel {
|
||||||
namespace rt {
|
namespace rt {
|
||||||
|
|
||||||
void init(int priority, int affinity) {
|
void init(int priority, int affinity) {
|
||||||
Logger logger = logging.get("kernel:rt");
|
Logger logger = Log::get("kernel:rt");
|
||||||
|
|
||||||
logger->info("Initialize sub-system");
|
logger->info("Initialize sub-system");
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void setProcessAffinity(int affinity) {
|
||||||
|
|
||||||
assert(affinity != 0);
|
assert(affinity != 0);
|
||||||
|
|
||||||
Logger logger = logging.get("kernel:rt");
|
Logger logger = Log::get("kernel:rt");
|
||||||
|
|
||||||
// Pin threads to CPUs by setting the affinity
|
// Pin threads to CPUs by setting the affinity
|
||||||
CpuSet cset_pin(affinity);
|
CpuSet cset_pin(affinity);
|
||||||
|
@ -101,7 +101,7 @@ void setThreadAffinity(pthread_t thread, int affinity) {
|
||||||
|
|
||||||
assert(affinity != 0);
|
assert(affinity != 0);
|
||||||
|
|
||||||
Logger logger = logging.get("kernel:rt");
|
Logger logger = Log::get("kernel:rt");
|
||||||
|
|
||||||
CpuSet cset_pin(affinity);
|
CpuSet cset_pin(affinity);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void setPriority(int priority) {
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
param.sched_priority = priority;
|
param.sched_priority = priority;
|
||||||
|
|
||||||
Logger logger = logging.get("kernel:rt");
|
Logger logger = Log::get("kernel:rt");
|
||||||
|
|
||||||
ret = sched_setscheduler(0, SCHED_FIFO, ¶m);
|
ret = sched_setscheduler(0, SCHED_FIFO, ¶m);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -68,7 +68,7 @@ static std::array<std::string, EXTENSION_SIZE> VFIO_EXTENSION_STR =
|
||||||
|
|
||||||
Container::Container(std::vector<std::string> required_modules)
|
Container::Container(std::vector<std::string> required_modules)
|
||||||
: fd(-1), version(0), extensions(), iova_next(0), hasIommu(false), groups(),
|
: fd(-1), version(0), extensions(), iova_next(0), hasIommu(false), groups(),
|
||||||
log(logging.get("kernel:vfio:container")) {
|
log(Log::get("kernel:vfio:container")) {
|
||||||
for (auto module : required_modules) {
|
for (auto module : required_modules) {
|
||||||
if (kernel::loadModule(module.c_str()) != 0) {
|
if (kernel::loadModule(module.c_str()) != 0) {
|
||||||
throw RuntimeError("Kernel module '{}' required but could not be loaded. "
|
throw RuntimeError("Kernel module '{}' required but could not be loaded. "
|
||||||
|
|
|
@ -56,7 +56,7 @@ Device::Device(const std::string &name, int groupFileDescriptor,
|
||||||
const kernel::pci::Device *pci_device)
|
const kernel::pci::Device *pci_device)
|
||||||
: name(name), fd(-1), attachedToGroup(false), groupFd(groupFileDescriptor),
|
: name(name), fd(-1), attachedToGroup(false), groupFd(groupFileDescriptor),
|
||||||
info(), irqs(), regions(), mappings(), pci_device(pci_device),
|
info(), irqs(), regions(), mappings(), pci_device(pci_device),
|
||||||
log(logging.get("kernel:vfio:device")) {
|
log(Log::get("kernel:vfio:device")) {
|
||||||
if (groupFileDescriptor < 0)
|
if (groupFileDescriptor < 0)
|
||||||
throw RuntimeError("Invalid group file descriptor");
|
throw RuntimeError("Invalid group file descriptor");
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ int Device::pciMsiInit(int efds[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Device::pciMsiDeinit(int efds[]) {
|
int Device::pciMsiDeinit(int efds[]) {
|
||||||
logging.get("Device")->debug("Deinitializing MSI interrupts for device {}",
|
Log::get("Device")->debug("Deinitializing MSI interrupts for device {}",
|
||||||
name);
|
name);
|
||||||
// Check if this is really a vfio-pci device
|
// Check if this is really a vfio-pci device
|
||||||
if (not isVfioPciDevice())
|
if (not isVfioPciDevice())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -38,7 +38,7 @@ using namespace villas::kernel::vfio;
|
||||||
|
|
||||||
Group::Group(int index, bool iommuEnabled)
|
Group::Group(int index, bool iommuEnabled)
|
||||||
: fd(-1), index(index), attachedToContainer(false), status(), devices(),
|
: fd(-1), index(index), attachedToContainer(false), status(), devices(),
|
||||||
log(logging.get("kernel:vfio:group")) {
|
log(Log::get("kernel:vfio:group")) {
|
||||||
// Open group fd
|
// Open group fd
|
||||||
std::stringstream groupPath;
|
std::stringstream groupPath;
|
||||||
groupPath << VFIO_PATH << (iommuEnabled ? "" : "noiommu-") << index;
|
groupPath << VFIO_PATH << (iommuEnabled ? "" : "noiommu-") << index;
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
|
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
|
|
||||||
// The global log instance
|
|
||||||
Log villas::logging;
|
|
||||||
|
|
||||||
static std::map<spdlog::level::level_enum, std::string> levelNames = {
|
static std::map<spdlog::level::level_enum, std::string> levelNames = {
|
||||||
{spdlog::level::trace, "trc"}, {spdlog::level::debug, "dbg"},
|
{spdlog::level::trace, "trc"}, {spdlog::level::debug, "dbg"},
|
||||||
{spdlog::level::info, "info"}, {spdlog::level::warn, "warn"},
|
{spdlog::level::info, "info"}, {spdlog::level::warn, "warn"},
|
||||||
|
@ -69,7 +66,7 @@ int Log::getWidth() {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger Log::get(const std::string &name) {
|
Logger Log::getNewLogger(const std::string &name) {
|
||||||
Logger logger = spdlog::get(name);
|
Logger logger = spdlog::get(name);
|
||||||
|
|
||||||
if (not logger) {
|
if (not logger) {
|
||||||
|
|
|
@ -143,8 +143,6 @@ LinearAllocator::allocateBlock(size_t size) {
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
HostRam::HostRamAllocator HostRam::allocator;
|
|
||||||
|
|
||||||
HostRam::HostRamAllocator::HostRamAllocator()
|
HostRam::HostRamAllocator::HostRamAllocator()
|
||||||
: BaseAllocator(MemoryManager::get().getProcessAddressSpace()) {
|
: BaseAllocator(MemoryManager::get().getProcessAddressSpace()) {
|
||||||
free = [&](MemoryBlock *mem) {
|
free = [&](MemoryBlock *mem) {
|
||||||
|
@ -167,7 +165,7 @@ HostDmaRam::HostDmaRamAllocator::HostDmaRamAllocator(int num)
|
||||||
getUdmaBufBufSize(num)),
|
getUdmaBufBufSize(num)),
|
||||||
num(num) {
|
num(num) {
|
||||||
auto &mm = MemoryManager::get();
|
auto &mm = MemoryManager::get();
|
||||||
logger = logging.get(getName());
|
logger = Log::get(getName());
|
||||||
|
|
||||||
if (getSize() == 0) {
|
if (getSize() == 0) {
|
||||||
logger->error(
|
logger->error(
|
||||||
|
|
|
@ -164,7 +164,7 @@ MemoryTranslation::getForeignAddr(uintptr_t addrInLocalAddrSpace) const {
|
||||||
|
|
||||||
MemoryTranslation &
|
MemoryTranslation &
|
||||||
MemoryTranslation::operator+=(const MemoryTranslation &other) {
|
MemoryTranslation::operator+=(const MemoryTranslation &other) {
|
||||||
Logger logger = logging.get("MemoryTranslation");
|
Logger logger = Log::get("MemoryTranslation");
|
||||||
|
|
||||||
// Set level to debug to enable debug output
|
// Set level to debug to enable debug output
|
||||||
logger->set_level(spdlog::level::info);
|
logger->set_level(spdlog::level::info);
|
||||||
|
|
|
@ -57,8 +57,8 @@ int Table::resize(int w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::header() {
|
void Table::header() {
|
||||||
if (width != logging.getWidth())
|
if (width != Log::getInstance().getWidth())
|
||||||
resize(logging.getWidth());
|
resize(Log::getInstance().getWidth());
|
||||||
|
|
||||||
char *line1 = nullptr;
|
char *line1 = nullptr;
|
||||||
char *line2 = nullptr;
|
char *line2 = nullptr;
|
||||||
|
@ -107,8 +107,8 @@ void Table::header() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::row(int count, ...) {
|
void Table::row(int count, ...) {
|
||||||
if (width != logging.getWidth()) {
|
if (width != Log::getInstance().getWidth()) {
|
||||||
resize(logging.getWidth());
|
resize(Log::getInstance().getWidth());
|
||||||
header();
|
header();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Terminal::Terminal() {
|
||||||
|
|
||||||
isTty = isatty(STDERR_FILENO);
|
isTty = isatty(STDERR_FILENO);
|
||||||
|
|
||||||
Logger logger = logging.get("terminal");
|
Logger logger = Log::get("terminal");
|
||||||
|
|
||||||
if (isTty) {
|
if (isTty) {
|
||||||
struct sigaction sa_resize;
|
struct sigaction sa_resize;
|
||||||
|
@ -57,7 +57,7 @@ void Terminal::resize(int, siginfo_t *, void *) {
|
||||||
if (!current)
|
if (!current)
|
||||||
current = new Terminal();
|
current = new Terminal();
|
||||||
|
|
||||||
Logger logger = logging.get("terminal");
|
Logger logger = Log::get("terminal");
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ Tool::Tool(int ac, char *av[], const std::string &nme,
|
||||||
: argc(ac), argv(av), name(nme), handlerSignals(sigs) {
|
: argc(ac), argv(av), name(nme), handlerSignals(sigs) {
|
||||||
current_tool = this;
|
current_tool = this;
|
||||||
|
|
||||||
logger = logging.get(name);
|
logger = Log::get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tool::run() {
|
int Tool::run() {
|
||||||
|
|
|
@ -87,7 +87,7 @@ int signalsInit(void (*cb)(int signal, siginfo_t *sinfo, void *ctx),
|
||||||
std::list<int> cbSignals, std::list<int> ignoreSignals) {
|
std::list<int> cbSignals, std::list<int> ignoreSignals) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
Logger logger = logging.get("signals");
|
Logger logger = Log::get("signals");
|
||||||
|
|
||||||
logger->info("Initialize subsystem");
|
logger->info("Initialize subsystem");
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ using namespace villas;
|
||||||
TestSuite(graph, .description = "Graph library");
|
TestSuite(graph, .description = "Graph library");
|
||||||
|
|
||||||
Test(graph, basic, .description = "DirectedGraph") {
|
Test(graph, basic, .description = "DirectedGraph") {
|
||||||
Logger logger = logging.get("test:graph:basic");
|
Logger logger = Log::get("test:graph:basic");
|
||||||
villas::graph::DirectedGraph<> g("test:graph:basic");
|
villas::graph::DirectedGraph<> g("test:graph:basic");
|
||||||
|
|
||||||
logger->info("Testing basic graph construction and modification");
|
logger->info("Testing basic graph construction and modification");
|
||||||
|
@ -48,7 +48,7 @@ Test(graph, basic, .description = "DirectedGraph") {
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(graph, path, .description = "Find path") {
|
Test(graph, path, .description = "Find path") {
|
||||||
Logger logger = logging.get("test:graph:path");
|
Logger logger = Log::get("test:graph:path");
|
||||||
logger->info("Testing path finding algorithm");
|
logger->info("Testing path finding algorithm");
|
||||||
|
|
||||||
using Graph = villas::graph::DirectedGraph<>;
|
using Graph = villas::graph::DirectedGraph<>;
|
||||||
|
@ -109,7 +109,7 @@ Test(graph, path, .description = "Find path") {
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(graph, memory_manager, .description = "Global Memory Manager") {
|
Test(graph, memory_manager, .description = "Global Memory Manager") {
|
||||||
Logger logger = logging.get("test:graph:mm");
|
Logger logger = Log::get("test:graph:mm");
|
||||||
auto &mm = villas::MemoryManager::get();
|
auto &mm = villas::MemoryManager::get();
|
||||||
|
|
||||||
logger->info("Create address spaces");
|
logger->info("Create address spaces");
|
||||||
|
|
|
@ -47,7 +47,7 @@ std::string villas::gpu::GpuAllocator::getName() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
GpuFactory::GpuFactory()
|
GpuFactory::GpuFactory()
|
||||||
: logger(villas::logging.get("gpu:factory")),
|
: logger(villas::Log::get("gpu:factory")),
|
||||||
Plugin("cuda", "CUDA capable GPUs") {}
|
Plugin("cuda", "CUDA capable GPUs") {}
|
||||||
|
|
||||||
// Required to be defined here for PIMPL to compile
|
// Required to be defined here for PIMPL to compile
|
||||||
|
@ -67,8 +67,8 @@ std::string Gpu::getName() const {
|
||||||
cudaDeviceProp deviceProp;
|
cudaDeviceProp deviceProp;
|
||||||
if (cudaGetDeviceProperties(&deviceProp, gpuId) != cudaSuccess) {
|
if (cudaGetDeviceProperties(&deviceProp, gpuId) != cudaSuccess) {
|
||||||
// Logger not yet availabe
|
// Logger not yet availabe
|
||||||
villas::logging.get("gpu")->error("Cannot retrieve properties for GPU {}",
|
villas::Log::get("gpu")->error("Cannot retrieve properties for GPU {}",
|
||||||
gpuId);
|
gpuId);
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ GpuAllocator::allocateBlock(size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gpu::Gpu(int gpuId) : pImpl{std::make_unique<impl>()}, gpuId(gpuId) {
|
Gpu::Gpu(int gpuId) : pImpl{std::make_unique<impl>()}, gpuId(gpuId) {
|
||||||
logger = villas::logging.get(getName());
|
logger = villas::Log::get(getName());
|
||||||
|
|
||||||
pImpl->gdr = gdr_open();
|
pImpl->gdr = gdr_open();
|
||||||
if (pImpl->gdr == nullptr) {
|
if (pImpl->gdr == nullptr) {
|
||||||
|
|
|
@ -228,14 +228,12 @@ protected:
|
||||||
IRQ,
|
IRQ,
|
||||||
};
|
};
|
||||||
|
|
||||||
Logger getLogger() { return villas::logging.get(getName()); }
|
Logger getLogger() { return villas::Log::get(getName()); }
|
||||||
|
|
||||||
// Configure IP instance from JSON config
|
// Configure IP instance from JSON config
|
||||||
virtual void parse(Core &, json_t *) {}
|
virtual void parse(Core &, json_t *) {}
|
||||||
|
|
||||||
static Logger getStaticLogger() {
|
static Logger getStaticLogger() { return villas::Log::get("core:factory"); }
|
||||||
return villas::logging.get("core:factory");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void configurePollingMode(Core &, PollingMode) {}
|
virtual void configurePollingMode(Core &, PollingMode) {}
|
||||||
|
|
|
@ -45,8 +45,7 @@ public:
|
||||||
|
|
||||||
class Switch {
|
class Switch {
|
||||||
public:
|
public:
|
||||||
Switch(I2c *i2c, uint8_t address,
|
Switch(I2c *i2c, uint8_t address, Logger logger = villas::Log::get("i2c"))
|
||||||
Logger logger = villas::logging.get("i2c"))
|
|
||||||
: i2c(i2c), address(address), channel(0), readOnce(false), switchLock(),
|
: i2c(i2c), address(address), channel(0), readOnce(false), switchLock(),
|
||||||
logger(logger){};
|
logger(logger){};
|
||||||
Switch(const Switch &other) = delete;
|
Switch(const Switch &other) = delete;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public: // TODO: make this private
|
||||||
std::shared_ptr<kernel::pci::Device> pdev; // PCI device handle
|
std::shared_ptr<kernel::pci::Device> pdev; // PCI device handle
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Logger getLogger() const { return villas::logging.get(name); }
|
Logger getLogger() const { return villas::Log::get(name); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class PCIeCardFactory : public plugin::Plugin {
|
class PCIeCardFactory : public plugin::Plugin {
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
static PCIeCard *make() { return new PCIeCard(); }
|
static PCIeCard *make() { return new PCIeCard(); }
|
||||||
|
|
||||||
static Logger getStaticLogger() {
|
static Logger getStaticLogger() {
|
||||||
return villas::logging.get("pcie:card:factory");
|
return villas::Log::get("pcie:card:factory");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string getName() const { return "pcie"; }
|
virtual std::string getName() const { return "pcie"; }
|
||||||
|
|
|
@ -126,7 +126,7 @@ CoreFactory::configureIps(std::list<IpIdentifier> orderedIps, json_t *json_ips,
|
||||||
// Setup generic IP type properties
|
// Setup generic IP type properties
|
||||||
ip->card = card;
|
ip->card = card;
|
||||||
ip->id = id;
|
ip->id = id;
|
||||||
ip->logger = villas::logging.get(id.getName());
|
ip->logger = villas::Log::get(id.getName());
|
||||||
|
|
||||||
json_t *json_ip = json_object_get(json_ips, id.getName().c_str());
|
json_t *json_ip = json_object_get(json_ips, id.getName().c_str());
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
|
|
||||||
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
||||||
static auto logger = villas::logging.get("villasfpga_dma");
|
static auto logger = villas::Log::get("villasfpga_dma");
|
||||||
|
|
||||||
struct villasfpga_handle_t {
|
struct villasfpga_handle_t {
|
||||||
std::shared_ptr<villas::fpga::Card> card;
|
std::shared_ptr<villas::fpga::Card> card;
|
||||||
|
@ -40,7 +40,7 @@ villasfpga_handle villasfpga_init(const char *configFile) {
|
||||||
bool dumpAuroraChannels = true;
|
bool dumpAuroraChannels = true;
|
||||||
try {
|
try {
|
||||||
// Logging setup
|
// Logging setup
|
||||||
logging.setLevel(spdlog::level::debug);
|
Log::getInstance().setLevel(spdlog::level::debug);
|
||||||
fpga::setupColorHandling();
|
fpga::setupColorHandling();
|
||||||
|
|
||||||
if (configFile == nullptr || configFile[0] == '\0') {
|
if (configFile == nullptr || configFile[0] == '\0') {
|
||||||
|
|
|
@ -171,7 +171,7 @@ void DinoAdc::setRegisterConfig(std::shared_ptr<Register> reg,
|
||||||
float dacOffset = reg->getRegisterFloat(dinoRegisterDacOffset);
|
float dacOffset = reg->getRegisterFloat(dinoRegisterDacOffset);
|
||||||
uint32_t dacExternalTrig = reg->getRegister(dinoRegisterDacExternalTrig);
|
uint32_t dacExternalTrig = reg->getRegister(dinoRegisterDacExternalTrig);
|
||||||
uint32_t stsActive = reg->getRegister(dinoRegisterStsActive);
|
uint32_t stsActive = reg->getRegister(dinoRegisterStsActive);
|
||||||
logging.get("Dino")->info(
|
Log::get("Dino")->info(
|
||||||
"Check: Register configuration: TimerThresh: {}, Rate-Error: {} Hz, ADC "
|
"Check: Register configuration: TimerThresh: {}, Rate-Error: {} Hz, ADC "
|
||||||
"Scale: {}, ADC Offset: {}, DAC Scale: {}, DAC Offset: {}, DAC External "
|
"Scale: {}, ADC Offset: {}, DAC Scale: {}, DAC Offset: {}, DAC External "
|
||||||
"Trig: {:#x}, STS Active: {:#x}",
|
"Trig: {:#x}, STS Active: {:#x}",
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
|
|
||||||
static auto logger = villas::logging.get("streamer");
|
static auto logger = villas::Log::get("streamer");
|
||||||
|
|
||||||
std::shared_ptr<std::vector<std::shared_ptr<fpga::ip::Node>>>
|
std::shared_ptr<std::vector<std::shared_ptr<fpga::ip::Node>>>
|
||||||
fpga::getAuroraChannels(std::shared_ptr<fpga::Card> card) {
|
fpga::getAuroraChannels(std::shared_ptr<fpga::Card> card) {
|
||||||
|
@ -52,7 +52,7 @@ fpga::getAuroraChannels(std::shared_ptr<fpga::Card> card) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fpga::ConnectString::ConnectString(std::string &connectString, int maxPortNum)
|
fpga::ConnectString::ConnectString(std::string &connectString, int maxPortNum)
|
||||||
: log(villas::logging.get("ConnectString")), maxPortNum(maxPortNum),
|
: log(villas::Log::get("ConnectString")), maxPortNum(maxPortNum),
|
||||||
bidirectional(false), invert(false), srcType(ConnectType::LOOPBACK),
|
bidirectional(false), invert(false), srcType(ConnectType::LOOPBACK),
|
||||||
dstType(ConnectType::LOOPBACK), srcAsInt(-1), dstAsInt(-1) {
|
dstType(ConnectType::LOOPBACK), srcAsInt(-1), dstAsInt(-1) {
|
||||||
parseString(connectString);
|
parseString(connectString);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
|
|
||||||
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
||||||
static auto logger = villas::logging.get("ctrl");
|
static auto logger = villas::Log::get("ctrl");
|
||||||
|
|
||||||
void writeToDmaFromStdIn(std::shared_ptr<villas::fpga::ip::Dma> dma) {
|
void writeToDmaFromStdIn(std::shared_ptr<villas::fpga::ip::Dma> dma) {
|
||||||
auto &alloc = villas::HostRam::getAllocator();
|
auto &alloc = villas::HostRam::getAllocator();
|
||||||
|
@ -203,7 +203,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Logging setup
|
// Logging setup
|
||||||
|
|
||||||
logging.setLevel(spdlog::level::trace);
|
Log::getInstance().setLevel(spdlog::level::trace);
|
||||||
logger->set_level(spdlog::level::trace);
|
logger->set_level(spdlog::level::trace);
|
||||||
fpga::setupColorHandling();
|
fpga::setupColorHandling();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
|
|
||||||
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
||||||
static auto logger = villas::logging.get("streamer");
|
static auto logger = villas::Log::get("streamer");
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
// Command Line Parser
|
// Command Line Parser
|
||||||
|
|
|
@ -20,7 +20,7 @@ using namespace villas;
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, dma, .description = "DMA") {
|
Test(fpga, dma, .description = "DMA") {
|
||||||
auto logger = logging.get("unit-test:dma");
|
auto logger = Log::get("unit-test:dma");
|
||||||
|
|
||||||
std::list<std::shared_ptr<fpga::ip::Dma>> dmaIps;
|
std::list<std::shared_ptr<fpga::ip::Dma>> dmaIps;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Test(fpga, fifo, .description = "FIFO") {
|
||||||
char src[255], dst[255];
|
char src[255], dst[255];
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
auto logger = logging.get("unit-test:fifo");
|
auto logger = Log::get("unit-test:fifo");
|
||||||
|
|
||||||
for (auto &ip : state.cards.front()->ips) {
|
for (auto &ip : state.cards.front()->ips) {
|
||||||
// Skip non-fifo IPs
|
// Skip non-fifo IPs
|
||||||
|
|
|
@ -26,7 +26,7 @@ using namespace villas;
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, gpu_dma, .description = "GPU DMA tests") {
|
Test(fpga, gpu_dma, .description = "GPU DMA tests") {
|
||||||
auto logger = logging.get("unit-test:dma");
|
auto logger = Log::get("unit-test:dma");
|
||||||
|
|
||||||
auto &card = state.cards.front();
|
auto &card = state.cards.front();
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static int format_msg(char *buf, size_t buflen, const char *msg, va_list args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void criterion_log_noformat(enum criterion_severity severity, const char *msg) {
|
void criterion_log_noformat(enum criterion_severity severity, const char *msg) {
|
||||||
auto logger = villas::logging.get("criterion");
|
auto logger = villas::Log::get("criterion");
|
||||||
|
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case CR_LOG_INFO:
|
case CR_LOG_INFO:
|
||||||
|
@ -67,7 +67,7 @@ void criterion_vlog(enum criterion_logging_level level, const char *msg,
|
||||||
|
|
||||||
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
|
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
|
||||||
|
|
||||||
auto logger = villas::logging.get("criterion");
|
auto logger = villas::Log::get("criterion");
|
||||||
logger->info(formatted_msg);
|
logger->info(formatted_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void criterion_plog(enum criterion_logging_level level,
|
||||||
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
|
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
auto logger = villas::logging.get("criterion");
|
auto logger = villas::Log::get("criterion");
|
||||||
|
|
||||||
if (strstr(formatted_msg, "Warning"))
|
if (strstr(formatted_msg, "Warning"))
|
||||||
logger->warn(formatted_msg);
|
logger->warn(formatted_msg);
|
||||||
|
|
|
@ -35,7 +35,7 @@ static bool suite_enabled(struct criterion_test_set *tests, const char *name) {
|
||||||
// Limit number of parallel jobs to 1 in case we use the FPGA
|
// Limit number of parallel jobs to 1 in case we use the FPGA
|
||||||
ReportHook(PRE_ALL)(struct criterion_test_set *tests) {
|
ReportHook(PRE_ALL)(struct criterion_test_set *tests) {
|
||||||
if (suite_enabled(tests, "fpga")) {
|
if (suite_enabled(tests, "fpga")) {
|
||||||
auto logger = villas::logging.get("unittest");
|
auto logger = villas::Log::get("unittest");
|
||||||
|
|
||||||
logger->info("FPGA tests enabled. Only 1 job is executed in parallel!.");
|
logger->info("FPGA tests enabled. Only 1 job is executed in parallel!.");
|
||||||
criterion_options.jobs = 1;
|
criterion_options.jobs = 1;
|
||||||
|
|
|
@ -29,7 +29,7 @@ using namespace villas::fpga::ip;
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, rtds, .description = "RTDS") {
|
Test(fpga, rtds, .description = "RTDS") {
|
||||||
auto logger = villas::logging.get("unit-test:rtds");
|
auto logger = villas::Log::get("unit-test:rtds");
|
||||||
|
|
||||||
std::list<villas::fpga::ip::RtdsGtfpga *> rtdsIps;
|
std::list<villas::fpga::ip::RtdsGtfpga *> rtdsIps;
|
||||||
std::list<villas::fpga::ip::Dma *> dmaIps;
|
std::list<villas::fpga::ip::Dma *> dmaIps;
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void dumpMem(const uint32_t *addr, size_t len) {
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, rtds2gpu_loopback_dma, .description = "Rtds2Gpu") {
|
Test(fpga, rtds2gpu_loopback_dma, .description = "Rtds2Gpu") {
|
||||||
auto logger = logging.get("unit-test:rtds2gpu");
|
auto logger = Log::get("unit-test:rtds2gpu");
|
||||||
|
|
||||||
for (auto &ip : state.cards.front()->ips) {
|
for (auto &ip : state.cards.front()->ips) {
|
||||||
if (*ip != fpga::Vlnv("acs.eonerc.rwth-aachen.de:hls:rtds2gpu:"))
|
if (*ip != fpga::Vlnv("acs.eonerc.rwth-aachen.de:hls:rtds2gpu:"))
|
||||||
|
@ -158,7 +158,7 @@ Test(fpga, rtds2gpu_loopback_dma, .description = "Rtds2Gpu") {
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, rtds2gpu_rtt_cpu, .description = "Rtds2Gpu RTT via CPU") {
|
Test(fpga, rtds2gpu_rtt_cpu, .description = "Rtds2Gpu RTT via CPU") {
|
||||||
auto logger = logging.get("unit-test:rtds2gpu");
|
auto logger = Log::get("unit-test:rtds2gpu");
|
||||||
|
|
||||||
// Collect neccessary IPs
|
// Collect neccessary IPs
|
||||||
auto gpu2rtds = std::dynamic_pointer_cast<fpga::ip::Gpu2Rtds>(
|
auto gpu2rtds = std::dynamic_pointer_cast<fpga::ip::Gpu2Rtds>(
|
||||||
|
@ -233,7 +233,7 @@ void gpu_rtds_rtt_stop();
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, rtds2gpu_rtt_gpu, .description = "Rtds2Gpu RTT via GPU") {
|
Test(fpga, rtds2gpu_rtt_gpu, .description = "Rtds2Gpu RTT via GPU") {
|
||||||
auto logger = logging.get("unit-test:rtds2gpu");
|
auto logger = Log::get("unit-test:rtds2gpu");
|
||||||
|
|
||||||
// Collect neccessary IPs
|
// Collect neccessary IPs
|
||||||
auto gpu2rtds = std::dynamic_pointer_cast<fpga::ip::Gpu2Rtds>(
|
auto gpu2rtds = std::dynamic_pointer_cast<fpga::ip::Gpu2Rtds>(
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Test(fpga, timer, .description = "Timer Counter") {
|
Test(fpga, timer, .description = "Timer Counter") {
|
||||||
auto logger = villas::logging.get("unit-test:timer");
|
auto logger = villas::Log::get("unit-test:timer");
|
||||||
|
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
for (auto &ip : state.cards.front()->ips) {
|
for (auto &ip : state.cards.front()->ips) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ InvalidMethod::InvalidMethod(Request *req)
|
||||||
Session::methodToString(req->method)) {}
|
Session::methodToString(req->method)) {}
|
||||||
|
|
||||||
Api::Api(SuperNode *sn)
|
Api::Api(SuperNode *sn)
|
||||||
: logger(logging.get("api")), state(State::INITIALIZED), super_node(sn) {}
|
: logger(Log::get("api")), state(State::INITIALIZED), super_node(sn) {}
|
||||||
|
|
||||||
Api::~Api() {
|
Api::~Api() {
|
||||||
if (state == State::STARTED)
|
if (state == State::STARTED)
|
||||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
||||||
|
|
||||||
const char *argv[] = {"villas-node", cfg, nullptr};
|
const char *argv[] = {"villas-node", cfg, nullptr};
|
||||||
|
|
||||||
Logger logger = logging.get("api:restart");
|
Logger logger = Log::get("api:restart");
|
||||||
|
|
||||||
if (cfg)
|
if (cfg)
|
||||||
logger->info("Restarting instance: config={}", cfg);
|
logger->info("Restarting instance: config={}", cfg);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
using namespace villas::node::api;
|
using namespace villas::node::api;
|
||||||
|
|
||||||
Response::Response(Session *s, int c, const std::string &ct, const Buffer &b)
|
Response::Response(Session *s, int c, const std::string &ct, const Buffer &b)
|
||||||
: session(s), logger(logging.get("api:response")), buffer(b), code(c),
|
: session(s), logger(Log::get("api:response")), buffer(b), code(c),
|
||||||
contentType(ct),
|
contentType(ct),
|
||||||
headers{{"Server:", HTTP_USER_AGENT},
|
headers{{"Server:", HTTP_USER_AGENT},
|
||||||
{"Access-Control-Allow-Origin:", "*"},
|
{"Access-Control-Allow-Origin:", "*"},
|
||||||
|
|
|
@ -21,7 +21,7 @@ using namespace villas::node;
|
||||||
using namespace villas::node::api;
|
using namespace villas::node::api;
|
||||||
|
|
||||||
Session::Session(lws *w)
|
Session::Session(lws *w)
|
||||||
: version(Version::VERSION_2), wsi(w), logger(logging.get("api:session")) {
|
: version(Version::VERSION_2), wsi(w), logger(Log::get("api:session")) {
|
||||||
lws_context *ctx = lws_get_context(wsi);
|
lws_context *ctx = lws_get_context(wsi);
|
||||||
void *user_ctx = lws_context_user(ctx);
|
void *user_ctx = lws_context_user(ctx);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
using namespace villas;
|
using namespace villas;
|
||||||
using namespace villas::node;
|
using namespace villas::node;
|
||||||
|
|
||||||
Config::Config() : logger(logging.get("config")), root(nullptr) {}
|
Config::Config() : logger(Log::get("config")), root(nullptr) {}
|
||||||
|
|
||||||
Config::Config(const std::string &u) : Config() { root = load(u); }
|
Config::Config(const std::string &u) : Config() { root = load(u); }
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ using namespace villas::node;
|
||||||
|
|
||||||
Dumper::Dumper()
|
Dumper::Dumper()
|
||||||
: active(false), socketFd(0), socketPath(""), supressRepeatedWarning(true),
|
: active(false), socketFd(0), socketPath(""), supressRepeatedWarning(true),
|
||||||
warningCounter(0), logger(logging.get("dumper")) {}
|
warningCounter(0), logger(Log::get("dumper")) {}
|
||||||
|
|
||||||
Dumper::~Dumper() { closeSocket(); }
|
Dumper::~Dumper() { closeSocket(); }
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ using namespace villas;
|
||||||
using namespace villas::node;
|
using namespace villas::node;
|
||||||
|
|
||||||
Hook::Hook(Path *p, Node *n, int fl, int prio, bool en)
|
Hook::Hook(Path *p, Node *n, int fl, int prio, bool en)
|
||||||
: logger(logging.get("hook")), factory(nullptr),
|
: logger(Log::get("hook")), factory(nullptr),
|
||||||
state(fl & (int)Hook::Flags::BUILTIN
|
state(fl & (int)Hook::Flags::BUILTIN
|
||||||
? State::CHECKED
|
? State::CHECKED
|
||||||
: State::INITIALIZED), // We dont need to parse builtin hooks
|
: State::INITIALIZED), // We dont need to parse builtin hooks
|
||||||
|
|
|
@ -32,7 +32,7 @@ using namespace villas::kernel;
|
||||||
|
|
||||||
Interface::Interface(struct rtnl_link *link, int aff)
|
Interface::Interface(struct rtnl_link *link, int aff)
|
||||||
: nl_link(link), tc_qdisc(nullptr), affinity(aff) {
|
: nl_link(link), tc_qdisc(nullptr), affinity(aff) {
|
||||||
logger = logging.get(fmt::format("kernel:if:{}", getName()));
|
logger = Log::get(fmt::format("kernel:if:{}", getName()));
|
||||||
|
|
||||||
int n = getIRQs();
|
int n = getIRQs();
|
||||||
if (n)
|
if (n)
|
||||||
|
@ -118,7 +118,7 @@ std::string Interface::getName() const {
|
||||||
Interface *Interface::getEgress(struct sockaddr *sa, SuperNode *sn) {
|
Interface *Interface::getEgress(struct sockaddr *sa, SuperNode *sn) {
|
||||||
struct rtnl_link *link;
|
struct rtnl_link *link;
|
||||||
|
|
||||||
Logger logger = logging.get("kernel:if");
|
Logger logger = Log::get("kernel:if");
|
||||||
|
|
||||||
auto &interfaces = sn->getInterfaces();
|
auto &interfaces = sn->getInterfaces();
|
||||||
auto affinity = sn->getAffinity();
|
auto affinity = sn->getAffinity();
|
||||||
|
|
|
@ -50,7 +50,7 @@ int villas::kernel::tc::prio(Interface *i, struct rtnl_qdisc **qd,
|
||||||
|
|
||||||
*qd = q;
|
*qd = q;
|
||||||
|
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->debug("Added prio qdisc with {} bands to interface '{}'", bands,
|
logger->debug("Added prio qdisc with {} bands to interface '{}'", bands,
|
||||||
rtnl_link_get_name(i->nl_link));
|
rtnl_link_get_name(i->nl_link));
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ int villas::kernel::tc::mark(Interface *i, struct rtnl_cls **cls,
|
||||||
|
|
||||||
*cls = c;
|
*cls = c;
|
||||||
|
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->debug("Added fwmark classifier with mark {} to interface '{}'", mark,
|
logger->debug("Added fwmark classifier with mark {} to interface '{}'", mark,
|
||||||
rtnl_link_get_name(i->nl_link));
|
rtnl_link_get_name(i->nl_link));
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ int villas::kernel::tc::netem(Interface *i, struct rtnl_qdisc **qd,
|
||||||
|
|
||||||
*qd = q;
|
*qd = q;
|
||||||
|
|
||||||
auto logger = logging.get("kernel");
|
auto logger = Log::get("kernel");
|
||||||
logger->debug("Added netem qdisc to interface '{}'",
|
logger->debug("Added netem qdisc to interface '{}'",
|
||||||
rtnl_link_get_name(i->nl_link));
|
rtnl_link_get_name(i->nl_link));
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ static Logger logger;
|
||||||
int villas::node::memory::init(int hugepages) {
|
int villas::node::memory::init(int hugepages) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
logger = logging.get("memory");
|
logger = Log::get("memory");
|
||||||
|
|
||||||
logger->info("Initialize memory sub-system: #hugepages={}", hugepages);
|
logger->info("Initialize memory sub-system: #hugepages={}", hugepages);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ static struct Allocation *ib_alloc(size_t len, size_t alignment,
|
||||||
ma->address = ma->parent->address;
|
ma->address = ma->parent->address;
|
||||||
|
|
||||||
if (!mi->pd) {
|
if (!mi->pd) {
|
||||||
auto logger = logging.get("memory:ib");
|
auto logger = Log::get("memory:ib");
|
||||||
logger->error("Protection domain is not registered!");
|
logger->error("Protection domain is not registered!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ struct Type *villas::node::memory::managed(void *ptr, size_t len) {
|
||||||
char *cptr = (char *)ptr;
|
char *cptr = (char *)ptr;
|
||||||
|
|
||||||
if (len < sizeof(struct Type) + sizeof(struct Block)) {
|
if (len < sizeof(struct Type) + sizeof(struct Block)) {
|
||||||
auto logger = logging.get("memory:managed");
|
auto logger = Log::get("memory:managed");
|
||||||
logger->info("Passed region is too small");
|
logger->info("Passed region is too small");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ static size_t hugepgsz = -1;
|
||||||
static Logger logger;
|
static Logger logger;
|
||||||
|
|
||||||
int villas::node::memory::mmap_init(int hugepages) {
|
int villas::node::memory::mmap_init(int hugepages) {
|
||||||
logger = logging.get("memory:mmap");
|
logger = Log::get("memory:mmap");
|
||||||
|
|
||||||
pgsz = kernel::getPageSize();
|
pgsz = kernel::getPageSize();
|
||||||
if (pgsz < 0)
|
if (pgsz < 0)
|
||||||
|
|
|
@ -40,7 +40,7 @@ using namespace villas::node;
|
||||||
using namespace villas::utils;
|
using namespace villas::utils;
|
||||||
|
|
||||||
Node::Node(const uuid_t &id, const std::string &name)
|
Node::Node(const uuid_t &id, const std::string &name)
|
||||||
: logger(logging.get("node")), sequence_init(0), sequence(0),
|
: logger(Log::get("node")), sequence_init(0), sequence(0),
|
||||||
in(NodeDirection::Direction::IN, this),
|
in(NodeDirection::Direction::IN, this),
|
||||||
out(NodeDirection::Direction::OUT, this), configPath(),
|
out(NodeDirection::Direction::OUT, this), configPath(),
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
|
@ -37,7 +37,7 @@ int NodeList::parse(json_t *json, NodeList &all) {
|
||||||
size_t index;
|
size_t index;
|
||||||
json_t *elm;
|
json_t *elm;
|
||||||
|
|
||||||
auto logger = logging.get("node");
|
auto logger = Log::get("node");
|
||||||
|
|
||||||
switch (json_typeof(json)) {
|
switch (json_typeof(json)) {
|
||||||
case JSON_STRING:
|
case JSON_STRING:
|
||||||
|
|
|
@ -125,7 +125,7 @@ int villas::node::ethercat_type_start(villas::node::SuperNode *sn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int villas::node::ethercat_type_stop() {
|
int villas::node::ethercat_type_stop() {
|
||||||
auto logger = logging.get("node:ethercat");
|
auto logger = Log::get("node:ethercat");
|
||||||
|
|
||||||
logger->info("Releasing EtherCAT master");
|
logger->info("Releasing EtherCAT master");
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ int villas::node::kafka_stop(NodeCompat *n) {
|
||||||
int villas::node::kafka_type_start(villas::node::SuperNode *sn) {
|
int villas::node::kafka_type_start(villas::node::SuperNode *sn) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
logger = logging.get("node:kafka");
|
logger = Log::get("node:kafka");
|
||||||
|
|
||||||
ret = list_init(&clients);
|
ret = list_init(&clients);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -35,7 +35,7 @@ InternalLoopbackNode::InternalLoopbackNode(Node *src, unsigned id, unsigned ql)
|
||||||
|
|
||||||
auto logger_name = fmt::format("node:{}", getNameShort());
|
auto logger_name = fmt::format("node:{}", getNameShort());
|
||||||
|
|
||||||
logger = logging.get(logger_name);
|
logger = Log::get(logger_name);
|
||||||
|
|
||||||
in.signals = source->getInputSignals(false);
|
in.signals = source->getInputSignals(false);
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ int villas::node::mqtt_type_start(villas::node::SuperNode *sn) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mosquitto_error:
|
mosquitto_error:
|
||||||
auto logger = logging.get("node:mqtt");
|
auto logger = Log::get("node:mqtt");
|
||||||
logger->warn("{}", mosquitto_strerror(ret));
|
logger->warn("{}", mosquitto_strerror(ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -428,7 +428,7 @@ int villas::node::mqtt_type_stop() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mosquitto_error:
|
mosquitto_error:
|
||||||
auto logger = logging.get("node:mqtt");
|
auto logger = Log::get("node:mqtt");
|
||||||
logger->warn("{}", mosquitto_strerror(ret));
|
logger->warn("{}", mosquitto_strerror(ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -41,7 +41,7 @@ using namespace villas::utils;
|
||||||
static pthread_mutex_t *mutex_buf = NULL;
|
static pthread_mutex_t *mutex_buf = NULL;
|
||||||
|
|
||||||
static void handle_error(const char *file, int lineno, const char *msg) {
|
static void handle_error(const char *file, int lineno, const char *msg) {
|
||||||
auto logger = logging.get("curl");
|
auto logger = Log::get("curl");
|
||||||
|
|
||||||
logger->error("** {}:{} {}", file, lineno, msg);
|
logger->error("** {}:{} {}", file, lineno, msg);
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ int villas::node::ngsi_type_start(villas::node::SuperNode *sn) {
|
||||||
CRYPTO_set_id_callback(curl_ssl_thread_id_function);
|
CRYPTO_set_id_callback(curl_ssl_thread_id_function);
|
||||||
CRYPTO_set_locking_callback(curl_ssl_locking_function);
|
CRYPTO_set_locking_callback(curl_ssl_locking_function);
|
||||||
|
|
||||||
auto logger = logging.get("curl");
|
auto logger = Log::get("curl");
|
||||||
logger->info("Setup libcurl/openssl locking primitives");
|
logger->info("Setup libcurl/openssl locking primitives");
|
||||||
#endif // CURL_SSL_REQUIRES_LOCKING
|
#endif // CURL_SSL_REQUIRES_LOCKING
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ int villas::node::opal_type_start(villas::node::SuperNode *sn) {
|
||||||
if (err != EOK)
|
if (err != EOK)
|
||||||
throw RuntimeError("Failed to get list of recv ids ({})", err);
|
throw RuntimeError("Failed to get list of recv ids ({})", err);
|
||||||
|
|
||||||
auto logger = logging.get("node:opal");
|
auto logger = Log::get("node:opal");
|
||||||
logger->info("Started as OPAL Asynchronous process");
|
logger->info("Started as OPAL Asynchronous process");
|
||||||
logger->info("This is VILLASnode %s (built on %s, %s)", PROJECT_BUILD_ID,
|
logger->info("This is VILLASnode %s (built on %s, %s)", PROJECT_BUILD_ID,
|
||||||
__DATE__, __TIME__);
|
__DATE__, __TIME__);
|
||||||
|
@ -141,7 +141,7 @@ int villas::node::opal_type_stop() {
|
||||||
if (err != EOK)
|
if (err != EOK)
|
||||||
throw RuntimeError("Failed to close shared memory area ({})", err);
|
throw RuntimeError("Failed to close shared memory area ({})", err);
|
||||||
|
|
||||||
auto logger = logging.get("node:opal");
|
auto logger = Log::get("node:opal");
|
||||||
logger->debug("Closing OPAL shared memory mapping");
|
logger->debug("Closing OPAL shared memory mapping");
|
||||||
|
|
||||||
err = OpalSystemCtrl_UnRegister((char *)printShmemName.c_str());
|
err = OpalSystemCtrl_UnRegister((char *)printShmemName.c_str());
|
||||||
|
@ -155,7 +155,7 @@ int villas::node::opal_type_stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opal_print_global() {
|
static int opal_print_global() {
|
||||||
auto logger = logging.get("node:opal");
|
auto logger = Log::get("node:opal");
|
||||||
logger->debug("Controller ID: {}", params.controllerID);
|
logger->debug("Controller ID: {}", params.controllerID);
|
||||||
|
|
||||||
std::stringstream sss, rss;
|
std::stringstream sss, rss;
|
||||||
|
|
|
@ -35,7 +35,7 @@ static std::unordered_map<sw::redis::ConnectionOptions, RedisConnection *>
|
||||||
|
|
||||||
RedisConnection::RedisConnection(const sw::redis::ConnectionOptions &opts)
|
RedisConnection::RedisConnection(const sw::redis::ConnectionOptions &opts)
|
||||||
: context(opts), subscriber(context.subscriber()),
|
: context(opts), subscriber(context.subscriber()),
|
||||||
logger(logging.get("nodes:redis")) {
|
logger(Log::get("nodes:redis")) {
|
||||||
// Enable keyspace notifications
|
// Enable keyspace notifications
|
||||||
context.command("config", "set", "notify-keyspace-events", "K$h");
|
context.command("config", "set", "notify-keyspace-events", "K$h");
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static int rtp_aimd(NodeCompat *n, double loss_frac) {
|
||||||
int villas::node::rtp_init(NodeCompat *n) {
|
int villas::node::rtp_init(NodeCompat *n) {
|
||||||
auto *r = n->getData<struct rtp>();
|
auto *r = n->getData<struct rtp>();
|
||||||
|
|
||||||
n->logger = villas::logging.get("node:rtp");
|
n->logger = villas::Log::get("node:rtp");
|
||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
r->aimd.a = 10;
|
r->aimd.a = 10;
|
||||||
|
|
|
@ -168,7 +168,7 @@ bool TEMPer1Device::match(struct libusb_device *dev) {
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
int ret = libusb_get_device_descriptor(dev, &desc);
|
int ret = libusb_get_device_descriptor(dev, &desc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logging.get("node:temper")
|
Log::get("node:temper")
|
||||||
->warn("Could not get USB device descriptor: {}",
|
->warn("Could not get USB device descriptor: {}",
|
||||||
libusb_strerror((enum libusb_error)ret));
|
libusb_strerror((enum libusb_error)ret));
|
||||||
return false;
|
return false;
|
||||||
|
@ -185,7 +185,7 @@ bool TEMPer2Device::match(struct libusb_device *dev) {
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
ret = libusb_get_device_descriptor(dev, &desc);
|
ret = libusb_get_device_descriptor(dev, &desc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logging.get("node:temper")
|
Log::get("node:temper")
|
||||||
->warn("Could not get USB device descriptor: {}",
|
->warn("Could not get USB device descriptor: {}",
|
||||||
libusb_strerror((enum libusb_error)ret));
|
libusb_strerror((enum libusb_error)ret));
|
||||||
return false;
|
return false;
|
||||||
|
@ -193,7 +193,7 @@ bool TEMPer2Device::match(struct libusb_device *dev) {
|
||||||
|
|
||||||
ret = libusb_open(dev, &handle);
|
ret = libusb_open(dev, &handle);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logging.get("node:temper")
|
Log::get("node:temper")
|
||||||
->warn("Failed to open USB device: {}",
|
->warn("Failed to open USB device: {}",
|
||||||
libusb_strerror((enum libusb_error)ret));
|
libusb_strerror((enum libusb_error)ret));
|
||||||
return false;
|
return false;
|
||||||
|
@ -202,7 +202,7 @@ bool TEMPer2Device::match(struct libusb_device *dev) {
|
||||||
ret = libusb_get_string_descriptor_ascii(handle, desc.iProduct, product,
|
ret = libusb_get_string_descriptor_ascii(handle, desc.iProduct, product,
|
||||||
sizeof(product));
|
sizeof(product));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logging.get("node:temper")
|
Log::get("node:temper")
|
||||||
->warn("Could not get USB string descriptor: {}",
|
->warn("Could not get USB string descriptor: {}",
|
||||||
libusb_strerror((enum libusb_error)ret));
|
libusb_strerror((enum libusb_error)ret));
|
||||||
return false;
|
return false;
|
||||||
|
@ -217,7 +217,7 @@ bool TEMPerHUMDevice::match(struct libusb_device *dev) {
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
int ret = libusb_get_device_descriptor(dev, &desc);
|
int ret = libusb_get_device_descriptor(dev, &desc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logging.get("node:temper")
|
Log::get("node:temper")
|
||||||
->warn("Could not get USB device descriptor: {}",
|
->warn("Could not get USB device descriptor: {}",
|
||||||
libusb_strerror((enum libusb_error)ret));
|
libusb_strerror((enum libusb_error)ret));
|
||||||
return false;
|
return false;
|
||||||
|
@ -229,7 +229,7 @@ bool TEMPerHUMDevice::match(struct libusb_device *dev) {
|
||||||
int villas::node::temper_type_start(villas::node::SuperNode *sn) {
|
int villas::node::temper_type_start(villas::node::SuperNode *sn) {
|
||||||
context = usb::get_context();
|
context = usb::get_context();
|
||||||
|
|
||||||
logger = logging.get("node:temper");
|
logger = Log::get("node:temper");
|
||||||
|
|
||||||
// Enumerate temper devices
|
// Enumerate temper devices
|
||||||
devices.clear();
|
devices.clear();
|
||||||
|
|
|
@ -194,7 +194,7 @@ int villas::node::uldaq_type_start(villas::node::SuperNode *sn) {
|
||||||
if (err != ERR_NO_ERROR)
|
if (err != ERR_NO_ERROR)
|
||||||
throw RuntimeError("Failed to retrieve DAQ device list");
|
throw RuntimeError("Failed to retrieve DAQ device list");
|
||||||
|
|
||||||
auto logger = logging.get("node:uldaq");
|
auto logger = Log::get("node:uldaq");
|
||||||
logger->info("Found {} DAQ devices", num_devs);
|
logger->info("Found {} DAQ devices", num_devs);
|
||||||
for (unsigned i = 0; i < num_devs; i++) {
|
for (unsigned i = 0; i < num_devs; i++) {
|
||||||
DaqDeviceDescriptor *desc = &descriptors[i];
|
DaqDeviceDescriptor *desc = &descriptors[i];
|
||||||
|
|
|
@ -32,7 +32,7 @@ PeerConnection::PeerConnection(const std::string &server,
|
||||||
rtc::DataChannelInit d)
|
rtc::DataChannelInit d)
|
||||||
: web(w), extraServers({}), dataChannelInit(d), defaultConfig(cfg),
|
: web(w), extraServers({}), dataChannelInit(d), defaultConfig(cfg),
|
||||||
conn(nullptr), chan(nullptr), out_signals(out_signals),
|
conn(nullptr), chan(nullptr), out_signals(out_signals),
|
||||||
logger(logging.get("webrtc:pc")), stopStartup(false),
|
logger(Log::get("webrtc:pc")), stopStartup(false),
|
||||||
warnNotConnected(false), standby(true), first(false), firstID(INT_MAX),
|
warnNotConnected(false), standby(true), first(false), firstID(INT_MAX),
|
||||||
secondID(INT_MAX), onMessageCallback(nullptr) {
|
secondID(INT_MAX), onMessageCallback(nullptr) {
|
||||||
client = std::make_shared<SignalingClient>(server, session, peer, web);
|
client = std::make_shared<SignalingClient>(server, session, peer, web);
|
||||||
|
|
|
@ -24,7 +24,7 @@ SignalingClient::SignalingClient(const std::string &server,
|
||||||
const std::string &session,
|
const std::string &session,
|
||||||
const std::string &peer, Web *w)
|
const std::string &peer, Web *w)
|
||||||
: retry_count(0), web(w), running(false),
|
: retry_count(0), web(w), running(false),
|
||||||
logger(logging.get("webrtc:signal")) {
|
logger(Log::get("webrtc:signal")) {
|
||||||
int ret;
|
int ret;
|
||||||
const char *prot, *a, *p;
|
const char *prot, *a, *p;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ static std::list<struct websocket_connection *>
|
||||||
static std::mutex connections_lock;
|
static std::mutex connections_lock;
|
||||||
|
|
||||||
static villas::node::Web *web;
|
static villas::node::Web *web;
|
||||||
static villas::Logger logger = logging.get("websocket");
|
static villas::Logger logger = Log::get("websocket");
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
static NodeCompatType p;
|
static NodeCompatType p;
|
||||||
|
|
|
@ -113,7 +113,7 @@ Path::Path()
|
||||||
rate(0), // Disabled
|
rate(0), // Disabled
|
||||||
affinity(0), enabled(true), poll(-1), reversed(false), builtin(true),
|
affinity(0), enabled(true), poll(-1), reversed(false), builtin(true),
|
||||||
original_sequence_no(-1), queuelen(DEFAULT_QUEUE_LENGTH),
|
original_sequence_no(-1), queuelen(DEFAULT_QUEUE_LENGTH),
|
||||||
logger(logging.get(fmt::format("path:{}", id++))) {
|
logger(Log::get(fmt::format("path:{}", id++))) {
|
||||||
uuid_clear(uuid);
|
uuid_clear(uuid);
|
||||||
|
|
||||||
pool.state = State::DESTROYED;
|
pool.state = State::DESTROYED;
|
||||||
|
|
|
@ -17,7 +17,7 @@ using namespace villas;
|
||||||
int villas::node::pool_init(struct Pool *p, size_t cnt, size_t blocksz,
|
int villas::node::pool_init(struct Pool *p, size_t cnt, size_t blocksz,
|
||||||
struct memory::Type *m) {
|
struct memory::Type *m) {
|
||||||
int ret;
|
int ret;
|
||||||
auto logger = logging.get("pool");
|
auto logger = Log::get("pool");
|
||||||
|
|
||||||
// Make sure that we use a block size that is aligned to the size of a cache line
|
// Make sure that we use a block size that is aligned to the size of a cache line
|
||||||
p->alignment = kernel::getCachelineSize();
|
p->alignment = kernel::getCachelineSize();
|
||||||
|
|
|
@ -46,7 +46,7 @@ int villas::node::queue_init(struct CQueue *q, size_t size,
|
||||||
size_t old_size = size;
|
size_t old_size = size;
|
||||||
size = LOG2_CEIL(size);
|
size = LOG2_CEIL(size);
|
||||||
|
|
||||||
auto logger = logging.get("queue");
|
auto logger = Log::get("queue");
|
||||||
logger->warn("A queue size was changed from {} to {}", old_size, size);
|
logger->warn("A queue size was changed from {} to {}", old_size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ enum Stats::Type Stats::lookupType(const std::string &str) {
|
||||||
throw std::invalid_argument("Invalid stats type");
|
throw std::invalid_argument("Invalid stats type");
|
||||||
}
|
}
|
||||||
|
|
||||||
Stats::Stats(int buckets, int warmup) : logger(logging.get("stats")) {
|
Stats::Stats(int buckets, int warmup) : logger(Log::get("stats")) {
|
||||||
for (auto m : metrics) {
|
for (auto m : metrics) {
|
||||||
histograms.emplace(std::piecewise_construct, std::forward_as_tuple(m.first),
|
histograms.emplace(std::piecewise_construct, std::forward_as_tuple(m.first),
|
||||||
std::forward_as_tuple(buckets, warmup));
|
std::forward_as_tuple(buckets, warmup));
|
||||||
|
@ -133,7 +133,7 @@ void Stats::printHeader(enum Format fmt) {
|
||||||
|
|
||||||
void Stats::setupTable() {
|
void Stats::setupTable() {
|
||||||
if (!table) {
|
if (!table) {
|
||||||
auto logger = logging.get("stats");
|
auto logger = Log::get("stats");
|
||||||
table = std::make_shared<Table>(logger, columns);
|
table = std::make_shared<Table>(logger, columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ SuperNode::SuperNode()
|
||||||
kernel::nl::init(); // Fill link cache
|
kernel::nl::init(); // Fill link cache
|
||||||
#endif // WITH_NETEM
|
#endif // WITH_NETEM
|
||||||
|
|
||||||
logger = logging.get("super_node");
|
logger = Log::get("super_node");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SuperNode::parse(const std::string &u) {
|
void SuperNode::parse(const std::string &u) {
|
||||||
|
@ -111,7 +111,7 @@ void SuperNode::parse(json_t *root) {
|
||||||
#endif // WITH_WEB
|
#endif // WITH_WEB
|
||||||
|
|
||||||
if (json_logging)
|
if (json_logging)
|
||||||
logging.parse(json_logging);
|
Log::getInstance().parse(json_logging);
|
||||||
|
|
||||||
// Parse nodes
|
// Parse nodes
|
||||||
if (json_nodes) {
|
if (json_nodes) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct libusb_context *villas::usb::init() {
|
||||||
int ret;
|
int ret;
|
||||||
struct libusb_context *ctx;
|
struct libusb_context *ctx;
|
||||||
|
|
||||||
logger = logging.get("usb");
|
logger = Log::get("usb");
|
||||||
|
|
||||||
ret = libusb_init(&ctx);
|
ret = libusb_init(&ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -101,7 +101,7 @@ void Web::lwsLogger(int lws_lvl, const char *msg) {
|
||||||
if (strstr(msg, "Unable to open") == msg)
|
if (strstr(msg, "Unable to open") == msg)
|
||||||
lws_lvl = LLL_WARN;
|
lws_lvl = LLL_WARN;
|
||||||
|
|
||||||
Logger logger = logging.get("lws");
|
Logger logger = Log::get("lws");
|
||||||
|
|
||||||
switch (lws_lvl) {
|
switch (lws_lvl) {
|
||||||
case LLL_ERR:
|
case LLL_ERR:
|
||||||
|
@ -162,9 +162,9 @@ void Web::worker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Web::Web(Api *a)
|
Web::Web(Api *a)
|
||||||
: state(State::INITIALIZED), logger(logging.get("web")), context(nullptr),
|
: state(State::INITIALIZED), logger(Log::get("web")), context(nullptr),
|
||||||
vhost(nullptr), port(getuid() > 0 ? 8080 : 80), api(a) {
|
vhost(nullptr), port(getuid() > 0 ? 8080 : 80), api(a) {
|
||||||
lws_set_log_level(lwsLogLevel(logging.getLevel()), lwsLogger);
|
lws_set_log_level(lwsLogLevel(Log::getInstance().getLevel()), lwsLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
Web::~Web() {
|
Web::~Web() {
|
||||||
|
|
|
@ -165,7 +165,7 @@ protected:
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
|
@ -88,7 +88,7 @@ protected:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
|
@ -144,7 +144,7 @@ protected:
|
||||||
goto check;
|
goto check;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
|
|
|
@ -155,7 +155,7 @@ protected:
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
: node(n), formatter(fmt), stop(false), enabled(en), limit(lim),
|
: node(n), formatter(fmt), stop(false), enabled(en), limit(lim),
|
||||||
count(0) {
|
count(0) {
|
||||||
auto loggerName = fmt::format("pipe:{}", name);
|
auto loggerName = fmt::format("pipe:{}", name);
|
||||||
logger = logging.get(loggerName);
|
logger = Log::get(loggerName);
|
||||||
|
|
||||||
// Initialize memory
|
// Initialize memory
|
||||||
unsigned pool_size =
|
unsigned pool_size =
|
||||||
|
@ -372,7 +372,7 @@ protected:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -404,7 +404,7 @@ protected:
|
||||||
json_t *json_format;
|
json_t *json_format;
|
||||||
json_error_t err;
|
json_error_t err;
|
||||||
|
|
||||||
logger->info("Logging level: {}", logging.getLevelName());
|
logger->info("Logging level: {}", Log::getInstance().getLevelName());
|
||||||
|
|
||||||
if (!uri.empty())
|
if (!uri.empty())
|
||||||
sn.parse(uri);
|
sn.parse(uri);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace tools {
|
||||||
RelaySession::RelaySession(Relay *r, Identifier sid)
|
RelaySession::RelaySession(Relay *r, Identifier sid)
|
||||||
: identifier(sid), connects(0) {
|
: identifier(sid), connects(0) {
|
||||||
auto loggerName = fmt::format("relay:{}", sid);
|
auto loggerName = fmt::format("relay:{}", sid);
|
||||||
logger = villas::logging.get(loggerName);
|
logger = villas::Log::get(loggerName);
|
||||||
|
|
||||||
logger->info("Session created: {}", identifier);
|
logger->info("Session created: {}", identifier);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ RelaySession *RelaySession::get(Relay *r, lws *wsi) {
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
} else {
|
} else {
|
||||||
auto logger = logging.get("villas-relay");
|
auto logger = Log::get("villas-relay");
|
||||||
logger->info("Found existing session: {}", sid);
|
logger->info("Found existing session: {}", sid);
|
||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
|
@ -198,7 +198,8 @@ Relay::Relay(int argc, char *argv[])
|
||||||
throw RuntimeError("Failed to initialize memory");
|
throw RuntimeError("Failed to initialize memory");
|
||||||
|
|
||||||
// Initialize logging
|
// Initialize logging
|
||||||
lws_set_log_level(Web::lwsLogLevel(logging.getLevel()), Web::lwsLogger);
|
lws_set_log_level(Web::lwsLogLevel(Log::getInstance().getLevel()),
|
||||||
|
Web::lwsLogger);
|
||||||
|
|
||||||
protocols = {{.name = "http",
|
protocols = {{.name = "http",
|
||||||
.callback = lws_callback_http_dummy,
|
.callback = lws_callback_http_dummy,
|
||||||
|
@ -354,8 +355,9 @@ void Relay::parse() {
|
||||||
while ((c = getopt(argc, argv, "hVp:P:ld:u:")) != -1) {
|
while ((c = getopt(argc, argv, "hVp:P:ld:u:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
lws_set_log_level(Web::lwsLogLevel(logging.getLevel()), Web::lwsLogger);
|
lws_set_log_level(Web::lwsLogLevel(Log::getInstance().getLevel()),
|
||||||
|
Web::lwsLogger);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -422,7 +424,7 @@ int Relay::main() {
|
||||||
ctx_info.mounts = &mount;
|
ctx_info.mounts = &mount;
|
||||||
ctx_info.user = (void *)this;
|
ctx_info.user = (void *)this;
|
||||||
|
|
||||||
auto lwsLogger = logging.get("lws");
|
auto lwsLogger = Log::get("lws");
|
||||||
|
|
||||||
context = lws_create_context(&ctx_info);
|
context = lws_create_context(&ctx_info);
|
||||||
if (context == nullptr) {
|
if (context == nullptr) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ protected:
|
||||||
goto check;
|
goto check;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
logging.setLevel(optarg);
|
Log::getInstance().setLevel(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
|
|
|
@ -240,7 +240,7 @@ ParameterizedTest(Param *p, format, lowlevel, .init = init_memory) {
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
size_t wbytes, rbytes;
|
size_t wbytes, rbytes;
|
||||||
|
|
||||||
Logger logger = logging.get("test:format:lowlevel");
|
Logger logger = Log::get("test:format:lowlevel");
|
||||||
|
|
||||||
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
|
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ ParameterizedTest(Param *p, format, highlevel, .init = init_memory) {
|
||||||
int ret, cnt;
|
int ret, cnt;
|
||||||
char *retp;
|
char *retp;
|
||||||
|
|
||||||
Logger logger = logging.get("test:format:highlevel");
|
Logger logger = Log::get("test:format:highlevel");
|
||||||
|
|
||||||
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
|
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ ParameterizedTest(struct param *p, pool, basic, .init = init_memory) {
|
||||||
struct Pool pool;
|
struct Pool pool;
|
||||||
void *ptr, *ptrs[p->pool_size];
|
void *ptr, *ptrs[p->pool_size];
|
||||||
|
|
||||||
logging.setLevel("trace");
|
Log::getInstance().setLevel("trace");
|
||||||
|
|
||||||
if (!utils::isPrivileged() && p->mt == &memory::mmap_hugetlb)
|
if (!utils::isPrivileged() && p->mt == &memory::mmap_hugetlb)
|
||||||
cr_skip_test("Skipping memory_mmap_hugetlb tests allocatpr because we are "
|
cr_skip_test("Skipping memory_mmap_hugetlb tests allocatpr because we are "
|
||||||
|
|
|
@ -260,7 +260,7 @@ ParameterizedTest(struct param *p, queue, multi_threaded, .timeout = 20,
|
||||||
int ret, cycpop;
|
int ret, cycpop;
|
||||||
struct Tsc tsc;
|
struct Tsc tsc;
|
||||||
|
|
||||||
Logger logger = logging.get("test:queue:multi_threaded");
|
Logger logger = Log::get("test:queue:multi_threaded");
|
||||||
|
|
||||||
if (!utils::isPrivileged() && p->mt == &memory::mmap_hugetlb)
|
if (!utils::isPrivileged() && p->mt == &memory::mmap_hugetlb)
|
||||||
cr_skip_test("Skipping memory_mmap_hugetlb tests allocatpr because we are "
|
cr_skip_test("Skipping memory_mmap_hugetlb tests allocatpr because we are "
|
||||||
|
|
Loading…
Add table
Reference in a new issue