21 m_depth(m_parent->m_depth + 1)
32 m_depth(m_parent->m_depth + 1)
41 std::pair<DsMap_i, bool> ir =
m_subdirs.insert(std::make_pair(dir,
DirState(
this, dir)));
42 return &ir.first->second;
62 if (last_existing_dir)
63 *last_existing_dir = ds;
65 else if (create_subdirs)
71 return ds->
find_path_tok(pt, pos + 1, create_subdirs, last_existing_dir);
83 bool create_subdirs,
DirState **last_existing_dir)
87 if (last_existing_dir)
88 *last_existing_dir =
this;
90 return find_path_tok(pt, 0, create_subdirs, last_existing_dir);
136 for (
auto & [name, daughter] :
m_subdirs)
138 daughter.upward_propagate_initial_scan_usages();
140 DirUsage &dhere = daughter.m_here_usage;
141 DirUsage &dsubdirs = daughter.m_recursive_subdir_usage;
178 bool increment_iter =
true;
184 std::string dir_path;
185 dir_path.reserve(1024);
188 if (unlink_foo(dir_path) == 0) {
192 increment_iter =
false;
218 i->second.reset_stats();
228 i->second.reset_sshot_stats();
240 n_dirs += ds.count_dirs_to_level(max_depth);
252 printf(
"%*d %s usage_here=%lld usage_sub=%lld usage_total=%lld num_ios=%d duration=%d b_hit=%lld b_miss=%lld b_byps=%lld b_wrtn=%lld\n",
265 ds.dump_recursively(name.c_str(), max_depth);
298 printf(
"DataFsState::dump_recursively delta_t = %lld, max_dump_depth = %d\n",
int m_NDirectoriesRemoved
void AddUp(const DirStats &s)
long long m_BytesMissed
number of bytes served from remote and cached
long long m_BytesBypassed
number of bytes served directly through XrdCl
int m_Duration
total duration of all IOs attached
int m_NumIos
number of IO objects attached during this access
long long m_BytesHit
number of bytes served from disk
long long m_BytesWritten
number of bytes written to disk
std::function< int(const std::string &)> unlink_func
time_t m_usage_update_time
time_t m_stats_reset_time
void reset_stats(time_t last_update)
void dump_recursively(int max_depth) const
time_t m_sshot_stats_reset_time
void update_stats_and_usages(time_t last_update, bool purge_empty_dirs, unlink_func unlink_foo)
void reset_sshot_stats(time_t last_update)
DirUsage m_recursive_subdir_usage
DsMap_t::iterator DsMap_i
int count_dirs_to_level(int max_depth) const
DirState * create_child(const std::string &dir)
DirStats m_recursive_subdir_stats
DirState * find_dir(const std::string &dir, bool create_subdirs)
int generate_dir_path(std::string &result)
DirState * find_path_tok(PathTokenizer &pt, int pos, bool create_subdirs, DirState **last_existing_dir=nullptr)
DirState * find_path(const std::string &path, int max_depth, bool parse_as_lfn, bool create_subdirs, DirState **last_existing_dir=nullptr)
void dump_recursively(const char *name, int max_depth) const
void upward_propagate_initial_scan_usages()
void update_stats_and_usages(bool purge_empty_dirs, unlink_func unlink_foo)
void update_from_stats(const DirStats &s)
void update_last_times(const DirUsage &u)
std::vector< const char * > m_dirs