xrootd
XrdXrootdMonFile.hh
Go to the documentation of this file.
00001 #ifndef __XRDXROOTDMONFILE__
00002 #define __XRDXROOTDMONFILE__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                   X r d X r o o t d M o n F i l e . h h                    */
00006 /*                                                                            */
00007 /* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /*                                                                            */
00012 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00033 #include "Xrd/XrdJob.hh"
00034 #include "XrdSys/XrdSysPthread.hh"
00035 #include "XrdXrootd/XrdXrootdMonFMap.hh"
00036 #include "XrdXrootd/XrdXrootdMonitor.hh"
00037 
00038 class XrdScheduler;
00039 class XrdSysError;
00040 class XrdXrootdFileStats;
00041 class XrdXrootdMonHeader;
00042 class XrdXrootdMonTrace;
00043   
00044 class XrdXrootdMonFile : XrdJob
00045 {
00046 public:
00047 
00048 static void Close(XrdXrootdFileStats *fsP, bool isDisc=false);
00049 
00050 static void Defaults(int intv, int opts, int iocnt);
00051 
00052 static void Disc(unsigned int usrID);
00053 
00054        void DoIt();
00055 
00056 static bool Init(XrdScheduler *sp, XrdSysError  *errp, int bfsz=65472);
00057 
00058 static void Open(XrdXrootdFileStats *fsP,
00059                  const char *Path, unsigned int uDID, bool isRW);
00060 
00061        XrdXrootdMonFile() : XrdJob("monitor fstat") {}
00062       ~XrdXrootdMonFile() {}
00063 
00064 private:
00065 
00066 static void                 DoXFR();
00067 static void                 DoXFR(XrdXrootdFileStats *fsP);
00068 static void                 Flush();
00069 static char                *GetSlot(int slotSZ);
00070                           
00071 static XrdSysError         *eDest;
00072 static XrdScheduler        *Sched;
00073 static XrdSysMutex          bfMutex;
00074 static XrdSysMutex          fmMutex;
00075 static XrdXrootdMonFMap     fmMap[XrdXrootdMonFMap::mapNum];
00076 static short                fmUse[XrdXrootdMonFMap::mapNum];
00077 static char                *repBuff;
00078 static XrdXrootdMonHeader  *repHdr;
00079 static XrdXrootdMonFileTOD *repTOD;
00080 static char                *repNext;
00081 static char                *repFirst;
00082 static char                *repLast;
00083 static int                  totRecs;
00084 static int                  xfrRecs;
00085 static int                  repSize;
00086 static int                  repTime;
00087 static int                  fmHWM;
00088 static int                  crecSize;
00089 static int                  xfrCnt;
00090 static int                  xfrRem;
00091 static XrdXrootdMonFileXFR  xfrRec;
00092 static short                crecNLen;
00093 static short                trecNLen;
00094 static char                 fsLFN;
00095 static char                 fsLVL;
00096 static char                 fsOPS;
00097 static char                 fsSSQ;
00098 static char                 fsXFR;
00099 static char                 crecFlag;
00100 };
00101 #endif