Loading...
Searching...
No Matches
XrdXrootdMonitor Class Reference

`#include <XrdXrootdMonitor.hh>`

Collaboration diagram for XrdXrootdMonitor:

## Classes

class | Hello
class | User

## Public Member Functions

| XrdXrootdMonitor ()
void | Add_rd (kXR_unt32 dictid, kXR_int32 rlen, kXR_int64 offset)
void | Add_rv (kXR_unt32 dictid, kXR_int32 rlen, kXR_int16 vcnt, kXR_char vseq, kXR_char vtype)
void | Add_wr (kXR_unt32 dictid, kXR_int32 wlen, kXR_int64 offset)
void | appID (char *id)
void | Close (kXR_unt32 dictid, long long rTot, long long wTot)
void | Disc (kXR_unt32 dictid, int csec, char Flags=0)
void | Open (kXR_unt32 dictid, off_t fsize)

## Static Public Member Functions

static void | Defaults (char *dest1, int m1, char *dest2, int m2)
static void | Defaults (int msz, int rsz, int wsz, int flush, int flash, int iDent, int rnm, int fbsz, int fsint=0, int fsopt=0, int fsion=0)
static int | Flushing ()
static kXR_unt32 | GetDictID (bool hbo=false)
static void | Ident ()
static int | Init ()
static void | Init (XrdScheduler *sp, XrdSysError *errp, const char *iHost, const char *iProg, const char *iName, int Port)
static bool | ModeEnabled (int mode)
static int | Redirect ()
static int | Redirect (kXR_unt32 mID, const char *hName, int Port, const char opC, const char *Path)
static int | Send (int mmode, void *buff, int size, bool setseq=true)
static time_t | Tick ()

## Static Public Attributes

static XrdXrootdMonitor * | altMon = 0
static const int | rdrMax = 8

## Friends

class | User
class | XrdXrootdMonFile

## Detailed Description

Definition at line 79 of file XrdXrootdMonitor.hh.

## Constructor & Destructor Documentation

## XrdXrootdMonitor()

XrdXrootdMonitor::XrdXrootdMonitor | ( |  | ) |

Definition at line 366 of file XrdXrootdMonitor.cc.

{
kXR_int32 localWindow;
// Initialize last window to force a mark as well as the local window
//
lastWindow = 0;
localWindow = currWindow;
// Allocate a monitor buffer
//
if (posix_memalign((void **)&monBuff, getpagesize(), monBlen))
eDest->Emsg("Monitor", "Unable to allocate monitor buffer.");
else {nextEnt = 1;
setTMark(monBuff, 0, localWindow);
}
}
kXR_int32
int kXR_int32
Definition XPtypes.hh:89
eDest
static XrdSysError eDest(0,"crypto_")
setTMark
#define setTMark(TM_mb, TM_en, TM_tm)
Definition XrdXrootdMonitor.cc:130
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95

References eDest, and setTMark.

Referenced by Init().

Here is the caller graph for this function:

## Member Function Documentation

## Add_rd()

void XrdXrootdMonitor::Add_rd | ( | kXR_unt32 | dictid,
|  | kXR_int32 | rlen,
|  | kXR_int64 | offset )

inline

Definition at line 88 of file XrdXrootdMonitor.hh.

{Add_io(dictid, rlen, offset);}

## Add_rv()

void XrdXrootdMonitor::Add_rv | ( | kXR_unt32 | dictid,
|  | kXR_int32 | rlen,
|  | kXR_int16 | vcnt,
|  | kXR_char | vseq,
|  | kXR_char | vtype )

inline

Definition at line 93 of file XrdXrootdMonitor.hh.

{if (lastWindow != currWindow) Mark();
else if (nextEnt == lastEnt) Flush();
monBuff->info[nextEnt].arg0.id[0] = vtype;
monBuff->info[nextEnt].arg0.id[1] = vseq;
monBuff->info[nextEnt].arg0.sVal[1] = vcnt;
monBuff->info[nextEnt].arg0.rTot[1] = 0;
monBuff->info[nextEnt].arg1.buflen = rlen;
monBuff->info[nextEnt++].arg2.dictid = dictid;
}

## Add_wr()

void XrdXrootdMonitor::Add_wr | ( | kXR_unt32 | dictid,
|  | kXR_int32 | wlen,
|  | kXR_int64 | offset )

inline

Definition at line 108 of file XrdXrootdMonitor.hh.

{Add_io(dictid,(kXR_int32)htonl(-wlen),offset);}

## appID()

void XrdXrootdMonitor::appID | ( | char * | id | ) |

