Loading...
Searching...
No Matches
XrdCmsMeter.hh
Go to the documentation of this file.
#ifndef __CMS_METER__H
#define __CMS_METER__H
/******************************************************************************/
/* */
/* X r d C m s M e t e r . h h */
/* */
/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
/* All Rights Reserved */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include "XrdCms/XrdCmsPerfMon.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdOuc/XrdOucStream.hh"
class XrdCmsMeter : public XrdCmsPerfMon
{
public:
int calcLoad(uint32_t pcpu, uint32_t pio, uint32_t pload,
uint32_t pmem, uint32_t ppag);
int calcLoad(int xload, uint32_t pdsk);
int FreeSpace(int &tutil);
void Init();
int isOn() {return Running;}
int Monitor(char *pgm, int itv);
int Monitor(int itv);
void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false);
void Record(int pcpu, int pnet, int pxeq,
int pmem, int ppag, int pdsk);
int Report(int &pcpu, int &pnet, int &pxeq,
int &pmem, int &ppag, int &pdsk);
void *Run();
void *RunFS();
void *RunPM();
int numFS() {return fs_nums;}
unsigned int TotalSpace(unsigned int &minfree);
enum vType {manFS = 1, peerFS = 2};
void setVirtual(vType vVal) {Virtual = vVal;}
void setVirtUpdt() {cfsMutex.Lock(); VirtUpdt = 1; cfsMutex.UnLock();}
bool Update(char *line, bool alert=false);
XrdCmsMeter();
~XrdCmsMeter();
private:
void calcSpace();
char Scale(long long inval, long &outval);
void SpaceMsg(int why);
void UpdtSpace();
XrdOucStream myMeter;
XrdSysMutex cfsMutex;
XrdSysMutex repMutex;
long long MinFree; // Calculated only once
long long HWMFree; // Calculated only once
long long dsk_lpn; // Calculated only once
long long dsk_tot; // Calculated only once
long long dsk_free;
long long dsk_maxf;
int dsk_util;
int dsk_calc;
int fs_nums; // Calculated only once
int lastFree;
int lastUtil;
int noSpace;
int Running;
long MinShow; // Calculated only once
long HWMShow; // Calculated only once
char MinStype; // Calculated only once
char HWMStype; // Calculated only once
char Virtual; // This is a virtual filesystem
char VirtUpdt; // Data changed for the virtul FS
time_t rep_tod;
char *monpgm;
XrdCmsPerfMon *monPerf;
int monint;
pthread_t montid;
uint32_t xeq_load;
uint32_t cpu_load;
uint32_t mem_load;
uint32_t pag_load;
uint32_t net_load;
int myLoad;
int prevLoad;
};
namespace XrdCms
{
extern XrdCmsMeter Meter;
}
#endif
XrdCmsPerfMon.hh
XrdOucStream.hh
XrdSysError.hh
XrdSysPthread.hh
XrdCmsMeter
Definition XrdCmsMeter.hh:39
XrdCmsMeter::RunPM
void * RunPM()
Definition XrdCmsMeter.cc:449
XrdCmsMeter::~XrdCmsMeter
~XrdCmsMeter()
Definition XrdCmsMeter.cc:120
XrdCmsMeter::Update
bool Update(char *line, bool alert=false)
Definition XrdCmsMeter.cc:502
XrdCmsMeter::Monitor
int Monitor(char *pgm, int itv)
Definition XrdCmsMeter.cc:258
XrdCmsMeter::RunFS
void * RunFS()
Definition XrdCmsMeter.cc:424
XrdCmsMeter::Init
void Init()
Definition XrdCmsMeter.cc:191
XrdCmsMeter::vType
vType
Definition XrdCmsMeter.hh:74
XrdCmsMeter::peerFS
@ peerFS
Definition XrdCmsMeter.hh:74
XrdCmsMeter::manFS
@ manFS
Definition XrdCmsMeter.hh:74
XrdCmsMeter::Record
void Record(int pcpu, int pnet, int pxeq, int pmem, int ppag, int pdsk)
Definition XrdCmsMeter.cc:351
XrdCmsMeter::Report
int Report(int &pcpu, int &pnet, int &pxeq, int &pmem, int &ppag, int &pdsk)
Definition XrdCmsMeter.cc:374
XrdCmsMeter::numFS
int numFS()
Definition XrdCmsMeter.hh:70
XrdCmsMeter::TotalSpace
unsigned int TotalSpace(unsigned int &minfree)
Definition XrdCmsMeter.cc:468
XrdCmsMeter::PutInfo
void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false)
Definition XrdCmsMeter.cc:324
XrdCmsMeter::FreeSpace
int FreeSpace(int &tutil)
Definition XrdCmsMeter.cc:158
XrdCmsMeter::calcLoad
int calcLoad(uint32_t pcpu, uint32_t pio, uint32_t pload, uint32_t pmem, uint32_t ppag)
Definition XrdCmsMeter.cc:130
XrdCmsMeter::setVirtUpdt
void setVirtUpdt()
Definition XrdCmsMeter.hh:78
XrdCmsMeter::setVirtual
void setVirtual(vType vVal)
Definition XrdCmsMeter.hh:76
XrdCmsMeter::Run
void * Run()
Definition XrdCmsMeter.cc:402
XrdCmsMeter::isOn
int isOn()
Definition XrdCmsMeter.hh:51
XrdCmsMeter::XrdCmsMeter
XrdCmsMeter()
Definition XrdCmsMeter.cc:86
XrdCmsPerfMon
Definition XrdCmsPerfMon.hh:46
XrdCmsPerfMon::XrdCmsPerfMon
XrdCmsPerfMon()
Constructor & Destructor.
Definition XrdCmsPerfMon.hh:127
XrdOucStream
Definition XrdOucStream.hh:47
XrdSysMutex
Definition XrdSysPthread.hh:165
XrdCms
Definition YProtocol.hh:78
XrdCms::Meter
XrdCmsMeter Meter
Definition XrdCmsMeter.hh:131
XrdCmsPerfMon::PerfInfo
Structure used for reporting performance metrics.
Definition XrdCmsPerfMon.hh:81