CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DQMBasicNet Class Reference

#include <DQMNet.h>

Inheritance diagram for DQMBasicNet:
DQMImplNet< DQMNet::Object > DQMNet

Public Member Functions

 DQMBasicNet (const std::string &appname="")
 
bool removeLocalExcept (const std::set< std::string > &known)
 
void reserveLocalSpace (uint32_t size)
 Give a hint of how much capacity to allocate for local objects. More...
 
void updateLocalObject (Object &o)
 
- Public Member Functions inherited from DQMImplNet< DQMNet::Object >
 DQMImplNet (const std::string &appname="")
 
 ~DQMImplNet () override=default
 
- Public Member Functions inherited from DQMNet
void debug (bool doit)
 
void delay (int delay)
 
 DQMNet (const std::string &appname="")
 
 DQMNet (const DQMNet &)=delete
 
void listenToCollector (const std::string &host, int port)
 
void lock ()
 Acquire a lock on the DQM net layer. More...
 
DQMNetoperator= (const DQMNet &)=delete
 
void run ()
 
void sendLocalChanges ()
 
void shutdown ()
 Stop the network layer and wait it to finish. More...
 
void staleObjectWaitLimit (lat::TimeSpan time)
 
void start ()
 
void startLocalServer (int port)
 
void startLocalServer (const char *path)
 
void unlock ()
 Release the lock on the DQM net layer. More...
 
void updateToCollector (const std::string &host, int port)
 
virtual ~DQMNet ()
 

Private Attributes

ImplPeer * local_
 

Additional Inherited Members

- Public Types inherited from DQMImplNet< DQMNet::Object >
using DirMap = std::set< std::string >
 
typedef std::unordered_set< DQMNet::Object, HashOp, HashEqualObjectMap
 
typedef std::map< lat::Socket *, ImplPeer > PeerMap
 
- Public Types inherited from DQMNet
using DataBlob = std::vector< unsigned char >
 
using QReports = std::vector< QValue >
 
using QValue = MonitorElementData::QReport::QValue
 
using TagList = std::vector< uint32_t >
 
using WaitList = std::list< WaitObject >
 
- Static Public Member Functions inherited from DQMNet
static size_t dqmhash (const void *key, size_t keylen)
 
static void packQualityData (std::string &into, const QReports &qr)
 
static bool setOrder (const CoreObject &a, const CoreObject &b)
 
static void unpackQualityData (QReports &qr, uint32_t &flags, const char *from)
 
- Static Public Attributes inherited from DQMNet
static const uint32_t DQM_MSG_GET_OBJECT = 3
 
static const uint32_t DQM_MSG_HELLO = 0
 
static const uint32_t DQM_MSG_LIST_OBJECTS = 2
 
static const uint32_t DQM_MSG_UPDATE_ME = 1
 
static const uint32_t DQM_PROP_ACCUMULATE = 0x00004000
 
static const uint32_t DQM_PROP_DEAD = 0x00080000
 
static const uint32_t DQM_PROP_EFFICIENCY_PLOT = 0x00200000
 
static const uint32_t DQM_PROP_HAS_REFERENCE = 0x00001000
 
static const uint32_t DQM_PROP_LUMI = 0x00040000
 
static const uint32_t DQM_PROP_MARKTODELETE = 0x01000000
 
static const uint32_t DQM_PROP_NEW = 0x00010000
 
static const uint32_t DQM_PROP_RECEIVED = 0x00020000
 
static const uint32_t DQM_PROP_REPORT_ALARM = (DQM_PROP_REPORT_ERROR | DQM_PROP_REPORT_WARN | DQM_PROP_REPORT_OTHER)
 
static const uint32_t DQM_PROP_REPORT_CLEAR = 0x00000000
 
static const uint32_t DQM_PROP_REPORT_ERROR = 0x00000100
 
static const uint32_t DQM_PROP_REPORT_MASK = 0x00000f00
 
static const uint32_t DQM_PROP_REPORT_OTHER = 0x00000400
 
static const uint32_t DQM_PROP_REPORT_WARN = 0x00000200
 
static const uint32_t DQM_PROP_RESET = 0x00008000
 
static const uint32_t DQM_PROP_STALE = 0x00100000
 
static const uint32_t DQM_PROP_TAGGED = 0x00002000
 
static const uint32_t DQM_PROP_TYPE_DATABLOB = 0x00000050
 
static const uint32_t DQM_PROP_TYPE_INT = 0x00000001
 
static const uint32_t DQM_PROP_TYPE_INVALID = 0x00000000
 
static const uint32_t DQM_PROP_TYPE_MASK = 0x000000ff
 
static const uint32_t DQM_PROP_TYPE_REAL = 0x00000002
 
static const uint32_t DQM_PROP_TYPE_SCALAR = 0x0000000f
 
static const uint32_t DQM_PROP_TYPE_STRING = 0x00000003
 
static const uint32_t DQM_PROP_TYPE_TH1D = 0x00000012
 
static const uint32_t DQM_PROP_TYPE_TH1F = 0x00000010
 
static const uint32_t DQM_PROP_TYPE_TH1I = 0x00000013
 
static const uint32_t DQM_PROP_TYPE_TH1S = 0x00000011
 
static const uint32_t DQM_PROP_TYPE_TH2D = 0x00000022
 
static const uint32_t DQM_PROP_TYPE_TH2F = 0x00000020
 
static const uint32_t DQM_PROP_TYPE_TH2I = 0x00000023
 
static const uint32_t DQM_PROP_TYPE_TH2S = 0x00000021
 
static const uint32_t DQM_PROP_TYPE_TH3D = 0x00000032
 
static const uint32_t DQM_PROP_TYPE_TH3F = 0x00000030
 
static const uint32_t DQM_PROP_TYPE_TH3S = 0x00000031
 
static const uint32_t DQM_PROP_TYPE_TPROF = 0x00000040
 
static const uint32_t DQM_PROP_TYPE_TPROF2D = 0x00000041
 
static const uint32_t DQM_REPLY_LIST_BEGIN = 101
 
static const uint32_t DQM_REPLY_LIST_END = 102
 
static const uint32_t DQM_REPLY_NONE = 103
 
static const uint32_t DQM_REPLY_OBJECT = 104
 
static const uint32_t MAX_PEER_WAITREQS = 128
 
- Protected Member Functions inherited from DQMImplNet< DQMNet::Object >
PeercreatePeer (lat::Socket *s) override
 
ObjectfindObject (Peer *p, const std::string &name, Peer **owner=nullptr) override
 
PeergetPeer (lat::Socket *s) override
 
ObjectmakeObject (Peer *p, const std::string &name) override
 
void markObjectsDead (Peer *p) override
 
void purgeDeadObjects (Peer *p) override
 
void removePeer (Peer *p, lat::Socket *s) override
 
void sendObjectListToPeer (Bucket *msg, bool all, bool clear) override
 Send all objects to a peer and optionally mark sent objects old. More...
 
void sendObjectListToPeers (bool all) override
 
void updatePeerMasks () override
 
- Protected Member Functions inherited from DQMNet
std::ostream & logme ()
 
virtual bool onMessage (Bucket *msg, Peer *p, unsigned char *data, size_t len)
 
virtual void releaseFromWait (Bucket *msg, WaitObject &w, Object *o)
 
virtual void sendObjectToPeer (Bucket *msg, Object &o, bool data)
 
virtual bool shouldStop ()
 
void updateMask (Peer *p)
 
void waitForData (Peer *p, const std::string &name, const std::string &info, Peer *owner)
 
- Static Protected Member Functions inherited from DQMNet
static void copydata (Bucket *b, const void *data, size_t len)
 
static void discard (Bucket *&b)
 
