-
Notifications
You must be signed in to change notification settings - Fork 16
lind-perf: baseline changes. add lind-perf crates, include basic feature plumbing.
#846
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
Open
stupendoussuperpowers
wants to merge
14
commits into
main
Choose a base branch
from
lind-perf-init
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
964f6c6
init commit
stupendoussuperpowers ce2d324
lind-perf initial commit
stupendoussuperpowers 1fd4127
Remove non commit-able files
stupendoussuperpowers 0aa5cd2
lind-perf refactors. updated docs.
stupendoussuperpowers 982d3da
Update comments in main.rs
stupendoussuperpowers c11964a
Merge branch 'main' into lind-perf-init
stupendoussuperpowers d736265
Use iterators
stupendoussuperpowers 6dad95c
don't use iterator for report
stupendoussuperpowers 44293de
Merge branch 'main' into lind-perf-init
stupendoussuperpowers 593b74e
Fix Build: Update Dockerfile.e2e to include lind-perf | Fix linting e…
stupendoussuperpowers 347b88d
Merge branch 'lind-perf-init' of github.com:Lind-Project/lind-wasm in…
stupendoussuperpowers 5589d99
Merge branch 'main' of github.com:Lind-Project/lind-wasm into lind-pe…
stupendoussuperpowers 4ce5aa1
Use println! everywhere in report.
stupendoussuperpowers 55e47d5
remove .gitignore
stupendoussuperpowers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,4 @@ report.html | |
| results.json | ||
|
|
||
| #Ignore python cache | ||
| __pycache__/ | ||
| __pycache__/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| mod cli; | ||
| mod lind_wasmtime; | ||
| mod perf; | ||
|
|
||
| use crate::{ | ||
| cli::CliOptions, | ||
|
|
@@ -64,10 +65,35 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |
| precompile_module(&lindboot_cli)?; | ||
| return Ok(()); | ||
| } | ||
|
|
||
| // Not a precompile command, chroot to lindfs | ||
| chroot_to_lindfs(); | ||
|
|
||
| // Check if --perf is enabled and avaible to decide whether to run in benchmarking mode. | ||
| if let Some(kind) = lindboot_cli.perf_timer_kind() { | ||
| // Initialize all counters. | ||
| perf::perf_init(kind); | ||
|
|
||
| let counters = perf::all_counter_names(); | ||
|
|
||
| // Iterate over all counters: | ||
| // - Exclusively enable the counter | ||
| // - Run the program to gather timing data. | ||
| for counter in counters { | ||
| perf::enable_one_counter(counter); | ||
|
|
||
| // Each sample run gets a fresh RawPOSIX lifecycle boundary to imitate actual | ||
| // behaviour. | ||
| rawposix_start(0); | ||
| let _ = execute_wasmtime(lindboot_cli.clone()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't remove the exit handling |
||
| rawposix_shutdown(); | ||
| } | ||
|
|
||
| // Output final numbers to stdout. | ||
| perf::perf_report(); | ||
|
|
||
| return Ok(()); | ||
| } | ||
|
|
||
| // Initialize RawPOSIX and register RawPOSIX syscalls with 3i | ||
| rawposix_start(0); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /// lind-boot's perf file binds together every other module's perf file. | ||
| /// | ||
| /// This involves: | ||
| /// - Reading their COUNTERS | ||
| /// - Initializing them | ||
| /// - Combining all the COUNTERS into one list to iterate over and sequentially enable | ||
| /// - Printing a combined lind-perf report. | ||
| use crate::cli::CliOptions; | ||
| use lind_perf::{Counter, TimerKind}; | ||
|
|
||
| // These are counters defined within lind-boot. | ||
| pub static GRATE_CALLBACK_TRAMPOLINE: Counter = | ||
| Counter::new("lind_boot::grate_callback_trampoline"); | ||
| pub static TYPED_FUNC_CALL: Counter = Counter::new("lind_boot::typed_func_call"); | ||
|
|
||
| // Counter list used by the perf runner in `main.rs`. Each benchmark iteration | ||
| // enables exactly one counter name from this list. | ||
| pub static LIND_BOOT_COUNTERS: &[&Counter] = &[&GRATE_CALLBACK_TRAMPOLINE, &TYPED_FUNC_CALL]; | ||
|
|
||
| /// Initialize counters for all modules, involves setting the TimerKind and resetting the | ||
| /// counts. | ||
| pub fn perf_init(kind: TimerKind) { | ||
| // Configure timer backend (Clock or TSC) for all local counters. | ||
| lind_perf::set_timer(all_counters(), kind); | ||
| // Reset all accumulated measurements before benchmark runs begin. | ||
| lind_perf::reset_all_counters(all_counters()); | ||
| } | ||
|
|
||
| /// Finds a counter by it's name and searches for it across modules to enable it. Disables all | ||
| /// other counters. | ||
| pub fn enable_one_counter(name: &str) { | ||
| lind_perf::enable_counter_by_name(all_counters(), name); | ||
| } | ||
|
|
||
| fn all_counters() -> impl Iterator<Item = &'static Counter> { | ||
| LIND_BOOT_COUNTERS.iter().copied() | ||
|
rennergade marked this conversation as resolved.
|
||
| } | ||
|
|
||
| /// Get a list of all counter names. | ||
| pub fn all_counter_names() -> Vec<&'static str> { | ||
| all_counters().filter_map(|c| c.get_name()).collect() | ||
| } | ||
|
|
||
| /// Print a report for every module. | ||
| pub fn perf_report() { | ||
| // Note: `lind_perf::report*` are no-ops when lind-perf is built without | ||
| // its internal `enabled` feature. | ||
| lind_perf::report(LIND_BOOT_COUNTERS, format!("LIND-BOOT")); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [package] | ||
| name = "lind-perf" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
||
| [features] | ||
| default = [] | ||
| enabled = [] | ||
|
|
||
| [dependencies] | ||
| libc = "0.2" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the counter here mean how many loops we want to iterate? I'm a bit confused by this counter and the one in src/lind-perf/src/enabled/counter.rs