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(...)
 

Functions

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

Macro Definition Documentation

◆ dprintf

Function Documentation

◆ Proto_ResourceMonitorHeartBeat()

void Proto_ResourceMonitorHeartBeat ( )

Definition at line 935 of file XrdPfcResourceMonitor.cc.

936{
937 // static const char *trc_pfx = "ResourceMonitorHeartBeat() ";
938
939 // Pause before initial run
940 sleep(1);
941
942 // XXXX Setup initial / constant stats (total RAM, total disk, ???)
943
946
947 S.Lock();
948
950
952
953 S.UnLock();
954
955 // XXXX Schedule initial disk scan, time it!
956 //
957 // TRACE(Info, trc_pfx << "scheduling intial disk scan.");
958 // schedP->Schedule( new ScanAndPurgeJob("XrdPfc::ScanAndPurge") );
959 //
960 // bool scan_and_purge_running = true;
961
962 // XXXX Could we really hold last-usage for all files in memory?
963
964 // XXXX Think how to handle disk-full, scan/purge not finishing:
965 // - start dropping things out of write queue, but only when RAM gets near full;
966 // - monitoring this then becomes a high-priority job, inner loop with sleep of,
967 // say, 5 or 10 seconds.
968
969 while (true)
970 {
971 time_t heartbeat_start = time(0);
972
973 // TRACE(Info, trc_pfx << "HeartBeat starting ...");
974
975 // if sumary monitoring configured, pupulate OucCacheStats:
976 S.Lock();
977
978 // - available / used disk space (files usage calculated elsewhere (maybe))
979
980 // - RAM usage
981 /* XXXX From Cache
982 { XrdSysMutexHelper lck(&m_RAM_mutex);
983 X.MemUsed = m_RAM_used;
984 X.MemWriteQ = m_RAM_write_queue;
985 }
986 */
987
988 // - files opened / closed etc
989
990 // do estimate of available space
991 S.UnLock();
992
993 // if needed, schedule purge in a different thread.
994 // purge is:
995 // - deep scan + gather FSPurgeState
996 // - actual purge
997 //
998 // this thread can continue running and, if needed, stop writing to disk
999 // if purge is taking too long.
1000
1001 // think how data is passed / synchronized between this and purge thread
1002
1003 // !!!! think how stat collection is done and propgated upwards;
1004 // until now it was done once per purge-interval.
1005 // now stats will be added up more often, but purge will be done
1006 // only occasionally.
1007 // also, do we report cumulative values or deltas? cumulative should
1008 // be easier and consistent with summary data.
1009 // still, some are state - like disk usage, num of files.
1010
1011 // Do we take care of directories that need to be newly added into DirState hierarchy?
1012 // I.e., when user creates new directories and these are covered by either full
1013 // spec or by root + depth declaration.
1014
1015 int heartbeat_duration = time(0) - heartbeat_start;
1016
1017 // TRACE(Info, trc_pfx << "HeartBeat finished, heartbeat_duration " << heartbeat_duration);
1018
1019 // int sleep_time = m_fs_state..m_purgeInterval - heartbeat_duration;
1020 int sleep_time = 60 - heartbeat_duration;
1021 if (sleep_time > 0)
1022 {
1023 sleep(sleep_time);
1024 }
1025 }
1026}
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:92

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: