jumping to cluster now also sets latest page gone to
This commit is contained in:
parent
1c54cb0d03
commit
6accff3cbd
3 changed files with 17 additions and 6 deletions
|
@ -210,11 +210,13 @@ void viewer_jump_to_cluster(App_State &app, u64 cluster_idx)
|
||||||
{
|
{
|
||||||
assert(app.rndata.n_clusters > 0);
|
assert(app.rndata.n_clusters > 0);
|
||||||
cluster_idx = (cluster_idx + app.rndata.n_clusters) % app.rndata.n_clusters;
|
cluster_idx = (cluster_idx + app.rndata.n_clusters) % app.rndata.n_clusters;
|
||||||
|
|
||||||
Page_Info_Node *page = app.rndata.clusters[cluster_idx].first_page;
|
Cluster_Info &cluster = app.rndata.clusters[cluster_idx];
|
||||||
|
Page_Info_Node *page = cluster.first_page;
|
||||||
assert(page);
|
assert(page);
|
||||||
|
|
||||||
app.viewer.highlighted_cluster = cluster_idx;
|
app.viewer.highlighted_cluster = cluster_idx;
|
||||||
|
app.viewer.latest_page_gone_to = cluster.first_page_idx;
|
||||||
viewer_jump_to(app, page->range.start);
|
viewer_jump_to(app, page->range.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
||||||
|
|
||||||
chr::time_point start_t = chr::high_resolution_clock::now();
|
chr::time_point start_t = chr::high_resolution_clock::now();
|
||||||
|
|
||||||
Cluster_Info_Node *clusters = arena_push_array<Cluster_Info_Node>(arena, descriptor.GetNActiveClusters());
|
Cluster_Info *clusters = arena_push_array<Cluster_Info>(arena, descriptor.GetNActiveClusters());
|
||||||
|
|
||||||
// gather clusters and pages metadata
|
// gather clusters and pages metadata
|
||||||
for (const RClusterDescriptor &cluster_desc : descriptor.GetClusterIterable()) {
|
for (const RClusterDescriptor &cluster_desc : descriptor.GetClusterIterable()) {
|
||||||
|
@ -116,8 +116,10 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
||||||
assert(cluster_desc.GetId() <= UINT_MAX);
|
assert(cluster_desc.GetId() <= UINT_MAX);
|
||||||
pinfo->cluster_id = cluster_desc.GetId();
|
pinfo->cluster_id = cluster_desc.GetId();
|
||||||
|
|
||||||
Cluster_Info_Node &cluster = clusters[pinfo->cluster_id];
|
Cluster_Info &cluster = clusters[pinfo->cluster_id];
|
||||||
if (!cluster.first_page || pinfo->range.start < cluster.first_page->range.start) {
|
if (!cluster.first_page || pinfo->range.start < cluster.first_page->range.start) {
|
||||||
|
if (cluster.first_page)
|
||||||
|
cluster.first_page->is_first_in_cluster = false;
|
||||||
cluster.first_page = pinfo;
|
cluster.first_page = pinfo;
|
||||||
pinfo->is_first_in_cluster = true;
|
pinfo->is_first_in_cluster = true;
|
||||||
}
|
}
|
||||||
|
@ -230,6 +232,12 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
||||||
}
|
}
|
||||||
chunks_tail->range.len += pinfo->range.len;
|
chunks_tail->range.len += pinfo->range.len;
|
||||||
|
|
||||||
|
// while we're at it, set the first_page_idx information on the page's parent cluster
|
||||||
|
// Note that the first page won't update its cluster's `first_page_idx` (since we loop
|
||||||
|
// from idx = 1) but that's fine because that idx is by definition 0.
|
||||||
|
if (pinfo->is_first_in_cluster)
|
||||||
|
clusters[pinfo->cluster_id].first_page_idx = idx;
|
||||||
|
|
||||||
if (idx++ % GROUP_SIZE != 0)
|
if (idx++ % GROUP_SIZE != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,9 @@ struct Page_Info_Chunk {
|
||||||
u32 first_group;
|
u32 first_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Cluster_Info_Node {
|
struct Cluster_Info {
|
||||||
Page_Info_Node *first_page;
|
Page_Info_Node *first_page;
|
||||||
|
u64 first_page_idx; // index in the pages linked list
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Cluster_Group_Info {
|
struct Cluster_Group_Info {
|
||||||
|
@ -83,7 +84,7 @@ struct RNTuple_Data {
|
||||||
u64 n_cluster_groups;
|
u64 n_cluster_groups;
|
||||||
u64 tot_page_list_size;
|
u64 tot_page_list_size;
|
||||||
|
|
||||||
Cluster_Info_Node *clusters;
|
Cluster_Info *clusters;
|
||||||
u64 n_clusters;
|
u64 n_clusters;
|
||||||
|
|
||||||
Page_Info_Group *page_groups;
|
Page_Info_Group *page_groups;
|
||||||
|
|
Loading…
Reference in a new issue