20#include <unordered_map>
26 std::uint64_t fFirstEntry = 0;
27 std::uint32_t fNPages = 0;
28 std::uint32_t fNEntries = 0;
29 std::uint32_t fNBytesOnStorage = 0;
30 std::uint32_t fNBytesInMemory = 0;
41 std::uint64_t fNElements = 0;
42 std::uint64_t fNPages = 0;
43 std::uint64_t fNBytesOnStorage = 0;
44 std::uint32_t fElementSize = 0;
45 std::uint32_t fColumnIndex = 0;
46 std::uint16_t fRepresentationIndex = 0;
48 std::string fFieldName;
49 std::string fFieldDescription;
53 if (fFieldName ==
other.fFieldName) {
54 if (fRepresentationIndex ==
other.fRepresentationIndex)
55 return fColumnIndex <
other.fColumnIndex;
56 return fRepresentationIndex <
other.fRepresentationIndex;
58 return fFieldName <
other.fFieldName;
80 std::vector<ColumnInfo>
columns;
82 std::unordered_map<ROOT::DescriptorId_t, unsigned int>
cluster2Idx;
86 info.fFirstEntry =
cluster.second.GetFirstEntryIndex();
99 if (column.second.IsAliasColumn())
107 info.fPhysicalColumnId = column.second.GetPhysicalId();
108 info.fLogicalColumnId = column.second.GetLogicalId();
109 info.fFieldId = column.second.GetFieldId();
110 info.fColumnIndex = column.second.GetIndex();
112 info.fType = column.second.GetType();
113 info.fRepresentationIndex = column.second.GetRepresentationIndex();
124 const auto &
pageRange =
cluster.second.GetPageRange(column.second.GetPhysicalId());
129 clusters[idx].fNBytesOnStorage +=
page.GetLocator().GetNBytesOnStorage();
132 info.fNBytesOnStorage +=
page.GetLocator().GetNBytesOnStorage();
141 output <<
"============================================================\n";
142 output <<
"NTUPLE: " <<
GetName() <<
"\n";
144 output <<
"------------------------------------------------------------\n";
146 output <<
" # Fields: " <<
GetNFields() <<
"\n";
149 output <<
" # Pages: " <<
nPages <<
"\n";
152 output <<
" Compression rate: " << std::fixed << std::setprecision(2)
154 output <<
" Header size: " << headerSize <<
" B"
156 output <<
" Footer size: " <<
footerSize <<
" B"
158 output <<
" Metadata / data: " << std::fixed << std::setprecision(3)
160 output <<
"------------------------------------------------------------\n";
161 output <<
"CLUSTER DETAILS\n";
162 output <<
"------------------------------------------------------------" << std::endl;
165 for (
unsigned int i = 0; i <
clusters.size(); ++i) {
166 output <<
" # " << std::setw(5) << i <<
" Entry range: [" <<
clusters[i].fFirstEntry <<
".."
168 output <<
" " <<
" # Pages: " <<
clusters[i].fNPages <<
"\n";
169 output <<
" " <<
" Size on storage: " <<
clusters[i].fNBytesOnStorage <<
" B\n";
170 output <<
" " <<
" Compression: " << std::fixed << std::setprecision(2)
171 << float(
clusters[i].fNBytesInMemory) / float(
float(
clusters[i].fNBytesOnStorage)) << std::endl;
174 output <<
"------------------------------------------------------------\n";
175 output <<
"COLUMN DETAILS\n";
176 output <<
"------------------------------------------------------------\n";
178 col.fFieldName = GetFieldName(col.fFieldId, *
this).substr(1);
179 col.fFieldDescription = GetFieldDescription(col.fFieldId, *
this);
182 for (
const auto &col :
columns) {
183 auto avgPageSize = (col.fNPages == 0) ? 0 : (col.fNBytesOnStorage / col.fNPages);
185 std::string
nameAndType = std::string(
" ") + col.fFieldName +
" [#" + std::to_string(col.fColumnIndex);
186 if (col.fRepresentationIndex > 0)
187 nameAndType +=
" / R." + std::to_string(col.fRepresentationIndex);
189 std::string
id = std::string(
"{id:") + std::to_string(col.fLogicalColumnId) +
"}";
190 if (col.fLogicalColumnId != col.fPhysicalColumnId)
191 id +=
" --alias--> " + std::to_string(col.fPhysicalColumnId);
193 if (!col.fFieldDescription.empty())
194 output <<
" Description: " << col.fFieldDescription <<
"\n";
195 output <<
" # Elements: " << col.fNElements <<
"\n";
196 output <<
" # Pages: " << col.fNPages <<
"\n";
198 output <<
" Avg page size: " <<
avgPageSize <<
" B\n";
199 output <<
" Size on storage: " << col.fNBytesOnStorage <<
" B\n";
200 output <<
" Compression: " << std::fixed << std::setprecision(2)
201 << float(col.fElementSize * col.fNElements) / float(col.fNBytesOnStorage) <<
"\n";
202 output <<
"............................................................" << std::endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Bool_t operator<(const TDatime &d1, const TDatime &d2)
Bool_t operator==(const TDatime &d1, const TDatime &d2)
The available trivial, native content types of a column.
static const char * GetColumnTypeName(ROOT::ENTupleColumnType type)
static std::unique_ptr< RColumnElementBase > Generate(ROOT::ENTupleColumnType type)
If CppT == void, use the default C++ type for the given column type.
The on-storage metadata of an RNTuple.
std::uint64_t GetOnDiskFooterSize() const
const std::string & GetName() const
ROOT::NTupleSize_t GetNEntries() const
We know the number of entries from adding the cluster summaries.
std::unordered_map< ROOT::DescriptorId_t, RClusterDescriptor > fClusterDescriptors
Potentially a subset of all the available clusters.
std::size_t GetNClusters() const
std::size_t GetNPhysicalColumns() const
void PrintInfo(std::ostream &output) const
std::unordered_map< ROOT::DescriptorId_t, RColumnDescriptor > fColumnDescriptors
std::size_t GetNFields() const
std::uint64_t GetOnDiskHeaderSize() const
std::size_t GetNLogicalColumns() const
const_iterator begin() const
const_iterator end() const
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId