#include "RootSizeOnDisk.h"
Definition at line 30 of file RootSizeOnDisk.h.
art::RootSizeOnDisk::RootSizeOnDisk |
( |
std::string const & |
aFileName, |
|
|
TFile * |
aFile |
|
) |
| |
Definition at line 113 of file RootSizeOnDisk.cc.
References contents_, f, fileName_, fillLevel2(), fraction_, art::greaterBySize(), size(), size_, art::detail::sizeOnDisk(), and sum_.
123 set<RootSizeOnDisk::Record> topKeys;
124 TList* keys =
file->GetListOfKeys();
126 for_each(iter.Begin(),
TIter::End(), MyObjects(topKeys));
129 contents_.assign(topKeys.begin(), topKeys.end());
135 file->GetObject(key.name().c_str(), tree);
138 double const f = double(size) / double(
size_);
142 }
else if (key.isTKey()) {
143 TKey* tkey =
file->FindKey(key.name().c_str());
144 Long64_t
const size = tkey->GetNbytes();
146 double const f = double(size) / double(
size_);
void fillLevel2(Record &, TTree *)
typename BeginEndPackage< L >::End End
Long64_t sizeOnDisk(TTree *t)
bool greaterBySize(RootSizeOnDisk::Record const &lhs, RootSizeOnDisk::Record const &rhs)
Records_t const& art::RootSizeOnDisk::contents |
( |
| ) |
const |
|
inline |
std::string const& art::RootSizeOnDisk::filename |
( |
| ) |
const |
|
inline |
void art::RootSizeOnDisk::fillLevel2 |
( |
Record & |
key, |
|
|
TTree * |
tree |
|
) |
| |
|
private |
Definition at line 160 of file RootSizeOnDisk.cc.
References art::RootSizeOnDisk::Record::contents(), f, art::greaterBySize(), n, art::RootSizeOnDisk::Record::size(), size(), and art::detail::sizeOnDisk().
Referenced by RootSizeOnDisk().
162 TObjArray* branches = tree->GetListOfBranches();
163 size_t n = branches->GetEntries();
167 for (
size_t i = 0; i <
n; ++i) {
168 auto subbr =
static_cast<TBranch*
>(branches->At(i));
170 double const f = double(size) / double(key.size());
171 branchInfo.emplace_back(subbr->GetName(),
"TBranch",
size,
f);
175 key.contents(branchInfo);
std::vector< Record > Records_t
Long64_t sizeOnDisk(TTree *t)
bool greaterBySize(RootSizeOnDisk::Record const &lhs, RootSizeOnDisk::Record const &rhs)
double art::RootSizeOnDisk::fraction |
( |
| ) |
const |
|
inline |
void art::RootSizeOnDisk::print |
( |
std::ostream & |
os, |
|
|
double |
minimumFraction |
|
) |
| const |
Definition at line 62 of file RootSizeOnDisk.cc.
References art::RootSizeOnDisk::Record::contents(), filename(), art::RootSizeOnDisk::Record::fraction(), art::RootSizeOnDisk::Record::size(), and sum().
Referenced by contents().
65 os <<
"\nSize on disk for the file: " <<
filename() <<
"\n" 66 <<
"Total size on disk: " <<
size() <<
"\n" 68 os << setw(18) <<
"Size in bytes" << setw(10) <<
" Fraction" 69 <<
" TTree/TKey Name" << endl;
70 for (RootSizeOnDisk::Record
const& key :
contents()) {
71 if (key.isTree() || key.isTKey()) {
72 os << setw(18) << key.size() <<
" " 73 << boost::format(
"%10.3f") % key.fraction() <<
" " << key.name()
76 os << setw(18) << key.size() <<
" " 77 << boost::format(
"%10.3f") % key.fraction() <<
" " << key.name()
78 <<
" (skipped because not a TTree or a TKey; it is a" 79 << key.className() <<
")" << endl;
82 os <<
"------------------------------\n" 83 << setw(18) <<
sum() <<
" " << boost::format(
"%10.3f") %
fraction() <<
" " 87 os <<
"Details for each TTree that occupies more than the fraction " 88 << minimumFraction <<
" of the size on disk.\n" 91 for (RootSizeOnDisk::Record
const& key :
contents()) {
92 if (key.isTree() && (key.fraction() > minimumFraction)) {
93 os <<
"\nDetails for branch: " << key.name() <<
"\n" << endl;
94 os << setw(18) <<
"Size in bytes" << setw(10) <<
" Fraction" 95 <<
" Data Product Name" << endl;
98 for (
auto const& branch : key.contents()) {
100 os << setw(18) << branch.size() <<
" " 101 << boost::format(
"%10.3f") % branch.fraction() <<
" " 102 << branch.name() << endl;
104 double ratio = double(
sum) / double(key.size());
105 os <<
"------------------------------\n" 106 << setw(18) <<
sum <<
" " << boost::format(
"%10.3f") % ratio <<
" "
std::string const & filename() const
Records_t const & contents() const
Long64_t art::RootSizeOnDisk::size |
( |
void |
| ) |
const |
|
inline |
Long64_t art::RootSizeOnDisk::sum |
( |
| ) |
const |
|
inline |
std::string art::RootSizeOnDisk::fileName_ |
|
private |
double art::RootSizeOnDisk::fraction_ |
|
private |
Long64_t art::RootSizeOnDisk::size_ |
|
private |
Long64_t art::RootSizeOnDisk::sum_ |
|
private |
The documentation for this class was generated from the following files: