Loading...
Searching...
No Matches
XrdMonitor Class Reference

`#include <XrdMonitor.hh>`

Collaboration diagram for XrdMonitor:

## Classes

struct | RegInfo.Json
struct | RegInfo.Xml

## Public Types

enum | Mopts { F_JSON = 0x10000000 , X_PLUG = 0x00000001 , X_ADON = 0x00000002 }

## Public Member Functions

| XrdMonitor ()
| ~XrdMonitor ()
int | Format (char *buff, int bsize, const char *setName, int opts=0)
int | Format (char *buff, int bsize, int &item, int opts=0)
bool | Register (XrdMonRoll::rollType setType, const char *setName, XrdMonRoll::setMember setVec[])
bool | Registered ()

## Detailed Description

Definition at line 39 of file XrdMonitor.hh.

## Class Documentation

## XrdMonitor::RegInfo.Json

struct XrdMonitor::RegInfo.Json

Definition at line 65 of file XrdMonitor.hh.

Collaboration diagram for XrdMonitor::RegInfo.Json:

Class Members
char * | hdr |
vector< char * > | key |

## XrdMonitor::RegInfo.Xml

struct XrdMonitor::RegInfo.Xml

Definition at line 68 of file XrdMonitor.hh.

Collaboration diagram for XrdMonitor::RegInfo.Xml:

Class Members
char * | hdr |
vector< char * > | keyBeg |
vector< char * > | keyEnd |

## Member Enumeration Documentation

## Mopts

enum XrdMonitor::Mopts

Enumerator
F_JSON |
X_PLUG |
X_ADON |

Definition at line 45 of file XrdMonitor.hh.

{F_JSON = 0x10000000, X_PLUG = 0x00000001, X_ADON = 0x00000002};
XrdMonitor::X_PLUG
@ X_PLUG
Definition XrdMonitor.hh:45
XrdMonitor::F_JSON
@ F_JSON
Definition XrdMonitor.hh:45
XrdMonitor::X_ADON
@ X_ADON
Definition XrdMonitor.hh:45

## Constructor & Destructor Documentation

## XrdMonitor()

XrdMonitor::XrdMonitor | ( |  | ) |

inline

Definition at line 56 of file XrdMonitor.hh.

{}

## ~XrdMonitor()

XrdMonitor::~XrdMonitor | ( |  | ) |

inline

Definition at line 57 of file XrdMonitor.hh.

{}

## Member Function Documentation

## Format() [1/2]

int XrdMonitor::Format | ( | char * | buff,
|  | int | bsize,
|  | const char * | setName,
|  | int | opts = 0 )

Definition at line 87 of file XrdMonitor.cc.

{
// Find the set and format it
//
RegInfo* regInfo = FindSet(setName, opts);
if (!regInfo) return 0;
if (opts & F_JSON) bsize = FormJSON(*regInfo, buff, bsize);
else bsize = FormXML (*regInfo, buff, bsize);
return bsize;
}
opts
struct myOpts opts

References F_JSON, and opts.

## Format() [2/2]

int XrdMonitor::Format | ( | char * | buff,
|  | int | bsize,
|  | int & | item,
|  | int | opts = 0 )

Definition at line 64 of file XrdMonitor.cc.

{
// Make sure we are in the range of things to format
//
if (item < 0 || item >= (int)regVec.size()) return 0;
// Skip over types that are not wanted
//
while((regVec[item]->setType & opts) == 0)
{item++;
if (item >= (int)regVec.size()) return 0;
}
// Format the item
//
if (opts & F_JSON) bsize = FormJSON(*regVec[item], buff, bsize);
else bsize = FormXML (*regVec[item], buff, bsize);
item++;
return bsize;
}

References F_JSON, and opts.

## Register()

bool XrdMonitor::Register | ( | XrdMonRoll::rollType | setType,
|  | const char * | setName,
|  | XrdMonRoll::setMember | setVec[] )

Definition at line 163 of file XrdMonitor.cc.

{ char buff[512];
int numE = 0;
// Make sure this map has not been previously defined
//
if (FindSet(setName,-1)) return false;
// Count the number of elements
//
for(int i = 0; setVec[i].varName; i++) numE++;
if (!numE) return true;
// Determine type of set
//
int sType;
switch(setType)
{case XrdMonRoll::AddOn: sType = isAdon; break;
case XrdMonRoll::Misc: sType = isAdon; break; // Deprecated
case XrdMonRoll::Plugin: sType = isPlug; break;
case XrdMonRoll::Protocol: sType = isPlug; break; // Deprecated
default: sType = isPlug; break;
}
// Allocate a regInfo object
//
RegInfo* regInfo = new RegInfo(setName, sType);
regInfo->Json.key.reserve(numE);
regInfo->Xml.keyBeg.reserve(numE);
regInfo->Xml.keyEnd.reserve(numE);
regInfo->keyVal = new RAtomic_uint*[numE]();
// Create the registry
//
for(int i = 0;i < numE; i++)
{snprintf(buff, sizeof(buff), ",\"%s\":", setVec[i].varName);
regInfo->Json.key.push_back(strdup(buff));
snprintf(buff, sizeof(buff), "<%s>", setVec[i].varName);
regInfo->Xml.keyBeg.push_back(strdup(buff));
snprintf(buff, sizeof(buff), "</%s>", setVec[i].varName);
regInfo->Xml.keyEnd.push_back(strdup(buff));
regInfo->keyVal[i] = &setVec[i].varValu;
}
regInfo->Json.key[0]++;
// Complete the registry
//
snprintf(buff, sizeof(buff), "\"stats_%s\":{", setName);
regInfo->Json.hdr = strdup(buff);
snprintf(buff, sizeof(buff), "<stats id=\"%s\">", setName);
regInfo->Xml.hdr = strdup(buff);
// Insert registry into the map
//
regVec.push_back(regInfo);
// Display information
//
char etxt[256];
snprintf(etxt, sizeof(etxt), "%s set %s registered with %d variable(s)",
(setType == XrdMonRoll::Misc ? "plugin" : "protocol"),setName,numE);
Log.Say("Config monitor: ", etxt);
return true;
}
RAtomic_uint
XrdSys::RAtomic< unsigned int > RAtomic_uint
Definition XrdSysRAtomic.hh:326
XrdMonRoll::setMember::varName
const char * varName
Definition XrdMonRoll.hh:60
XrdMonRoll::setMember::varValu
RAtomic_uint & varValu
Definition XrdMonRoll.hh:60
XrdMonRoll::Plugin
@ Plugin
Definition XrdMonRoll.hh:85
XrdMonRoll::Misc
@ Misc
Definition XrdMonRoll.hh:85
XrdMonRoll::Protocol
@ Protocol
Definition XrdMonRoll.hh:85
XrdMonRoll::AddOn
@ AddOn
Definition XrdMonRoll.hh:85
XrdSysError::Say
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition XrdSysError.cc:141
XrdGlobal::Log
XrdSysError Log
Definition XrdConfig.cc:113

References XrdMonRoll::AddOn, XrdGlobal::Log, XrdMonRoll::Misc, XrdMonRoll::Plugin, XrdMonRoll::Protocol, XrdMonRoll::setMember::varName, and XrdMonRoll::setMember::varValu.

## Registered()

bool XrdMonitor::Registered | ( |  | ) |

inline

Definition at line 54 of file XrdMonitor.hh.

{return !regVec.empty();}

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

- XrdMonitor.hh
- XrdMonitor.cc