81 std::vector<ColumnInfo> columns;
82 std::vector<ClusterInfo> clusters;
83 std::unordered_map<ROOT::DescriptorId_t, unsigned int> cluster2Idx;
87 info.fFirstEntry = cluster.second.GetFirstEntryIndex();
88 info.fNEntries = cluster.second.GetNEntries();
89 cluster2Idx[cluster.first] = clusters.size();
90 clusters.emplace_back(info);
93 std::uint64_t nBytesOnStorage = 0;
94 std::uint64_t nBytesInMemory = 0;
95 std::uint64_t nPages = 0;
100 if (column.second.IsAliasColumn())
108 info.fPhysicalColumnId = column.second.GetPhysicalId();
109 info.fLogicalColumnId = column.second.GetLogicalId();
110 info.fFieldId = column.second.GetFieldId();
111 info.fColumnIndex = column.second.GetIndex();
112 info.fElementSize = elementSize;
113 info.fType = column.second.GetType();
114 info.fRepresentationIndex = column.second.GetRepresentationIndex();
117 auto columnRange = cluster.second.GetColumnRange(column.second.GetPhysicalId());
118 if (columnRange.IsSuppressed())
121 info.fNElements += columnRange.GetNElements();
122 if (compression == -1 && columnRange.GetCompressionSettings()) {
123 compression = *columnRange.GetCompressionSettings();
125 const auto &pageRange = cluster.second.GetPageRange(column.second.GetPhysicalId());
126 auto idx = cluster2Idx[cluster.first];
127 for (
const auto &page : pageRange.GetPageInfos()) {
128 nBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
129 nBytesInMemory += page.GetNElements() * elementSize;
130 clusters[idx].fNBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
131 clusters[idx].fNBytesInMemory += page.GetNElements() * elementSize;
132 ++clusters[idx].fNPages;
133 info.fNBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
138 columns.emplace_back(info);
142 output <<
"============================================================\n";
143 output <<
"NTUPLE: " <<
GetName() <<
"\n";
144 output <<
"Compression: " << compression <<
"\n";
145 output <<
"------------------------------------------------------------\n";
147 output <<
" # Fields: " <<
GetNFields() <<
"\n";
150 output <<
" # Pages: " << nPages <<
"\n";
152 output <<
" Size on storage: " << nBytesOnStorage <<
" B" <<
"\n";
153 output <<
" Compression rate: " << std::fixed << std::setprecision(2)
154 << float(nBytesInMemory) / float(nBytesOnStorage) <<
"\n";
155 output <<
" Header size: " << headerSize <<
" B"
157 output <<
" Footer size: " << footerSize <<
" B"
159 output <<
" Metadata / data: " << std::fixed << std::setprecision(3)
160 << float(headerSize + footerSize) / float(nBytesOnStorage) <<
"\n";
161 output <<
"------------------------------------------------------------\n";
162 output <<
"CLUSTER DETAILS\n";
163 output <<
"------------------------------------------------------------" << std::endl;
165 std::sort(clusters.begin(), clusters.end());
166 for (
unsigned int i = 0; i < clusters.size(); ++i) {
167 output <<
" # " << std::setw(5) << i <<
" Entry range: [" << clusters[i].fFirstEntry <<
".."
168 << clusters[i].fFirstEntry + clusters[i].fNEntries - 1 <<
"] -- " << clusters[i].fNEntries <<
"\n";
169 output <<
" " <<
" # Pages: " << clusters[i].fNPages <<
"\n";
170 output <<
" " <<
" Size on storage: " << clusters[i].fNBytesOnStorage <<
" B\n";
171 output <<
" " <<
" Compression: " << std::fixed << std::setprecision(2)
172 << float(clusters[i].fNBytesInMemory) / float(
float(clusters[i].fNBytesOnStorage)) << std::endl;
175 output <<
"------------------------------------------------------------\n";
176 output <<
"COLUMN DETAILS\n";
177 output <<
"------------------------------------------------------------\n";
178 for (
auto &col : columns) {
179 col.fFieldName = GetFieldName(col.fFieldId, *
this).substr(1);
180 col.fFieldDescription = GetFieldDescription(col.fFieldId, *
this);
182 std::sort(columns.begin(), columns.end());
183 for (
const auto &col : columns) {
184 auto avgPageSize = (col.fNPages == 0) ? 0 : (col.fNBytesOnStorage / col.fNPages);
185 auto avgElementsPerPage = (col.fNPages == 0) ? 0 : (col.fNElements / col.fNPages);
186 std::string nameAndType = std::string(
" ") + col.fFieldName +
" [#" + std::to_string(col.fColumnIndex);
187 if (col.fRepresentationIndex > 0)
188 nameAndType +=
" / R." + std::to_string(col.fRepresentationIndex);
190 std::string
id = std::string(
"{id:") + std::to_string(col.fLogicalColumnId) +
"}";
191 if (col.fLogicalColumnId != col.fPhysicalColumnId)
192 id +=
" --alias--> " + std::to_string(col.fPhysicalColumnId);
193 output << nameAndType << std::setw(60 - nameAndType.length()) <<
id <<
"\n";
194 if (!col.fFieldDescription.empty())
195 output <<
" Description: " << col.fFieldDescription <<
"\n";
196 output <<
" # Elements: " << col.fNElements <<
"\n";
197 output <<
" # Pages: " << col.fNPages <<
"\n";
198 output <<
" Avg elements / page: " << avgElementsPerPage <<
"\n";
199 output <<
" Avg page size: " << avgPageSize <<
" B\n";
200 output <<
" Size on storage: " << col.fNBytesOnStorage <<
" B\n";
201 output <<
" Compression: " << std::fixed << std::setprecision(2)
202 << float(col.fElementSize * col.fNElements) / float(col.fNBytesOnStorage) <<
"\n";
203 output <<
"............................................................" << std::endl;