Definition at line 398 of file XrdXrootdMonitor.cc.

{
static const int apInfoSize = sizeof(XrdXrootdMonTrace)-4;
// Application ID's are only meaningful for io event recording
//
if (this == altMon || !*id) return;
// Fill out the monitor record
//
if (lastWindow != currWindow) Mark();
else if (nextEnt == lastEnt) Flush();
monBuff->info[nextEnt].arg0.id[0] = XROOTD_MON_APPID;
strncpy((char *)(&(monBuff->info[nextEnt])+4), id, apInfoSize);
}
XROOTD_MON_APPID
const kXR_char XROOTD_MON_APPID
Definition XrdXrootdMonData.hh:93
XrdXrootdMonitor::altMon
static XrdXrootdMonitor * altMon
Definition XrdXrootdMonitor.hh:233

References altMon, and XROOTD_MON_APPID.

## Close()

void XrdXrootdMonitor::Close | ( | kXR_unt32 | dictid,
|  | long long | rTot,
|  | long long | wTot )

Definition at line 450 of file XrdXrootdMonitor.cc.

{
XrdXrootdMonitorLock mLock(this);
unsigned int rVal, wVal;
// Fill out the monitor record (we allow the compiler to correctly cast data)
//
if (lastWindow != currWindow) Mark();
else if (nextEnt == lastEnt) Flush();
monBuff->info[nextEnt].arg0.id[0] = XROOTD_MON_CLOSE;
monBuff->info[nextEnt].arg0.id[1] = do_Shift(rTot, rVal);
monBuff->info[nextEnt].arg0.rTot[1] = htonl(rVal);
monBuff->info[nextEnt].arg0.id[2] = do_Shift(wTot, wVal);
monBuff->info[nextEnt].arg0.id[3] = 0;
monBuff->info[nextEnt].arg1.wTot = htonl(wVal);
monBuff->info[nextEnt++].arg2.dictid = dictid;
// Check if we need to duplicate this entry
//
if (altMon && this != altMon) altMon->Dup(&monBuff->info[nextEnt-1]);
}
XROOTD_MON_CLOSE
const kXR_char XROOTD_MON_CLOSE
Definition XrdXrootdMonData.hh:94

References altMon, and XROOTD_MON_CLOSE.

Referenced by XrdXrootdFileTable::Del(), and XrdXrootdFileTable::Recycle().

Here is the caller graph for this function:

## Defaults() [1/2]

void XrdXrootdMonitor::Defaults | ( | char * | dest1,
|  | int | m1,
|  | char * | dest2,
|  | int | m2 )

static

Definition at line 478 of file XrdXrootdMonitor.cc.

{
int mmode;
// If there are no destination then only g-stream events may be enabled.
// Otherwise, sort out the destinations relative to modes.
//
if (!dest1 && !dest2) {isEnabled = 0; return;}
if (!dest1) {dest1 = dest2; dest2 = 0; mode1 |= mode2; mode2 = 0;}
// Set the default destinations (caller supplied strdup'd strings)
//
if (Dest1) free(Dest1);
Dest1 = dest1; monMode1 = mode1;
if (Dest2) free(Dest2);
Dest2 = dest2; monMode2 = mode2;
// Set overall monitor mode
//
mmode = mode1 | mode2;
monACTIVE = (mmode ? 1 : 0);
isEnabled = (mmode & XROOTD_MON_ALL ? 1 :-1);
monIO = (mmode & XROOTD_MON_IO ? 1 : 0);
monIO = (mmode & XROOTD_MON_IOV ? 2 : monIO);
monINFO = (mmode & XROOTD_MON_INFO ? 1 : 0);
monFILE = (mmode & XROOTD_MON_FILE ? 1 : 0) | monIO;
monREDR = (mmode & XROOTD_MON_REDR ? 1 : 0);
monUSER = (mmode & XROOTD_MON_USER ? 1 : 0);
monAUTH = (mmode & XROOTD_MON_AUTH ? 1 : 0);
monFSTAT = (mmode & XROOTD_MON_FSTA && monFSTAT ? 1 : 0);
// Compute whether or not we need the clock running
//
if (monREDR || (isEnabled > 0 && (monIO || monFILE))) monCLOCK = 1;
// Check where user information should go
//
if (((mode1 & XROOTD_MON_IO) && (mode1 & XROOTD_MON_USER))
|| ((mode2 & XROOTD_MON_IO) && (mode2 & XROOTD_MON_USER)))
{if ((!(mode1 & XROOTD_MON_IO) && (mode1 & XROOTD_MON_USER))
|| (!(mode2 & XROOTD_MON_IO) && (mode2 & XROOTD_MON_USER))) monUSER = 3;
else monUSER = 2;
}
// If we are monitoring redirections then set an envar saying how often idents
// should be sent (this also tips off other layers to handle such monitoring)
//
if (monREDR) XrdOucEnv::Export("XRDMONRDR", monIdent);
}
XROOTD_MON_IOV
#define XROOTD_MON_IOV
Definition XrdXrootdMonitor.hh:56
XROOTD_MON_INFO
#define XROOTD_MON_INFO
Definition XrdXrootdMonitor.hh:51
XROOTD_MON_ALL
#define XROOTD_MON_ALL
Definition XrdXrootdMonitor.hh:48
XROOTD_MON_AUTH
#define XROOTD_MON_AUTH
Definition XrdXrootdMonitor.hh:53
XROOTD_MON_IO
#define XROOTD_MON_IO
Definition XrdXrootdMonitor.hh:50
XROOTD_MON_USER
#define XROOTD_MON_USER
Definition XrdXrootdMonitor.hh:52
XROOTD_MON_FSTA
#define XROOTD_MON_FSTA
Definition XrdXrootdMonitor.hh:57
XROOTD_MON_FILE
#define XROOTD_MON_FILE
Definition XrdXrootdMonitor.hh:49
XROOTD_MON_REDR
#define XROOTD_MON_REDR
Definition XrdXrootdMonitor.hh:55
XrdOucEnv::Export
static int Export(const char *Var, const char *Val)
Definition XrdOucEnv.cc:170

