mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
ShmMonitor: Use FairLogger for timestamp calculation
This commit is contained in:
parent
be8ab06cc1
commit
86a1dd38a2
|
@ -380,6 +380,7 @@ if(BUILD_FAIRMQ)
|
||||||
Boost::boost
|
Boost::boost
|
||||||
Boost::date_time
|
Boost::date_time
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
|
FairLogger::FairLogger
|
||||||
PicoSHA2
|
PicoSHA2
|
||||||
)
|
)
|
||||||
target_include_directories(fairmq-shmmonitor PUBLIC
|
target_include_directories(fairmq-shmmonitor PUBLIC
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#include <fairmq/Tools.h>
|
#include <fairmq/Tools.h>
|
||||||
|
#include <fairlogger/Logger.h>
|
||||||
|
|
||||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||||
#include <boost/interprocess/file_mapping.hpp>
|
#include <boost/interprocess/file_mapping.hpp>
|
||||||
|
@ -79,6 +80,10 @@ Monitor::Monitor(const string& shmId, bool selfDestruct, bool interactive, bool
|
||||||
throw DaemonPresent(tools::ToString("fairmq-shmmonitor for shared memory id ", fShmId, " already started or not properly exited."));
|
throw DaemonPresent(tools::ToString("fairmq-shmmonitor for shared memory id ", fShmId, " already started or not properly exited."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::SetConsoleColor(false);
|
||||||
|
Logger::DefineVerbosity(Verbosity::user1, VerbositySpec::Make(VerbositySpec::Info::timestamp_us));
|
||||||
|
Logger::SetVerbosity(Verbosity::verylow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Monitor::CatchSignals()
|
void Monitor::CatchSignals()
|
||||||
|
@ -309,17 +314,10 @@ void Monitor::CheckSegment()
|
||||||
<< setw(10) << (fViewOnly ? "view only" : to_string(duration)) << " |"
|
<< setw(10) << (fViewOnly ? "view only" : to_string(duration)) << " |"
|
||||||
<< c << flush;
|
<< c << flush;
|
||||||
} else if (fViewOnly) {
|
} else if (fViewOnly) {
|
||||||
time_t current = chrono::system_clock::to_time_t(now);
|
LOGV(info, user1) << "name: " << fSegmentName
|
||||||
chrono::milliseconds ms = chrono::duration_cast<chrono::milliseconds>(now.time_since_epoch());
|
<< ", size: " << segment.get_size()
|
||||||
struct tm local;
|
<< ", free: " << segment.get_free_memory()
|
||||||
localtime_r(¤t, &local);
|
<< ", numDevices: " << numDevices;
|
||||||
char timeBuffer[80];
|
|
||||||
size_t count = strftime(timeBuffer, 80, "%F %T", &local);
|
|
||||||
cout << (count != 0 ? timeBuffer : "") << "." << setfill('0') << setw(6) << ms.count() % 1000000
|
|
||||||
<< ", name: " << fSegmentName
|
|
||||||
<< ", size: " << segment.get_size()
|
|
||||||
<< ", free: " << segment.get_free_memory()
|
|
||||||
<< ", numDevices: " << numDevices << endl;
|
|
||||||
}
|
}
|
||||||
} catch (bie&) {
|
} catch (bie&) {
|
||||||
fHeartbeatTriggered = false;
|
fHeartbeatTriggered = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user