Skip to content

Add a method to print the disk profile of an ntuple - #22914

Open
albfsg wants to merge 2 commits into
root-project:masterfrom
albfsg:print_disk_profile
Open

Add a method to print the disk profile of an ntuple#22914
albfsg wants to merge 2 commits into
root-project:masterfrom
albfsg:print_disk_profile

Conversation

@albfsg

@albfsg albfsg commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

Adds PrintDiskProfile method to the experimental RNTupleInspector class.

Its brief:

Print a string that represents the on-disk storage of the cluster groups, clusters, column ranges and pages on an RNTuple in a format which a performance profile visualizer can render

In order to implement it I've added free function GetAnchor into the ROOT::Internal namespace, friend to the RPageSourceFile class. Otherwise RNTupleInspector has no access to it's anchor, which is necessary to visualize an ntuple's header and footer.

Comes with a unit test.

Right now only supports Speedscope, with the following results for the test ntuple:

image

Checklist:

  • tested changes locally
  • updated the docs (if necessary) <- don't think there is a need to

This PR fixes # (nothing, it's a new feature)

albfsg added 2 commits July 24, 2026 15:35
Shows cluster groups, clusters, column ranges and pages.

Comes with a test which stress tests the method with an ntuple
shuffled on the 3 uppermost layers of the hierarchy: cluster groups,
clusters, column ranges (pages are by definition uninterrupted
serialized blobs).
Adds the ntuple header, footer and page list to the method.

Updates its unit test accordingly.

@silverweed silverweed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few minor comments but otherwise looks good 👍

std::uint64_t fSize = 0;
std::string fName;
std::array<ROOT::DescriptorId_t, 3> fAncestorIds; // clusterGroup, cluster, columnRange
std::array<std::string, 3> fAncestorNames; // clusterGroup, cluster, columnRange

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't really need to store the string names in here, you can reconstruct them from the IDs upon creating the SpeedscopeFrames

Comment on lines +752 to +753
std::vector<ROOT::DescriptorId_t> openIds;
std::vector<std::size_t> openFrameIndexes;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider collapsing these two vectors in a single one (having elements of a custom type containing both the Id and the index - you can define this type in the function itself.)


namespace {

void WriteShuffledNTuple(const std::string &ntupleName, const std::string &path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a brief description of what this function does

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also use std::string_view instead of const std::string &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants