Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunkify time panel data density graphs #6847

Merged
merged 42 commits into from
Jul 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
df4e07a
wip
jprochazk Jul 10, 2024
fd009c4
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 10, 2024
c6de5d6
undo
jprochazk Jul 10, 2024
f88d7e8
update lockfile
jprochazk Jul 10, 2024
c7cdd60
apply suggestions to `num_events`
jprochazk Jul 10, 2024
115905d
dedupe chunks + query entire subtree
jprochazk Jul 10, 2024
fd5ceca
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 10, 2024
3a66b6b
rm dead code
jprochazk Jul 10, 2024
4710ba8
fix lint
jprochazk Jul 10, 2024
5edaf85
maybe better hover
jprochazk Jul 11, 2024
0a96f3a
temp: add ctrl+shift+d toggle
jprochazk Jul 11, 2024
8695282
get component names from chunk
jprochazk Jul 11, 2024
366eb8e
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 11, 2024
b21c691
fix hovered range
jprochazk Jul 11, 2024
152cbc3
rm comment
jprochazk Jul 11, 2024
02da226
refactor + comment
jprochazk Jul 11, 2024
879fc4b
cmd shift d
jprochazk Jul 11, 2024
02e83c9
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 11, 2024
d33801e
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 12, 2024
5e53c7e
rename
jprochazk Jul 12, 2024
71d84bc
add `record_chunk_raw`
jprochazk Jul 12, 2024
e894175
add `extra_env` to `SpawnOptions`
jprochazk Jul 12, 2024
7fce052
add test
jprochazk Jul 12, 2024
152215d
set time to max on click
jprochazk Jul 12, 2024
d0f48ca
set time to center on click
jprochazk Jul 12, 2024
470d533
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 12, 2024
eb5555b
shuffle one chunk
jprochazk Jul 12, 2024
2236e63
debug print sorted status
jprochazk Jul 12, 2024
4ac8d06
dont disable changelog
jprochazk Jul 12, 2024
dd70bea
assert unsorted
jprochazk Jul 12, 2024
af22961
remove debug text
jprochazk Jul 12, 2024
c388da1
shuffle chunk
jprochazk Jul 12, 2024
8fbb916
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 15, 2024
24eb1cd
remove todo
jprochazk Jul 15, 2024
bc5cc03
update hover/click interactions
jprochazk Jul 15, 2024
c39abc2
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 15, 2024
cdd5e52
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 15, 2024
68ed29b
0 means disabled
jprochazk Jul 15, 2024
3b77166
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 15, 2024
e652d2a
time marker behavior depends on feature flag
jprochazk Jul 15, 2024
a1bd382
fix interactions
jprochazk Jul 15, 2024
1b601ec
Merge branch 'main' into jan/chunk-timeline
jprochazk Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dedupe chunks + query entire subtree
jprochazk committed Jul 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 115905de007e9a1a1e30eef3fd2ef9896130e511
65 changes: 41 additions & 24 deletions crates/viewer/re_time_panel/src/data_density_graph.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
//! The data density is the number of data points per unit of time.
//! We collect this into a histogram, blur it, and then paint it.

use std::collections::HashSet;
use std::ops::RangeInclusive;

use egui::emath::Rangef;
@@ -388,12 +389,6 @@ pub fn data_density_graph_ui2(

let mut density_graph = DensityGraph::new(row_rect.x_range());

let visible_time_range = time_ranges_ui
.time_range_from_x_range((row_rect.left() - MARGIN_X)..=(row_rect.right() + MARGIN_X));

let timeline = *time_ctrl.timeline();
let query = RangeQuery::new(timeline, visible_time_range);

let mut num_hovered_messages = 0;
let mut hovered_time_range = ResolvedTimeRange::EMPTY;

@@ -468,14 +463,19 @@ pub fn data_density_graph_ui2(
}
};

/* let mut num_chunks = 0; */
// Collect all relevant chunks in the visible time range.
// We do this as a separate step so that we can also deduplicate chunks.
let visible_time_range = time_ranges_ui
.time_range_from_x_range((row_rect.left() - MARGIN_X)..=(row_rect.right() + MARGIN_X));
let timeline = *time_ctrl.timeline();
let query = RangeQuery::new(timeline, visible_time_range);
let mut chunk_ranges: Vec<(ResolvedTimeRange, usize)> = vec![];

if let Some(component_name) = item.component_name {
let chunks = db
.store()
.range_relevant_chunks(&query, &item.entity_path, component_name);

/* num_chunks += chunks.len(); */

for chunk in chunks {
let Some(events) = chunk.num_events_for_component(component_name) else {
continue;
@@ -485,27 +485,44 @@ pub fn data_density_graph_ui2(
continue;
};

add_data_point(chunk_timeline.time_range(), events);
chunk_ranges.push((chunk_timeline.time_range(), events));
}
} else if let Some(components) = db.store().all_components(&timeline, &item.entity_path) {
for component_name in components {
let chunks =
db.store()
.range_relevant_chunks(&query, &item.entity_path, component_name);

/* num_chunks += chunks.len(); */

for chunk in chunks {
let events = chunk.num_events_cumulative();
let Some(chunk_timeline) = chunk.timelines().get(&timeline) else {
continue;
} else {
// deduplicate chunks using a set of chunk ids:
let mut seen = HashSet::new();
if let Some(subtree) = db.tree().subtree(&item.entity_path) {
subtree.visit_children_recursively(&mut |entity_path, _| {
let Some(components) = db.store().all_components(&timeline, entity_path) else {
return;
};

add_data_point(chunk_timeline.time_range(), events);
}
for component_name in components {
let chunks =
db.store()
.range_relevant_chunks(&query, entity_path, component_name);

for chunk in chunks {
let events = chunk.num_events_cumulative();
let Some(chunk_timeline) = chunk.timelines().get(&timeline) else {
continue;
};

if seen.contains(&chunk.id()) {
continue;
}
seen.insert(chunk.id());

chunk_ranges.push((chunk_timeline.time_range(), events));
}
}
});
}
}

for (time_range, num_events) in chunk_ranges {
add_data_point(time_range, num_events);
}

/* if ui.rect_contains_pointer(row_rect) {
ui.ctx().debug_painter().debug_text(
row_rect.left_top(),