- Protected Attributes inherited from DQMImplNet< DQMNet::Object >
PeerMap peers_
 
- Protected Attributes inherited from DQMNet
bool debug_
 
pthread_mutex_t lock_
 

Detailed Description

Definition at line 593 of file DQMNet.h.

Constructor & Destructor Documentation

◆ DQMBasicNet()

DQMBasicNet::DQMBasicNet ( const std::string &  appname = "")

Definition at line 1211 of file DQMNet.cc.

References DQMImplNet< DQMNet::Object >::createPeer(), and local_.

1211  : DQMImplNet<DQMNet::Object>(appname) {
1212  local_ = static_cast<ImplPeer *>(createPeer((Socket *)-1));
1213 }
Peer * createPeer(lat::Socket *s) override
Definition: DQMNet.h:488
ImplPeer * local_
Definition: DQMNet.h:602

Member Function Documentation

◆ removeLocalExcept()

bool DQMBasicNet::removeLocalExcept ( const std::set< std::string > &  known)

Delete all local objects not in known. Returns true if something was removed. The caller must call sendLocalChanges() later to push out the changes.

Definition at line 1241 of file DQMNet.cc.

References MillePedeFileConverter_cfg::e, mps_fire::i, local_, castor_dqm_sourceclient_file_cfg::path, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DQMService::flushStandalone().

1241  {
1242  size_t removed = 0;
1243  std::string path;
1244  ObjectMap::iterator i, e;
1245  for (i = local_->objs.begin(), e = local_->objs.end(); i != e;) {
1246  path.clear();
1247  path.reserve(i->dirname.size() + i->objname.size() + 2);
1248  path += i->dirname;
1249  if (!path.empty())
1250  path += '/';
1251  path += i->objname;
1252 
1253  if (!known.count(path))
1254  ++removed, local_->objs.erase(i++);
1255  else
1256  ++i;
1257  }
1258 
1259  return removed > 0;
1260 }
ImplPeer * local_
Definition: DQMNet.h:602

◆ reserveLocalSpace()

void DQMBasicNet::reserveLocalSpace ( uint32_t  size)

Give a hint of how much capacity to allocate for local objects.

Definition at line 1216 of file DQMNet.cc.

References local_, and findQualityFiles::size.

1216 { local_->objs.reserve(size); }
size
Write out results.
ImplPeer * local_
Definition: DQMNet.h:602

◆ updateLocalObject()

void DQMBasicNet::updateLocalObject ( Object o)

Update the network cache for an object. The caller must call sendLocalChanges() later to push out the changes.

Definition at line 1220 of file DQMNet.cc.

References info(), local_, EcalTangentSkim_cfg::o, and edm::swap().

Referenced by DQMService::flushStandalone().

1220  {
1221  o.dirname = *local_->dirs.insert(o.dirname).first;
1222  std::pair<ObjectMap::iterator, bool> info(local_->objs.insert(o));
1223  if (!info.second) {
1224  // Somewhat hackish. Sets are supposedly immutable, but we
1225  // need to change the non-key parts of the object. Erasing
1226  // and re-inserting would produce too much memory churn.
1227  auto &old = const_cast<Object &>(*info.first);
1228  std::swap(old.flags, o.flags);
1229  std::swap(old.tag, o.tag);
1230  std::swap(old.version, o.version);
1231  std::swap(old.qreports, o.qreports);
1232  std::swap(old.rawdata, o.rawdata);
1233  std::swap(old.scalar, o.scalar);
1234  std::swap(old.qdata, o.qdata);
1235  }
1236 }
static const TGPicture * info(bool iBackgroundIsBlack)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
ImplPeer * local_
Definition: DQMNet.h:602

Member Data Documentation

◆ local_

ImplPeer* DQMBasicNet::local_
private

Definition at line 602 of file DQMNet.h.

Referenced by DQMBasicNet(), removeLocalExcept(), reserveLocalSpace(), and updateLocalObject().