XrdFileCacheStats.hh

Go to the documentation of this file.
00001 #ifndef __XRDFILECACHE_STATS_HH__
00002 #define __XRDFILECACHE_STATS_HH__
00003 
00004 //----------------------------------------------------------------------------------
00005 // Copyright (c) 2014 by Board of Trustees of the Leland Stanford, Jr., University
00006 // Author: Alja Mrak-Tadel, Matevz Tadel, Brian Bockelman
00007 //----------------------------------------------------------------------------------
00008 // XRootD is free software: you can redistribute it and/or modify
00009 // it under the terms of the GNU Lesser General Public License as published by
00010 // the Free Software Foundation, either version 3 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // XRootD is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Lesser General Public License
00019 // along with XRootD.  If not, see <http://www.gnu.org/licenses/>.
00020 //----------------------------------------------------------------------------------
00021 
00022 #include "XrdOuc/XrdOucCache.hh"
00023 #include "XrdSys/XrdSysPthread.hh"
00024 
00025 namespace XrdFileCache
00026 {
00027    //----------------------------------------------------------------------------
00029    //----------------------------------------------------------------------------
00030    class Stats : public XrdOucCacheStats
00031    {
00032       public:
00033          //----------------------------------------------------------------------
00035          //----------------------------------------------------------------------
00036          Stats() {
00037             m_BytesDisk = m_BytesRam = m_BytesMissed = 0;
00038          }
00039 
00040          long long m_BytesDisk;   
00041          long long m_BytesRam;    
00042          long long m_BytesMissed; 
00043 
00044          inline void AddStat(Stats &Src)
00045          {
00046             XrdOucCacheStats::Add(Src);
00047 
00048             m_MutexXfc.Lock();
00049             m_BytesDisk += Src.m_BytesDisk;
00050             m_BytesRam += Src.m_BytesRam;
00051             m_BytesMissed += Src.m_BytesMissed;
00052 
00053             m_MutexXfc.UnLock();
00054          }
00055 
00056       private:
00057          XrdSysMutex m_MutexXfc;
00058    };
00059 }
00060 
00061 #endif

Generated on 5 Oct 2016 for xrootd by  doxygen 1.4.7