References XrdOucEnv::Export(), XROOTD_MON_ALL, XROOTD_MON_AUTH, XROOTD_MON_FILE, XROOTD_MON_FSTA, XROOTD_MON_INFO, XROOTD_MON_IO, XROOTD_MON_IOV, XROOTD_MON_REDR, and XROOTD_MON_USER.

Here is the call graph for this function:

## Defaults() [2/2]

void XrdXrootdMonitor::Defaults | ( | int | msz,
|  | int | rsz,
|  | int | wsz,
|  | int | flush,
|  | int | flash,
|  | int | iDent,
|  | int | rnm,
|  | int | fbsz,
|  | int | fsint = 0,
|  | int | fsopt = 0,
|  | int | fsion = 0 )

static

Definition at line 530 of file XrdXrootdMonitor.cc.

{
// Set default window size and flush time
//
sizeWindow = (wsz <= 0 ? 60 : wsz);
autoFlush = (flush <= 0 ? 600 : flush);
autoFlash = (flash <= 0 ? 0 : flash);
monIdent = idt;
rdrNum = (rnm <= 0 || rnm > rdrMax ? 3 : rnm);
rdrWin = (sizeWindow > 16777215 ? 16777215 : sizeWindow);
rdrWin = htonl(rdrWin);
// Set the fstat defaults
//
XrdXrootdMonFile::Defaults(fsint, fsopt, fsion, fbsz);
monFSTAT = fsint != 0;
// Set default monitor buffer size
//
if (msz <= 0) msz = 16384;
else if (msz < 1024) msz = 1024;
else msz = msz/sizeof(XrdXrootdMonTrace)*sizeof(XrdXrootdMonTrace);
lastEnt = (msz-sizeof(XrdXrootdMonHeader))/sizeof(XrdXrootdMonTrace);
monBlen = (lastEnt*sizeof(XrdXrootdMonTrace))+sizeof(XrdXrootdMonHeader);
lastEnt--;
// Set default monitor redirect buffer size
//
if (rsz <= 0) rsz = 32768;
else if (rsz < 2048) rsz = 2048;
lastRnt = (rsz-(sizeof(XrdXrootdMonHeader) + 16))/sizeof(XrdXrootdMonRedir);
monRlen = (lastRnt*sizeof(XrdXrootdMonRedir))+sizeof(XrdXrootdMonHeader)+16;
lastRnt--;
}
XrdXrootdMonFile::Defaults
static void Defaults(int intv, int opts, int iocnt, int fbsz)
Definition XrdXrootdMonFile.cc:178
XrdXrootdMonitor::rdrMax
static const int rdrMax
Definition XrdXrootdMonitor.hh:237

References XrdXrootdMonFile::Defaults(), and rdrMax.

Here is the call graph for this function:

## Disc()

void XrdXrootdMonitor::Disc | ( | kXR_unt32 | dictid,
|  | int | csec,
|  | char | Flags = 0 )

Definition at line 572 of file XrdXrootdMonitor.cc.

{
XrdXrootdMonitorLock mLock(this);
// Check if this should not be included in the io trace
//
if (this != altMon && monUSER == 1 && altMon)
{altMon->Disc(dictid, csec); return;}
// Fill out the monitor record (let compiler cast the data correctly)
//
if (lastWindow != currWindow) Mark();
else if (nextEnt == lastEnt) Flush();
monBuff->info[nextEnt].arg0.rTot[0] = 0;
monBuff->info[nextEnt].arg0.id[0] = XROOTD_MON_DISC;
monBuff->info[nextEnt].arg0.id[1] = Flags;
monBuff->info[nextEnt].arg1.wTot = htonl(csec);
monBuff->info[nextEnt++].arg2.dictid = dictid;
// Check if we need to duplicate this entry
//
if (altMon && this != altMon && monUSER == 3)
altMon->Dup(&monBuff->info[nextEnt-1]);
}
XROOTD_MON_DISC
const kXR_char XROOTD_MON_DISC
Definition XrdXrootdMonData.hh:95

References altMon, and XROOTD_MON_DISC.

## Flushing()

int XrdXrootdMonitor::Flushing | ( |  | ) |

inline static

Definition at line 124 of file XrdXrootdMonitor.hh.

{return autoFlush;}

Referenced by XrdXrootdGSReal::XrdXrootdGSReal().

Here is the caller graph for this function:

## GetDictID()

kXR_unt32 XrdXrootdMonitor::GetDictID | ( | bool | hbo = false | ) |

static

Definition at line 816 of file XrdXrootdMonitor.cc.

{
static XrdSysMutex seqMutex;
static unsigned int monSeqID = 1;
unsigned int mySeqID;
// Assign a unique ID for this entry
//
seqMutex.Lock();
mySeqID = monSeqID++;
seqMutex.UnLock();
// Return the ID
//
if (hbo) return mySeqID;
return htonl(mySeqID);
}
XrdSysMutex::Lock
void Lock()
Definition XrdSysPthread.hh:222
XrdSysMutex::UnLock
void UnLock()
Definition XrdSysPthread.hh:224
XrdXrootdMonInfo::seqMutex
XrdSysMutex seqMutex
Definition XrdXrootdMonitor.cc:116

References XrdXrootdMonInfo::seqMutex.

Referenced by XrdXrootdGSReal::GetDictID(), and XrdXrootdMonFile::Open().

Here is the caller graph for this function:

## Ident()

void XrdXrootdMonitor::Ident | ( |  | ) |

inline static

Definition at line 128 of file XrdXrootdMonitor.hh.

{Send(-1, idRec, idLen);}
XrdXrootdMonitor::Send
static int Send(int mmode, void *buff, int size, bool setseq=true)
Definition XrdXrootdMonitor.cc:1198

References Send().

Referenced by XrdXrootdMonitor_Ident::DoIt().

Here is the call graph for this function:
Here is the caller graph for this function:

## Init() [1/2]

int XrdXrootdMonitor::Init | ( |  | ) |

static

Definition at line 732 of file XrdXrootdMonitor.cc.

{
static XrdXrootdMonitor_Ident MonIdent(monIdent, isEnabled);
int i, Now = time(0);
bool aOK;
// Setup the primary destination
//
if (Dest1)
{InetDest1 = new XrdNetMsg(eDest, Dest1, &aOK, true);
if (!aOK)
{eDest->Emsg("Monitor", "Unable to setup primary monitor collector.");
return 0;
}
}
// Setup the secondary destination
//
if (Dest2)
{InetDest2 = new XrdNetMsg(eDest, Dest2, &aOK, true);
if (!aOK)
{eDest->Emsg("Monitor","Unable to setup secondary monitor collector.");
return 0;
}
}
// Now schedule the first identification record
//
if (Sched && monIdent >= 0) Sched->Schedule((XrdJob *)&MonIdent);
// There is nothing more to do unless we have been enabled via Defaults()
//
if (!isEnabled) return 1;
// If there is a destination that is only collecting file events, then
// allocate a global monitor object but don't start the timer just yet.
//
if ((monMode1 && !(monMode1 & XROOTD_MON_IO))
|| (monMode2 && !(monMode2 & XROOTD_MON_IO)))
if (!(altMon = new XrdXrootdMonitor()) || !altMon->monBuff)
{if (altMon) {delete altMon; altMon = 0;}
eDest->Emsg("Monitor","allocate monitor; insufficient storage.");
return 0;
}
// Turn on the monitoring clock if we need it running all the time
//
if (monCLOCK) startClock();
// If we are monitoring file stats then start that up
//
if (!Sched || !monFSTAT) monFSTAT = 0;
else if (!XrdXrootdMonFile::Init()) return 0;
// If we are not monitoring redirections, we are done!
//
if (!monREDR) return 1;
// Allocate as many redirection monitors as requested
//
for (i = 0; i < rdrNum; i++)
{if (posix_memalign((void **)&rdrMon[i].Buff, getpagesize(),monRlen))
{eDest->Emsg("Monitor", "Unable to allocate monitor rdr buffer.");
return 0;
}
rdrMon[i].Buff->sID = mySID;
rdrMon[i].Buff->sXX[0] = XROOTD_MON_REDSID;
rdrMon[i].Next = (i ? &rdrMon[i-1] : &rdrMon[0]);
rdrMon[i].nextEnt = 0;
rdrMon[i].flushIt = Now + autoFlush;
rdrMon[i].lastTOD = 0;
}
rdrMon[0].Next = &rdrMon[i-1];
rdrMP = &rdrMon[0];
// All done
//
return 1;
}
XROOTD_MON_REDSID
const kXR_char XROOTD_MON_REDSID
Definition XrdXrootdMonData.hh:128
XrdScheduler::Schedule
void Schedule(XrdJob *jp)
Definition XrdScheduler.cc:373
XrdXrootdMonFile::Init
static bool Init()
Definition XrdXrootdMonFile.cc:324
XrdXrootdMonitor::XrdXrootdMonitor
XrdXrootdMonitor()
Definition XrdXrootdMonitor.cc:366
XrdXrootdMonInfo::Sched
XrdScheduler * Sched
Definition XrdXrootdMonFile.cc:47
XrdXrootdMonInfo::mySID
long long mySID
Definition XrdXrootdMonFile.cc:49

References XrdXrootdMonitor(), altMon, eDest, XrdXrootdMonFile::Init(), XrdXrootdMonInfo::mySID, XrdXrootdMonInfo::Sched, XROOTD_MON_IO, and XROOTD_MON_REDSID.

Here is the call graph for this function:

## Init() [2/2]

void XrdXrootdMonitor::Init | ( | XrdScheduler * | sp,
|  | XrdSysError * | errp,
|  | const char * | iHost,
|  | const char * | iProg,
|  | const char * | iName,
|  | int | Port )

static

Definition at line 633 of file XrdXrootdMonitor.cc.

{
const char *cgID0 = "&site=%s";
const char *cgID1 = "&host=%s";
const char *cgID2 = "&port=%d&inst=%s";
const char *cgID3 = "&pgm=%s&ver=%s";
const char *jsID0 = "\"src\":{\"site\":\"%s\"}";
const char *jsID1 = "%s\"host\":\"%s\"}";
const char *jsID2 = "%s\"port\":%d,\"inst\":\"%s\"}";
const char *jsID3 = "%s\"pgm\":\"%s\",\"ver\":\"%s\"}";
XrdXrootdMonMap *mP;
char iBuff[1024], iMuff[2048], iPuff[1024];
int n, i, j;
// Set static variables
//
Sched = sp;
eDest = errp;
// Generate our server ID (the version is not part of he fingerprint)
//
strcpy(iBuff, "=/");
kySID = XrdOucUtils::Ident(mySID, iBuff+2, sizeof(iBuff)-2,
iHost, iProg, iName, Port);
n = strlen(iBuff);
snprintf(iBuff+n, sizeof(iBuff)-n, "&ver=%s", XrdVERSION);
kySIDSZ = strlen(kySID);
monHost = strdup(iHost);
// Ignore array bounds warning from gcc 12 triggered because the allocated
// memory for the XrdXrootdMonMap is smaller than sizeof(XrdXrootdMonMap)
#if defined(__GNUC__) && __GNUC__ >= 12
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
// Create identification record
//
idLen = strlen(iBuff) + sizeof(XrdXrootdMonHeader) + sizeof(kXR_int32);
idRec = (char *)malloc(idLen+1);
mP = (XrdXrootdMonMap *)idRec;
fillHeader(&(mP->hdr), XROOTD_MON_MAPIDNT, idLen);
mP->hdr.pseq = 0;
mP->dictid = 0;
strcpy(mP->info, iBuff);
#if defined(__GNUC__) && __GNUC__ >= 12
#pragma GCC diagnostic pop
#endif
// Generate a CGI version of all the variations
//
const char *Site (getenv("XRDSITE") ? getenv("XRDSITE") : "");
i = snprintf(iPuff, sizeof(iPuff), cgID0, Site);
SidCGI[0] = strdup(iPuff);
LidCGI[0] = strlen(iPuff);
n = sizeof(iPuff)-i; j = i;
i = snprintf(iPuff+j, n, cgID1, iHost);
SidCGI[1] = strdup(iPuff);
LidCGI[1] = strlen(iPuff);
n -= i; j += i;
i = snprintf(iPuff+j, n, cgID2, Port, iName);
SidCGI[2] = strdup(iPuff);
LidCGI[2] = strlen(iPuff);
n -= i; j += i;
snprintf(iPuff+j, n, cgID3, iProg, XrdVERSION);
SidCGI[3] = strdup(iPuff);
LidCGI[3] = strlen(iPuff);
// Generate a JSON version of all the variations.
//
n = snprintf(iPuff, sizeof(iPuff), jsID0, Site);
SidJSON[0] = strdup(iPuff);
LidJSON[0] = strlen(iPuff);
strcpy(iPuff+n-1, ",");
n = snprintf(iMuff, sizeof(iMuff), jsID1, iPuff, iHost);
SidJSON[1] = strdup(iMuff);
LidJSON[1] = strlen(iMuff);
strcpy(iMuff+n-1, ",");
n = snprintf(iPuff, sizeof(iPuff), jsID2, iMuff, Port, iName);
SidJSON[2] = strdup(iPuff);
LidJSON[2] = strlen(iPuff);
strcpy(iPuff+n-1, ",");
snprintf(iMuff, sizeof(iMuff), jsID3, iPuff, iProg, XrdVERSION);
SidJSON[3] = strdup(iMuff);
LidJSON[3] = strlen(iMuff);
}
XrdXrootdMonMap::dictid
kXR_unt32 dictid
Definition XrdXrootdMonData.hh:89
XROOTD_MON_MAPIDNT
const kXR_char XROOTD_MON_MAPIDNT
Definition XrdXrootdMonData.hh:103
XrdXrootdMonMap::info
char info[1024+256]
Definition XrdXrootdMonData.hh:90
XrdXrootdMonHeader::pseq
kXR_char pseq
Definition XrdXrootdMonData.hh:41
XrdXrootdMonMap::hdr
XrdXrootdMonHeader hdr
Definition XrdXrootdMonData.hh:88
XrdOucUtils::Ident
static char * Ident(long long &mySID, char *iBuff, int iBlen, const char *iHost, const char *iProg, const char *iName, int Port)
Definition XrdOucUtils.cc:779
XrdXrootdMonInfo::SidJSON
char * SidJSON[4]
Definition XrdXrootdMonitor.cc:120
XrdXrootdMonInfo::SidCGI
char * SidCGI[4]
Definition XrdXrootdMonitor.cc:118
XrdXrootdMonInfo::monHost
char * monHost
Definition XrdXrootdMonitor.cc:111
XrdXrootdMonInfo::LidCGI
int LidCGI[4]
Definition XrdXrootdMonitor.cc:119
XrdXrootdMonInfo::kySID
char * kySID
Definition XrdXrootdMonitor.cc:112
XrdXrootdMonInfo::kySIDSZ
int kySIDSZ
Definition XrdXrootdMonitor.cc:115
XrdXrootdMonInfo::LidJSON
int LidJSON[4]
Definition XrdXrootdMonitor.cc:121

References XrdXrootdMonMap::dictid, eDest, XrdXrootdMonMap::hdr, XrdOucUtils::Ident(), XrdXrootdMonMap::info, XrdXrootdMonInfo::kySID, XrdXrootdMonInfo::kySIDSZ, XrdXrootdMonInfo::LidCGI, XrdXrootdMonInfo::LidJSON, XrdXrootdMonInfo::monHost, XrdXrootdMonInfo::mySID, XrdXrootdMonHeader::pseq, XrdXrootdMonInfo::Sched, XrdXrootdMonInfo::SidCGI, XrdXrootdMonInfo::SidJSON, and XROOTD_MON_MAPIDNT.

Here is the call graph for this function:

## ModeEnabled()

bool XrdXrootdMonitor::ModeEnabled | ( | int | mode | ) |

inline static

Definition at line 136 of file XrdXrootdMonitor.hh.

{return ((monMode1|monMode2) & mode) != 0;}

## Open()

void XrdXrootdMonitor::Open | ( | kXR_unt32 | dictid,
|  | off_t | fsize )

Definition at line 878 of file XrdXrootdMonitor.cc.

