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;
165 sub_ds.update_stats_and_usages(reap_candidates);
179 sub_ds.m_here_stats.Reset();
180 sub_ds.m_recursive_subdir_stats.Reset();
182 if (reap_candidates && sub_ds.is_empty_leaf())
183 reap_candidates->push_back(&sub_ds);
213 i->second.reset_sshot_stats();
225 n_dirs += ds.count_dirs_to_level(max_depth);
237 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",
250 ds.dump_recursively(name.c_str(), max_depth);
262 if (collect_reap_candidates)
278 long long total_residue = 0;
282 if ( ! ds->is_empty_leaf())
285 std::string dir_path;
286 dir_path.reserve(1024);
287 ds->generate_dir_path(dir_path);
288 if (unlink_foo(dir_path) != 0)
297 parent->
m_StBlocksFuzz += std::llabs(residue) + ds->m_StBlocksFuzz;
299 total_residue += residue;
305 return total_residue;
319 printf(
"DataFsState::dump_recursively delta_t = %lld, max_dump_depth = %d\n",
int m_NDirectoriesRemoved
void AddUp(const DirStats &s)
long long m_StBlocksRemoved
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
std::vector< DirState * > m_reap_candidates
long long m_st_blocks_fuzz
time_t m_stats_reset_time
void dump_recursively(int max_depth) const
time_t m_sshot_stats_reset_time
void update_stats_and_usages(time_t last_update, bool collect_reap_candidates)
long long reap_empty_leaf_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)
long long m_RecursiveStBlocksFuzz
sum over the subdirs, set by propagation
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 update_stats_and_usages(std::vector< DirState * > *reap_candidates=nullptr)
void dump_recursively(const char *name, int max_depth) const
void upward_propagate_initial_scan_usages()
bool is_empty_leaf() const
void update_from_stats(const DirStats &s)
void update_last_times(const DirUsage &u)
std::vector< const char * > m_dirs