xrootd
|
00001 /*****************************************************************************/ 00002 /* */ 00003 /* XrdMonDecTraceInfo.hh */ 00004 /* */ 00005 /* (c) 2004 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$ 00012 00013 #ifndef XRDMONDECTRACEINFO_HH 00014 #define XRDMONDECTRACEINFO_HH 00015 00016 #include "XrdMon/XrdMonCommon.hh" 00017 00018 #include "XrdSys/XrdSysHeaders.hh" 00019 00020 using std::ostream; 00021 00022 class XrdMonDecTraceInfo { 00023 public: 00024 XrdMonDecTraceInfo() : _offset(0), _length(0), _timestamp(0), _uniqueId(0) {} 00025 XrdMonDecTraceInfo(kXR_int64 o, length_t l, char rw, kXR_int32 t) 00026 : _offset(o), _length(l), _rwReq(rw), _timestamp(t), _uniqueId(o) {} 00027 00028 kXR_int32 timestamp() const {return _timestamp;} // for verification 00029 bool isRead() const { return _rwReq == 'r'; } 00030 length_t length() const { return _length; } 00031 void setUniqueId(dictid_t id) { _uniqueId = id; } 00032 00033 void convertToString(char s[256]); 00034 00035 private: 00036 kXR_int64 _offset; 00037 length_t _length; 00038 char _rwReq; 00039 kXR_int32 _timestamp; 00040 dictid_t _uniqueId; 00041 00042 static kXR_int32 _lastT; // cache last, likely to be the same for many 00043 static string _lastS; // traces, conversion to string not cheap 00044 00045 friend ostream& operator<<(ostream& o, const XrdMonDecTraceInfo& t); 00046 }; 00047 00048 // size: 8 + 4 + 1 + 4 --> aligned to 32 00049 00050 #endif /* XRDMONDECTRACEINFO_HH */