mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
shmem: introduce FairMQShmMonitor.
This commit is contained in:
committed by
Mohammad Al-Turany
parent
7b4a2ae932
commit
2a526b8625
55
fairmq/shmem/FairMQShmMonitor.h
Normal file
55
fairmq/shmem/FairMQShmMonitor.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/********************************************************************************
|
||||
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
#ifndef FAIRMQSHMMONITOR_H_
|
||||
#define FAIRMQSHMMONITOR_H_
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
|
||||
namespace fair
|
||||
{
|
||||
namespace mq
|
||||
{
|
||||
namespace shmem
|
||||
{
|
||||
|
||||
class Monitor
|
||||
{
|
||||
public:
|
||||
Monitor(const std::string& segmentName);
|
||||
Monitor(const Monitor&) = delete;
|
||||
Monitor operator=(const Monitor&) = delete;
|
||||
|
||||
void Run();
|
||||
|
||||
virtual ~Monitor() {}
|
||||
|
||||
private:
|
||||
void PrintHeader();
|
||||
void PrintHelp();
|
||||
void PrintQueues();
|
||||
void CloseMemory();
|
||||
void MonitorHeartbeats();
|
||||
void CheckSegment();
|
||||
|
||||
static void Cleanup(const std::string& segmentName);
|
||||
|
||||
std::string fSegmentName;
|
||||
std::atomic<bool> fTerminating;
|
||||
std::atomic<bool> fHeartbeatTriggered;
|
||||
std::chrono::high_resolution_clock::time_point fLastHeartbeat;
|
||||
std::thread fHeartbeatThread;
|
||||
};
|
||||
|
||||
} // namespace shmem
|
||||
} // namespace mq
|
||||
} // namespace fair
|
||||
|
||||
#endif /* FAIRMQSHMMONITOR_H_ */
|
Reference in New Issue
Block a user