00001 /*****************************************************************************/ 00002 /* */ 00003 /* XrdMonSndTraceCache.cc */ 00004 /* */ 00005 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ 00006 /* All Rights Reserved */ 00007 /* Produced by Jacek Becla for Stanford University under contract */ 00008 /* DE-AC02-76SF00515 with the Department of Energy */ 00009 /*****************************************************************************/ 00010 00011 // $Id: XrdMonSndTraceCache.cc 24468 2008-06-22 16:47:03Z ganis $ 00012 00013 #include "XrdMon/XrdMonSndTraceCache.hh" 00014 #include "XrdMon/XrdMonSndTraceEntry.hh" 00015 00016 #include "XrdSys/XrdSysHeaders.hh" 00017 using std::cerr; 00018 using std::cout; 00019 using std::endl; 00020 00021 const unsigned int XrdMonSndTraceCache::PACKETSIZE = 8*1024; 00022 const unsigned int XrdMonSndTraceCache::NODATAELEMS = (PACKETSIZE-HDRLEN)/TRACEELEMLEN; 00023 00024 XrdMonSndTraceCache::XrdMonSndTraceCache() 00025 {} 00026 00027 int 00028 XrdMonSndTraceCache::add(const XrdMonSndTraceEntry& de) 00029 { 00030 if ( _entries.size() > NODATAELEMS ) { 00031 cerr << "Internal error: buffer too large (" 00032 << _entries.size() << " > " << NODATAELEMS 00033 << ")." << endl; 00034 return 1; 00035 } 00036 _entries.push_back(de); 00037 if ( XrdMonSndDebug::verbose(XrdMonSndDebug::SCache) ) { 00038 cout << "Cache:: added " << de << ", size now " 00039 << _entries.size() << endl; 00040 } 00041 00042 return 0; 00043 } 00044