{
XrdXrootdMonitorLock mLock(this);
if (lastWindow != currWindow) Mark();
else if (nextEnt == lastEnt) Flush();
h2nll(fsize, monBuff->info[nextEnt].arg0.val);
monBuff->info[nextEnt].arg0.id[0] = XROOTD_MON_OPEN;
monBuff->info[nextEnt].arg1.buflen = 0;
monBuff->info[nextEnt++].arg2.dictid = dictid;
// Check if we need to duplicate this entry
//
if (altMon && this != altMon) altMon->Dup(&monBuff->info[nextEnt-1]);
}
XROOTD_MON_OPEN
const kXR_char XROOTD_MON_OPEN
Definition XrdXrootdMonData.hh:96

References altMon, and XROOTD_MON_OPEN.

## Redirect() [1/2]

int XrdXrootdMonitor::Redirect | ( |  | ) |

inline static

Definition at line 141 of file XrdXrootdMonitor.hh.

{return monREDR;}

Referenced by XrdXrootdCallBack::sendError().

Here is the caller graph for this function:

## Redirect() [2/2]

int XrdXrootdMonitor::Redirect | ( | kXR_unt32 | mID,
|  | const char * | hName,
|  | int | Port,
|  | const char | opC,
|  | const char * | Path )

static

Definition at line 898 of file XrdXrootdMonitor.cc.

{
XrdXrootdMonRedir *mtP;
MonRdrBuff *mP = Fetch();
int n, slots, hLen, pLen;
char *dest;
// Take care of the server's name which might actually be a path
//
if (*hName == '/') {Path = hName; hName = ""; hLen = 0;}
else {const char *quest = index(hName, '?');
hLen = (quest ? quest - hName : strlen(hName));
if (hLen > 256) hLen = 256;
}
// Take care of the path
//
pLen = strlen(Path);
if (pLen > 1024) pLen = 1024;
// Compute number of entries needed here
//
n = (hLen + 1 + pLen + 1); // "<host>:<path>\0"
slots = n / sizeof(XrdXrootdMonRedir);
if (n % sizeof(XrdXrootdMonRedir)) slots++;
pLen = slots * sizeof(XrdXrootdMonRedir) - (hLen+1);
// Obtain a lock on this buffer
//
if (!mP) return 0;
mP->Mutex.Lock();
// If we don't have enough slots, flush this buffer. Note that we account for
// the ending timing mark here (an extra slot).
//
if (mP->nextEnt + slots + 2 >= lastRnt) Flush(mP);
// Check if we need a timing mark
//
if (mP->lastTOD != rdrTOD)
{mP->lastTOD = rdrTOD;
setTMurk(mP->Buff, mP->nextEnt, mP->lastTOD);
mP->nextEnt++;
}
// Fill out the buffer
//
mtP = &(mP->Buff->info[mP->nextEnt]);
mtP->arg0.rdr.Type = XROOTD_MON_REDIRECT | opC;
mtP->arg0.rdr.Dent = static_cast<char>(slots);
mtP->arg0.rdr.Port = htons(static_cast<short>(Port));
mtP->arg1.dictid = mID;
dest = (char *)(mtP+1);
strncpy(dest, hName,hLen); dest += hLen; *dest++ = ':';
strncpy(dest, Path, pLen);
// Adjust pointer and return
//
mP->nextEnt = mP->nextEnt + (slots+1);
mP->Mutex.UnLock();
return 0;
}
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
XrdXrootdMonRedir::arg0
union XrdXrootdMonRedir::@017044370107177241030156067342362323316131075335 arg0
XrdXrootdMonRedir::arg1
union XrdXrootdMonRedir::@124330332126055120131203275034312305071227313005 arg1
XROOTD_MON_REDIRECT
const kXR_char XROOTD_MON_REDIRECT
Definition XrdXrootdMonData.hh:131
setTMurk
#define setTMurk(TM_mb, TM_en, TM_tm)
Definition XrdXrootdMonitor.cc:136

References XrdXrootdMonRedir::arg0, XrdXrootdMonRedir::arg1, XrdXrootdMonBurr::info, XrdSysMutex::Lock(), Path, setTMurk, XrdSysMutex::UnLock(), and XROOTD_MON_REDIRECT.

Here is the call graph for this function:

## Send()

int XrdXrootdMonitor::Send | ( | int | mmode,
|  | void * | buff,
|  | int | size,
|  | bool | setseq = true )

static

Definition at line 1198 of file XrdXrootdMonitor.cc.

