XRootD
Loading...
Searching...
No Matches
XrdCmsMeter.hh
Go to the documentation of this file.
1#ifndef __CMS_METER__H
2#define __CMS_METER__H
3/******************************************************************************/
4/* */
5/* X r d C m s M e t e r . h h */
6/* */
7/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34#include "XrdSys/XrdSysError.hh"
37
39{
40public:
41
42int calcLoad(uint32_t pcpu, uint32_t pio, uint32_t pload,
43 uint32_t pmem, uint32_t ppag);
44
45int calcLoad(int xload, uint32_t pdsk);
46
47int FreeSpace(int &tutil);
48
49void Init();
50
51int isOn() {return Running;}
52
53int Monitor(char *pgm, int itv);
54int Monitor(int itv);
55
56void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false);
57
58void Record(int pcpu, int pnet, int pxeq,
59 int pmem, int ppag, int pdsk);
60
61int Report(int &pcpu, int &pnet, int &pxeq,
62 int &pmem, int &ppag, int &pdsk);
63
64void *Run();
65
66void *RunFS();
67
68void *RunPM();
69
70int numFS() {return fs_nums;}
71
72unsigned int TotalSpace(unsigned int &minfree);
73
74enum vType {manFS = 1, peerFS = 2};
75
76void setVirtual(vType vVal) {Virtual = vVal;}
77
78void setVirtUpdt() {cfsMutex.Lock(); VirtUpdt = 1; cfsMutex.UnLock();}
79
80bool Update(char *line, bool alert=false);
81
84
85private:
86 void calcSpace();
87 char Scale(long long inval, long &outval);
88 void SpaceMsg(int why);
89 void UpdtSpace();
90
91XrdOucStream myMeter;
92XrdSysMutex cfsMutex;
93XrdSysMutex repMutex;
94long long MinFree; // Calculated only once
95long long HWMFree; // Calculated only once
96long long dsk_lpn; // Calculated only once
97long long dsk_tot; // Calculated only once
98long long dsk_free;
99long long dsk_maxf;
100int dsk_util;
101int dsk_calc;
102int fs_nums; // Calculated only once
103int lastFree;
104int lastUtil;
105int noSpace;
106int Running;
107long MinShow; // Calculated only once
108long HWMShow; // Calculated only once
109char MinStype; // Calculated only once
110char HWMStype; // Calculated only once
111char Virtual; // This is a virtual filesystem
112char VirtUpdt; // Data changed for the virtul FS
113
114time_t rep_tod;
115char *monpgm;
116XrdCmsPerfMon *monPerf;
117int monint;
118pthread_t montid;
119
120uint32_t xeq_load;
121uint32_t cpu_load;
122uint32_t mem_load;
123uint32_t pag_load;
124uint32_t net_load;
125int myLoad;
126int prevLoad;
127};
128
129namespace XrdCms
130{
132}
133#endif
void * RunPM()
bool Update(char *line, bool alert=false)
int Monitor(char *pgm, int itv)
void * RunFS()
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)
unsigned int TotalSpace(unsigned int &minfree)
void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false)
int FreeSpace(int &tutil)
int calcLoad(uint32_t pcpu, uint32_t pio, uint32_t pload, uint32_t pmem, uint32_t ppag)
void setVirtUpdt()
void setVirtual(vType vVal)
void * Run()
XrdCmsPerfMon()
Constructor & Destructor.
XrdCmsMeter Meter
Structure used for reporting performance metrics.