XRootD
Loading...
Searching...
No Matches
XrdPfcResourceMonitor.cc File Reference
#include "XrdPfcResourceMonitor.hh"
#include "XrdPfc.hh"
#include "XrdPfcPathParseTools.hh"
#include "XrdPfcFsTraversal.hh"
#include "XrdPfcDirState.hh"
#include "XrdPfcDirStateSnapshot.hh"
#include "XrdPfcDirStatePurgeshot.hh"
#include "XrdPfcTrace.hh"
#include "XrdPfcPurgePin.hh"
#include "XrdOss/XrdOss.hh"
#include <algorithm>
+ Include dependency graph for XrdPfcResourceMonitor.cc:

Go to the source code of this file.

Namespaces

namespace  XrdPfc
 

Macros

#define dprintf(...)   (void(0))
 

Functions

void XrdPfc::OldStylePurgeDriver (DataFsPurgeshot &ps)
 
void Proto_ResourceMonitorHeartBeat ()
 

Macro Definition Documentation

◆ dprintf

Function Documentation

◆ Proto_ResourceMonitorHeartBeat()

void Proto_ResourceMonitorHeartBeat ( )

Definition at line 871 of file XrdPfcResourceMonitor.cc.

872{
873 // static const char *trc_pfx = "ResourceMonitorHeartBeat() ";
874
875 // Pause before initial run
876 sleep(1);
877
878 // XXXX Setup initial / constant stats (total RAM, total disk, ???)
879
882
883 S.Lock();
884
886
888
889 S.UnLock();
890
891 // XXXX Schedule initial disk scan, time it!
892 //
893 // TRACE(Info, trc_pfx << "scheduling intial disk scan.");
894 // schedP->Schedule( new ScanAndPurgeJob("XrdPfc::ScanAndPurge") );
895 //
896 // bool scan_and_purge_running = true;
897
898 // XXXX Could we really hold last-usage for all files in memory?
899
900 // XXXX Think how to handle disk-full, scan/purge not finishing:
901 // - start dropping things out of write queue, but only when RAM gets near full;
902 // - monitoring this then becomes a high-priority job, inner loop with sleep of,
903 // say, 5 or 10 seconds.
904
905 while (true)
906 {
907 time_t heartbeat_start = time(0);
908
909 // TRACE(Info, trc_pfx << "HeartBeat starting ...");
910
911 // if sumary monitoring configured, pupulate OucCacheStats:
912 S.Lock();
913
914 // - available / used disk space (files usage calculated elsewhere (maybe))
915
916 // - RAM usage
917 /* XXXX From Cache
918 { XrdSysMutexHelper lck(&m_RAM_mutex);
919 X.MemUsed = m_RAM_used;
920 X.MemWriteQ = m_RAM_write_queue;
921 }
922 */
923
924 // - files opened / closed etc
925
926 // do estimate of available space
927 S.UnLock();
928
929 // if needed, schedule purge in a different thread.
930 // purge is:
931 // - deep scan + gather FSPurgeState
932 // - actual purge
933 //
934 // this thread can continue running and, if needed, stop writing to disk
935 // if purge is taking too long.
936
937 // think how data is passed / synchronized between this and purge thread
938
939 // !!!! think how stat collection is done and propgated upwards;
940 // until now it was done once per purge-interval.
941 // now stats will be added up more often, but purge will be done
942 // only occasionally.
943 // also, do we report cumulative values or deltas? cumulative should
944 // be easier and consistent with summary data.
945 // still, some are state - like disk usage, num of files.
946
947 // Do we take care of directories that need to be newly added into DirState hierarchy?
948 // I.e., when user creates new directories and these are covered by either full
949 // spec or by root + depth declaration.
950
951 int heartbeat_duration = time(0) - heartbeat_start;
952
953 // TRACE(Info, trc_pfx << "HeartBeat finished, heartbeat_duration " << heartbeat_duration);
954
955 // int sleep_time = m_fs_state..m_purgeInterval - heartbeat_duration;
956 int sleep_time = 60 - heartbeat_duration;
957 if (sleep_time > 0)
958 {
959 sleep(sleep_time);
960 }
961 }
962}
struct XrdOucCacheStats::CacheStats X
XrdOucCacheStats Statistics
static const Configuration & Conf()
Definition XrdPfc.cc:134
static Cache & GetInstance()
Singleton access.
Definition XrdPfc.cc:132
long long m_RamAbsAvailable
available from configuration
Definition XrdPfc.hh:109
long long m_diskTotalSpace
total disk space on configured partition or oss space
Definition XrdPfc.hh:91

References XrdPfc::Cache::Conf(), XrdOucCacheStats::CacheStats::DiskSize, XrdPfc::Cache::GetInstance(), XrdOucCacheStats::Lock(), XrdPfc::Configuration::m_diskTotalSpace, XrdPfc::Configuration::m_RamAbsAvailable, XrdOucCacheStats::CacheStats::MemSize, XrdOucCache::Statistics, XrdOucCacheStats::UnLock(), and XrdOucCacheStats::X.

+ Here is the call graph for this function: