Skip to content

Reserve part of the ring buffer for high priority events#451

Merged
nsavoire merged 3 commits into
mainfrom
nsavoire/high_priority_events
Oct 28, 2025
Merged

Reserve part of the ring buffer for high priority events#451
nsavoire merged 3 commits into
mainfrom
nsavoire/high_priority_events

Conversation

@nsavoire

Copy link
Copy Markdown
Collaborator

What does this PR do?

Deallocation events and clear live allocation events are considered high priority and can used the high priority area.

@nsavoire
nsavoire requested a review from r1viollet as a code owner October 16, 2025 14:09
@pr-commenter

pr-commenter Bot commented Oct 16, 2025

Copy link
Copy Markdown

Benchmark results for collatz

Parameters

Baseline Candidate
config baseline candidate
profiler-version ddprof 0.21.0+2239fe4d.80474612 ddprof 0.21.0+8b33723c.80475053

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean execution_time
scenario:ddprof -S bench-collatz --preset cpu_only collatz_runner.sh same

@pr-commenter

pr-commenter Bot commented Oct 16, 2025

Copy link
Copy Markdown

Benchmark results for BadBoggleSolver_run

Parameters

Baseline Candidate
config baseline candidate
profiler-version ddprof 0.21.0+2239fe4d.80474612 ddprof 0.21.0+8b33723c.80475053

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean execution_time
scenario:ddprof -S bench-bad-boggle-solver BadBoggleSolver_run work 1000 same

@nsavoire
nsavoire force-pushed the nsavoire/high_priority_events branch from 0c57a32 to 2be56e4 Compare October 16, 2025 14:23
MPSCRingBufferWriter writer{&_pevent.rb, _high_priority_area_size};
bool notify_consumer{false};

bool timeout = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you meant to reserve as high priority ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, thanks for the fix !

@r1viollet
r1viollet force-pushed the nsavoire/high_priority_events branch from 2be56e4 to 6604a11 Compare October 23, 2025 09:22
@r1viollet

Copy link
Copy Markdown
Collaborator

Through simple malloc I'm not able to see an improvement of lost dealloc events. I'll hold off on merging this until we have a bench showing that it is saving dealloc events.
I can see why this is a good idea! Thanks for opening the PR.

@nsavoire

Copy link
Copy Markdown
Collaborator Author

Through simple malloc I'm not able to see an improvement of lost dealloc events. I'll hold off on merging this until we have a bench showing that it is saving dealloc events. I can see why this is a good idea! Thanks for opening the PR.

Do you see no improvements because you do not observe lost dealloc events without this change or because you still see lost dealloc event with this change ?

Note that the library does not report its state upon exit and therefore the stats reported by ddprof on lost events might be incorrect if simple_malloc runs for less than a profiling period. I have a patch to improve this.

I am testing with ./ddprof -l informational --preset cpu_live_heap --inlined_functions true ./test/simple_malloc --spin 10 --loop 100000 --malloc 200000 --realloc 0 --threads 16, without this change I can observe a few lost dealloc events taht completely disappear with this PR.

nsavoire and others added 3 commits October 28, 2025 11:51
Deallocation events and clear live allocation events are considered high
priority and can used the high priority area.
@nsavoire
nsavoire force-pushed the nsavoire/high_priority_events branch from 10ea097 to 8b33723 Compare October 28, 2025 11:53
@nsavoire
nsavoire merged commit 34ea888 into main Oct 28, 2025
2 checks passed
@nsavoire
nsavoire deleted the nsavoire/high_priority_events branch October 28, 2025 12:05
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