35 std::unique_ptr<ROOT::Experimental::Internal::RPageSource>
pageSource)
52 fUncompressedSize = 0;
54 for (
const auto &
colDesc : fDescriptor.GetColumnIterable()) {
77 if (!fCompressionSettings &&
columnRange.GetCompressionSettings()) {
78 fCompressionSettings = *
columnRange.GetCompressionSettings();
79 }
else if (fCompressionSettings &&
columnRange.GetCompressionSettings() &&
80 (*fCompressionSettings != *
columnRange.GetCompressionSettings())) {
85 std::to_string(*fCompressionSettings) +
" vs " +
86 std::to_string(*
columnRange.GetCompressionSettings()) +
87 ") for column with physical ID " + std::to_string(
colId)));
130std::vector<ROOT::DescriptorId_t>
133 std::vector<ROOT::DescriptorId_t>
colIds;
140 for (
const auto &col : fDescriptor.GetColumnIterable(
currId)) {
141 if (col.IsAliasColumn()) {
145 colIds.emplace_back(col.GetPhysicalId());
148 for (
const auto &
fld : fDescriptor.GetFieldIterable(
currId)) {
156std::unique_ptr<ROOT::Experimental::RNTupleInspector>
163std::unique_ptr<ROOT::Experimental::RNTupleInspector>
172 if (!fCompressionSettings)
175 int algorithm = *fCompressionSettings / 100;
176 int level = *fCompressionSettings - (
algorithm * 100);
179 " (level " + std::to_string(level) +
")";
207const std::vector<ROOT::DescriptorId_t>
210 std::vector<ROOT::DescriptorId_t>
colIds;
222 std::set<ROOT::ENTupleColumnType>
colTypes;
238 std::uint32_t count = 0;
243 this->nElems +=
colInfo.GetNElements();
244 this->compressedSize +=
colInfo.GetCompressedSize();
245 this->uncompressedSize +=
colInfo.GetUncompressedSize();
246 this->nPages +=
colInfo.GetNPages();
250 float GetCompressionFactor()
const
258 std::map<ENTupleColumnType, ColumnTypeInfo>
colTypeInfo;
267 output <<
" column type | count | # elements | compressed bytes | uncompressed bytes | compression ratio | "
269 <<
"----------------|---------|-------------|------------------|--------------------|-------------------|-"
274 <<
typeInfo.count <<
" |" << std::setw(12) <<
typeInfo.nElems <<
" |" << std::setw(17)
275 <<
typeInfo.compressedSize <<
" |" << std::setw(19) <<
typeInfo.uncompressedSize <<
" |" << std::fixed
276 << std::setprecision(3) << std::setw(18) <<
typeInfo.GetCompressionFactor() <<
" |" << std::setw(6)
277 <<
typeInfo.nPages <<
" " << std::endl;
280 output <<
"columnType,count,nElements,compressedSize,uncompressedSize,compressionFactor,nPages" << std::endl;
283 <<
"," <<
typeInfo.compressedSize <<
"," <<
typeInfo.uncompressedSize <<
"," << std::fixed
284 << std::setprecision(3) <<
typeInfo.GetCompressionFactor() <<
"," <<
typeInfo.nPages << std::endl;
287 default:
R__ASSERT(
false &&
"Invalid print format");
293 std::string_view histName, std::string_view
histTitle)
295 if (histName.empty()) {
315 auto hist = std::make_unique<TH1D>(std::string(histName).c_str(), std::string(
histTitle).c_str(), 1, 0, 1);
335 std::string histName, std::string
histTitle,
size_t nBins)
344 std::string histName,
347 if (histName.empty())
356 return std::make_unique<TH1D>(histName.c_str(),
histTitle.c_str(), 64, 0, 0);
358 auto hist = std::unique_ptr<TH1D>(
dynamic_cast<TH1D *
>(
perTypeHist->GetHists()->First()));
360 hist->SetName(histName.c_str());
362 hist->SetXTitle(
"Page size (B)");
363 hist->SetYTitle(
"N_{pages}");
369 std::string histName, std::string
histTitle,
size_t nBins)
371 auto hist = std::make_unique<TH1D>();
373 if (histName.empty())
374 histName =
"pageSizeHist";
375 hist->SetName(histName.c_str());
379 hist->SetXTitle(
"Page size (B)");
380 hist->SetYTitle(
"N_{pages}");
384 auto colInfo = GetColumnInspector(colId);
385 pageSizes.insert(pageSizes.end(), colInfo.GetCompressedPageSizes().begin(),
386 colInfo.GetCompressedPageSizes().end());
402std::unique_ptr<THStack>
404 std::string histName, std::string
histTitle,
size_t nBins)
406 if (histName.empty())
407 histName =
"pageSizeHist";
409 histTitle =
"Per-column type page size distribution";
413 double histMin = std::numeric_limits<double>::max();
415 std::map<ROOT::ENTupleColumnType, std::vector<std::uint64_t>>
pageSizes;
430 auto colInfo = GetColumnInspector(colId);
431 pageSizesForColType.insert(pageSizesForColType.end(), colInfo.GetCompressedPageSizes().begin(),
432 colInfo.GetCompressedPageSizes().end());
445 auto hist = std::make_unique<TH1D>(
465 if (
fieldId >= fDescriptor.GetNFields()) {
469 return fFieldTreeInfo.at(
fieldId);
481 return GetFieldTreeInspector(
fieldId);
502const std::vector<ROOT::DescriptorId_t>
505 std::vector<ROOT::DescriptorId_t>
fieldIds;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
std::string & operator+=(std::string &left, const TString &right)
The available trivial, native content types of a column.
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Used from the RNTuple class to build a datasource if the anchor is already available.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
ROOT::DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level NTuple data fields.
Provides column-level storage information.
Provides field-level storage information.
Inspect on-disk and storage-related information of an RNTuple.
std::vector< ROOT::DescriptorId_t > GetColumnsByFieldId(ROOT::DescriptorId_t fieldId) const
Get the columns that make up the given field, including its subfields.
const RFieldTreeInspector & GetFieldTreeInspector(ROOT::DescriptorId_t fieldId) const
Get storage information for a given (sub)field by ID.
std::unique_ptr< Internal::RPageSource > fPageSource
std::unique_ptr< TH1D > GetPageSizeDistribution(ROOT::DescriptorId_t physicalColumnId, std::string histName="", std::string histTitle="", size_t nBins=64)
Get a histogram containing the size distribution of the compressed pages for an individual column.
size_t GetColumnCountByType(ROOT::ENTupleColumnType colType) const
Get the number of columns of a given type present in the RNTuple.
const std::vector< ROOT::ENTupleColumnType > GetColumnTypes()
Get all column types present in the RNTuple being inspected.
RNTupleInspector(std::unique_ptr< Internal::RPageSource > pageSource)
size_t GetFieldCountByType(const std::regex &typeNamePattern, bool searchInSubfields=true) const
Get the number of fields of a given type or class present in the RNTuple.
const std::vector< ROOT::DescriptorId_t > GetFieldsByName(const std::regex &fieldNamePattern, bool searchInSubfields=true) const
Get the IDs of (sub-)fields whose name matches the given string.
std::string GetCompressionSettingsAsString() const
Get a string describing compression settings of the RNTuple being inspected.
RFieldTreeInspector CollectFieldTreeInfo(ROOT::DescriptorId_t fieldId)
Recursively gather field-level information.
void PrintColumnTypeInfo(ENTupleInspectorPrintFormat format=ENTupleInspectorPrintFormat::kTable, std::ostream &output=std::cout)
Print storage information per column type.
const RColumnInspector & GetColumnInspector(ROOT::DescriptorId_t physicalColumnId) const
Get storage information for a given column.
RNTupleDescriptor fDescriptor
static std::unique_ptr< RNTupleInspector > Create(const RNTuple &sourceNTuple)
Create a new RNTupleInspector.
const std::vector< ROOT::DescriptorId_t > GetColumnsByType(ROOT::ENTupleColumnType colType)
Get the IDs of all columns with the given type.
void CollectColumnInfo()
Gather column-level and RNTuple-level information.
std::unique_ptr< TH1D > GetColumnTypeInfoAsHist(ENTupleInspectorHist histKind, std::string_view histName="", std::string_view histTitle="")
Get a histogram showing information for each column type present,.
A column element encapsulates the translation between basic C++ types and their column representation...
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.
Base class for all ROOT issued exceptions.
Representation of an RNTuple data set in a ROOT file.
const_iterator begin() const
const_iterator end() const
1-D histogram with a double per channel (see TH1 documentation)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
ENTupleInspectorPrintFormat
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
static std::string AlgorithmToString(EAlgorithm::EValues algorithm)