33 std::unique_ptr<ROOT::Experimental::Internal::RPageSource>
pageSource)
50 fUncompressedSize = 0;
52 for (
const auto &
colDesc : fDescriptor->GetColumnIterable()) {
75 if (fCompressionSettings == -1) {
76 fCompressionSettings =
columnRange.fCompressionSettings;
77 }
else if (fCompressionSettings !=
columnRange.fCompressionSettings &&
83 std::to_string(fCompressionSettings) +
" vs " +
85 ") for column with physical ID " + std::to_string(
colId)));
127std::vector<ROOT::Experimental::DescriptorId_t>
130 std::vector<DescriptorId_t>
colIds;
137 for (
const auto &col : fDescriptor->GetColumnIterable(
currId)) {
138 if (col.IsAliasColumn()) {
142 colIds.emplace_back(col.GetPhysicalId());
145 for (
const auto &
fld : fDescriptor->GetFieldIterable(
currId)) {
153std::unique_ptr<ROOT::Experimental::RNTupleInspector>
160std::unique_ptr<ROOT::Experimental::RNTupleInspector>
169 int algorithm = fCompressionSettings / 100;
170 int level = fCompressionSettings - (
algorithm * 100);
173 " (level " + std::to_string(level) +
")";
201const std::vector<ROOT::Experimental::DescriptorId_t>
204 std::vector<DescriptorId_t>
colIds;
234 this->nElems +=
colInfo.GetNElements();
235 this->compressedSize +=
colInfo.GetCompressedSize();
236 this->uncompressedSize +=
colInfo.GetUncompressedSize();
248 output <<
" column type | count | # elements | compressed bytes | uncompressed bytes\n"
249 <<
"----------------|---------|-----------------|-------------------|--------------------" << std::endl;
252 <<
typeInfo.count <<
" |" << std::setw(16) <<
typeInfo.nElems <<
" |" << std::setw(18)
253 <<
typeInfo.compressedSize <<
" |" << std::setw(18) <<
typeInfo.uncompressedSize <<
" " << std::endl;
257 output <<
"columnType,count,nElements,compressedSize,uncompressedSize" << std::endl;
269 std::string_view histName, std::string_view
histTitle)
271 if (histName.empty()) {
291 auto hist = std::make_unique<TH1D>(std::string(histName).c_str(), std::string(
histTitle).c_str(), 1, 0, 1);
311 std::string histName,
322 std::string histName, std::string
histTitle,
size_t nBins)
324 if (histName.empty())
327 histTitle =
"Page size distribution for columns with type " +
333 return std::make_unique<TH1D>(histName.c_str(),
histTitle.c_str(), 64, 0, 0);
335 auto hist = std::unique_ptr<TH1D>(
dynamic_cast<TH1D *
>(
perTypeHist->GetHists()->First()));
337 hist->SetName(histName.c_str());
339 hist->SetXTitle(
"Page size (B)");
340 hist->SetYTitle(
"N_{pages}");
346 std::string histName, std::string
histTitle,
size_t nBins)
348 auto hist = std::make_unique<TH1D>();
350 if (histName.empty())
351 histName =
"pageSizeHist";
352 hist->SetName(histName.c_str());
356 hist->SetXTitle(
"Page size (B)");
357 hist->SetYTitle(
"N_{pages}");
361 auto colInfo = GetColumnInspector(colId);
362 pageSizes.insert(pageSizes.end(), colInfo.GetCompressedPageSizes().begin(),
363 colInfo.GetCompressedPageSizes().end());
378 std::initializer_list<ROOT::Experimental::EColumnType>
colTypes, std::string histName, std::string
histTitle,
381 if (histName.empty())
382 histName =
"pageSizeHist";
384 histTitle =
"Per-column type page size distribution";
388 double histMin = std::numeric_limits<double>::max();
390 std::map<EColumnType, std::vector<std::uint64_t>>
pageSizes;
405 auto colInfo = GetColumnInspector(colId);
406 pageSizesForColType.insert(pageSizesForColType.end(), colInfo.GetCompressedPageSizes().begin(),
407 colInfo.GetCompressedPageSizes().end());
417 auto hist = std::make_unique<TH1D>(
437 if (
fieldId >= fDescriptor->GetNFields()) {
441 return fFieldTreeInfo.at(
fieldId);
453 return GetFieldTreeInspector(
fieldId);
474const std::vector<ROOT::Experimental::DescriptorId_t>
477 std::vector<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.
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 const char * GetColumnTypeName(EColumnType type)
static std::unique_ptr< RColumnElementBase > Generate(EColumnType type)
If CppT == void, use the default C++ type for the given column type.
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const RNTupleReadOptions &options=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 RNTupleReadOptions &options=RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Base class for all ROOT issued exceptions.
Provides column-level storage information.
Provides field-level storage information.
Inspect on-disk and storage-related information of an RNTuple.
const RColumnInspector & GetColumnInspector(DescriptorId_t physicalColumnId) const
Get storage information for a given column.
const std::vector< DescriptorId_t > GetFieldsByName(const std::regex &fieldNamePattern, bool searchInSubFields=true) const
Get the IDs of (sub-)fields whose name matches the given string.
std::unique_ptr< Internal::RPageSource > fPageSource
const std::vector< EColumnType > GetColumnTypes()
Get all column types present in the RNTuple being inspected.
size_t GetColumnCountByType(EColumnType colType) const
Get the number of columns of a given type present in the RNTuple.
RNTupleInspector(std::unique_ptr< Internal::RPageSource > pageSource)
std::string GetCompressionSettingsAsString() const
Get a string describing compression settings of the RNTuple being inspected.
std::unique_ptr< TH1D > GetPageSizeDistribution(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.
const std::vector< DescriptorId_t > GetColumnsByType(EColumnType colType)
Get the IDs of all columns with the given type.
void PrintColumnTypeInfo(ENTupleInspectorPrintFormat format=ENTupleInspectorPrintFormat::kTable, std::ostream &output=std::cout)
Print storage information per column type.
RFieldTreeInspector CollectFieldTreeInfo(DescriptorId_t fieldId)
Recursively gather field-level information.
std::unique_ptr< RNTupleDescriptor > fDescriptor
std::vector< DescriptorId_t > GetColumnsByFieldId(DescriptorId_t fieldId) const
Get the columns that make up the given field, including its subfields.
static std::unique_ptr< RNTupleInspector > Create(const RNTuple &sourceNTuple)
Create a new RNTupleInspector.
void CollectColumnInfo()
Gather column-level and RNTuple-level information.
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 RFieldTreeInspector & GetFieldTreeInspector(DescriptorId_t fieldId) const
Get storage information for a given (sub)field by ID.
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,.
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
constexpr int kUnknownCompressionSettings
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)