80 std::vector<ColumnInfo> columns;
81 std::vector<ClusterInfo> clusters;
82 std::unordered_map<ROOT::DescriptorId_t, unsigned int> cluster2Idx;
86 info.fFirstEntry = cluster.second.GetFirstEntryIndex();
87 info.fNEntries = cluster.second.GetNEntries();
88 cluster2Idx[cluster.first] = clusters.size();
89 clusters.emplace_back(info);
92 std::uint64_t nBytesOnStorage = 0;
93 std::uint64_t nBytesInMemory = 0;
94 std::uint64_t nPages = 0;
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();
111 info.fElementSize = elementSize;
112 info.fType = column.second.GetType();
113 info.fRepresentationIndex = column.second.GetRepresentationIndex();
116 auto columnRange = cluster.second.GetColumnRange(column.second.GetPhysicalId());
117 if (columnRange.IsSuppressed())
120 info.fNElements += columnRange.GetNElements();
121 if (compression == -1 && columnRange.GetCompressionSettings()) {
122 compression = *columnRange.GetCompressionSettings();
124 const auto &pageRange = cluster.second.GetPageRange(column.second.GetPhysicalId());
125 auto idx = cluster2Idx[cluster.first];
126 for (
const auto &page : pageRange.GetPageInfos()) {
127 nBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
128 nBytesInMemory += page.GetNElements() * elementSize;
129 clusters[idx].fNBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
130 clusters[idx].fNBytesInMemory += page.GetNElements() * elementSize;
131 ++clusters[idx].fNPages;
132 info.fNBytesOnStorage += page.GetLocator().GetNBytesOnStorage();
137 columns.emplace_back(info);
141 output <<
"============================================================\n";
142 output <<
"NTUPLE: " <<
GetName() <<
"\n";
143 output <<
"Compression: " << compression <<
"\n";
144 output <<
"------------------------------------------------------------\n";
146 output <<
" # Fields: " <<
GetNFields() <<
"\n";
149 output <<
" # Pages: " << nPages <<
"\n";
151 output <<
" Size on storage: " << nBytesOnStorage <<
" B" <<
"\n";
152 output <<
" Compression rate: " << std::fixed << std::setprecision(2)
153 << float(nBytesInMemory) / float(nBytesOnStorage) <<
"\n";
154 output <<
" Header size: " << headerSize <<
" B"
156 output <<
" Footer size: " << footerSize <<
" B"
158 output <<
" Metadata / data: " << std::fixed << std::setprecision(3)
159 << float(headerSize + footerSize) / float(nBytesOnStorage) <<
"\n";
160 output <<
"------------------------------------------------------------\n";
161 output <<
"CLUSTER DETAILS\n";
162 output <<
"------------------------------------------------------------" << std::endl;
164 std::sort(clusters.begin(), clusters.end());
165 for (
unsigned int i = 0; i < clusters.size(); ++i) {
166 output <<
" # " << std::setw(5) << i <<
" Entry range: [" << clusters[i].fFirstEntry <<
".."
167 << clusters[i].fFirstEntry + clusters[i].fNEntries - 1 <<
"] -- " << clusters[i].fNEntries <<
"\n";
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";
177 for (
auto &col : columns) {
178 col.fFieldName = GetFieldName(col.fFieldId, *
this).substr(1);
179 col.fFieldDescription = GetFieldDescription(col.fFieldId, *
this);
181 std::sort(columns.begin(), columns.end());
182 for (
const auto &col : columns) {
183 auto avgPageSize = (col.fNPages == 0) ? 0 : (col.fNBytesOnStorage / col.fNPages);
184 auto avgElementsPerPage = (col.fNPages == 0) ? 0 : (col.fNElements / 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);
192 output << nameAndType << std::setw(60 - nameAndType.length()) <<
id <<
"\n";
193 if (!col.fFieldDescription.empty())
194 output <<
" Description: " << col.fFieldDescription <<
"\n";
195 output <<
" # Elements: " << col.fNElements <<
"\n";
196 output <<
" # Pages: " << col.fNPages <<
"\n";
197 output <<
" Avg elements / page: " << avgElementsPerPage <<
"\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;