{
#ifndef NODEBUG
const char *TraceID = "Monitor";
#endif
static XrdSysMutex sendMutex;
static int seq1=0, seq2=0;
XrdXrootdMonHeader *mHdr=0;
int rc1, rc2;
// If we are to set sequence numbers, recast the buffer. We are assured that
// the buffer always starts with the standard monitor header.
//
if (setseq) mHdr = static_cast<XrdXrootdMonHeader*>(buff);
sendMutex.Lock();
if (monMode & monMode1 && InetDest1)
{if (mHdr) mHdr->pseq = (seq1++) & 0xff;
rc1 = InetDest1->Send((char *)buff, blen);
TRACE(DEBUG,blen <<" bytes sent to " <<Dest1 <<" rc=" <<rc1);
}
else rc1 = 0;
if (monMode & monMode2 && InetDest2)
{if (mHdr) mHdr->pseq = (seq2++) & 0xff;
rc2 = InetDest2->Send((char *)buff, blen);
TRACE(DEBUG,blen <<" bytes sent to " <<Dest2 <<" rc=" <<rc2);
}
else rc2 = 0;
sendMutex.UnLock();
return (rc1 ? rc1 : rc2);
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
TRACE
#define TRACE(act, x)
Definition XrdTrace.hh:63

References DEBUG, XrdSysMutex::Lock(), XrdXrootdMonHeader::pseq, TRACE, and XrdSysMutex::UnLock().

Referenced by Ident().

Here is the call graph for this function:
Here is the caller graph for this function:

## Tick()

time_t XrdXrootdMonitor::Tick | ( |  | ) |

static

Definition at line 967 of file XrdXrootdMonitor.cc.

{
time_t Now = time(0);
int nextFlush;
// We can safely set the window as we are the only ones doing so and memory
// access is atomic as long as it sits within a cache line (which it does).
//
currWindow = static_cast<kXR_int32>(Now);
rdrTOD = htonl(currWindow);
nextFlush = currWindow + autoFlush;
// Check to see if we should flush the alternate monitor
//
if (altMon && currWindow >= FlushTime)
{XrdXrootdMonitorLock::Lock();
if (currWindow >= FlushTime)
{if (altMon->nextEnt > 1) altMon->Flush();
else FlushTime = nextFlush;
}
XrdXrootdMonitorLock::UnLock();
}
// Now check to see if we need to flush redirect buffers
//
if (monREDR)
{int n = rdrNum;
while(n--)
{rdrMon[n].Mutex.Lock();
if (rdrMon[n].nextEnt == 0) rdrMon[n].flushIt = nextFlush;
else if (rdrMon[n].flushIt <= currWindow) Flush(&rdrMon[n]);
rdrMon[n].Mutex.UnLock();
}
}
// All done. Stop the clock if there is no reason for it to be running. The
// clock always runs if we are monitoring redirects or all clients. Otherwise,
// the clock only runs if we have a one or more client-specific monitors.
//
if (!monREDR && isEnabled < 0)
{windowMutex.Lock();
if (!numMonitor) Now = 0;
windowMutex.UnLock();
}
return Now;
}
XrdXrootdMonitorLock::UnLock
static void UnLock()
Definition XrdXrootdMonitor.cc:209
XrdXrootdMonitorLock::Lock
static void Lock()
Definition XrdXrootdMonitor.cc:207

References altMon, XrdXrootdMonitorLock::Lock(), and XrdXrootdMonitorLock::UnLock().

Referenced by XrdXrootdMonitor_Tick::DoIt().

Here is the call graph for this function:
Here is the caller graph for this function:

## Friends And Related Symbol Documentation

## User

friend class User

friend

Definition at line 83 of file XrdXrootdMonitor.hh.

## XrdXrootdMonFile

friend class XrdXrootdMonFile

friend

Definition at line 84 of file XrdXrootdMonitor.hh.

References XrdXrootdMonFile.

Referenced by XrdXrootdMonFile.

## Member Data Documentation

## altMon

XrdXrootdMonitor * XrdXrootdMonitor::altMon = 0

static

Definition at line 233 of file XrdXrootdMonitor.hh.

Referenced by XrdXrootdMonitorLock::XrdXrootdMonitorLock(), appID(), Close(), Disc(), Init(), Open(), and Tick().

## rdrMax

const int XrdXrootdMonitor::rdrMax = 8

static

Definition at line 237 of file XrdXrootdMonitor.hh.

Referenced by Defaults().

The documentation for this class was generated from the following files:

- XrdXrootdMonitor.hh
- XrdXrootdMonitor.cc