81char *XrdXrootdMonFile::repBuff = 0;
84char *XrdXrootdMonFile::repNext = 0;
85char *XrdXrootdMonFile::repFirst = 0;
86char *XrdXrootdMonFile::repLast = 0;
87int XrdXrootdMonFile::totRecs = 0;
88int XrdXrootdMonFile::xfrRecs = 0;
89int XrdXrootdMonFile::repSize = 0;
90int XrdXrootdMonFile::repTime = 0;
91int XrdXrootdMonFile::maxText = 0;
92int XrdXrootdMonFile::fmHWM =-1;
93int XrdXrootdMonFile::crecSize = 0;
94int XrdXrootdMonFile::xfrCnt = 0;
95int XrdXrootdMonFile::fBsz = 65472;
96int XrdXrootdMonFile::xfrRem = 0;
98short XrdXrootdMonFile::crecNLen = 0;
99short XrdXrootdMonFile::trecNLen = 0;
100char XrdXrootdMonFile::fsLFN = 0;
101char XrdXrootdMonFile::fsLVL = 0;
102char XrdXrootdMonFile::fsOPS = 0;
103char XrdXrootdMonFile::fsSSQ = 0;
104char XrdXrootdMonFile::fsXFR = 0;
105char XrdXrootdMonFile::crecFlag = 0;
115 int iEnt, iMap, iSlot;
121 {iEnt = fsP->
MonEnt & 0xffff;
125 if (fmMap[iMap].Free(iSlot)) fmUse[iMap]--;
126 if (iMap == fmHWM)
while(fmHWM >= 0 && !fmUse[fmHWM]) fmHWM--;
191 cP = GetSlot(crecSize);
192 memcpy(cP, &cRec, crecSize);
212 fBsz = (fbsz <= 0 ? 65472
248 dP->
Hdr.userID = usrID;
262 if (!xfrRem) DoXFR();
267 if (repNext) Flush();
279void XrdXrootdMonFile::DoXFR()
297 for (i = 0; i <= hwm; i++)
302 while((fsP = fmMap[i].Next(n)))
303 {
if (fsP->
xfrXeq) DoXFR(fsP);
319 long long xfrRead, xfrReadv, xfrWrite;
334 xfrRec.Hdr.fileID = fsP->
FileID;
335 xfrRec.Xfr.read = htonll(xfrRead);
336 xfrRec.Xfr.readv = htonll(xfrReadv);
337 xfrRec.Xfr.write = htonll(xfrWrite);
341 cP = GetSlot(
sizeof(xfrRec));
342 memcpy(cP, &xfrRec,
sizeof(xfrRec));
354 int alignment, pagsz = getpagesize();
358 alignment = (fBsz < pagsz ? 1024 : pagsz);
359 if (posix_memalign((
void **)&repBuff, alignment, fBsz))
385 repLast = repBuff+fBsz-1;
394 int maxSlot = repLast - repFirst;
395 if (maxSlot > 32767) maxSlot = 32767;
396 maxText = (maxSlot & ~7) - (minRecSz + (
int)
sizeof(
kXR_unt32)) - 1;
409 crecNLen = htons(
static_cast<short>(crecSize));
414 xfrRec.Hdr.recFlag = 0;
415 xfrRec.Hdr.recSize = htons(
static_cast<short>(
sizeof(xfrRec)));
435void XrdXrootdMonFile::Flush()
442 repHdr->
pseq =
static_cast<char>(0x00ff & seq++);
446 repTOD->
Hdr.nRecs[0] = htons(
static_cast<short>(xfrRecs));
447 repTOD->
Hdr.nRecs[1] = htons(
static_cast<short>(totRecs));
448 repTOD->
tEnd = htonl(
static_cast<int>(time(0)));
452 bfSize = (repNext - repBuff);
453 repHdr->
plen = htons(
static_cast<short>(bfSize));
460 xfrRecs = totRecs = 0;
467char *XrdXrootdMonFile::GetSlot(
int slotSZ)
480 {
if ((repNext + slotSZ) > repLast)
485 repTOD->tBeg = htonl(
static_cast<int>(time(0)));
502 unsigned int uDID,
bool isRW)
505 int i = 0, sNum = -1, rLen, tLen = 0;
515 for (i = 0; i < mapUse; i++)
517 {
if ((sNum = fmMap[i].Insert(fsP)) >= 0)
519 if (i > fmHWM) fmHWM = i;
530 fsP->
MonEnt = (sNum < 0 ? noSlot
539 {tLen = strlen(
Path);
540 if (tLen > maxText) tLen = maxText;
541 rLen = (rLen +
sizeof(
kXR_unt32) + tLen + 1 + 7) & ~7;
552 oP->
Hdr.
recSize = htons(
static_cast<short>(rLen));
const kXR_char XROOTD_MON_MAPFSTA
XrdJob(const char *desc="")
void Schedule(XrdJob *jp)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
struct XrdXrootdFileStats::@134143131021232201261001370045223101060160247031 ssq
static void Disc(unsigned int usrID)
static void Defaults(int intv, int opts, int iocnt, int fbsz)
static void Open(XrdXrootdFileStats *fsP, const char *Path, unsigned int uDID, bool isRW)
static void Close(XrdXrootdFileStats *fsP, bool isDisc=false)
static int CopyText(char *buff, int room, const char *text, int tLen)
static constexpr int maxDgram
static int Send(int mmode, void *buff, int size, bool setseq=true)
static kXR_unt32 GetDictID(bool hbo=false)