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

Profile unit tests #172

Open
rasmusgo opened this issue Dec 3, 2023 · 1 comment
Open

Profile unit tests #172

rasmusgo opened this issue Dec 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@rasmusgo
Copy link

rasmusgo commented Dec 3, 2023

I want to use puffin to profile my tests but am having problems getting the viewer to catch the single frame it produces. It might be related to #85. I've had it somewhat working but that was a few versions of puffin ago.

My tests looks like this right now and I would be happy if something similar worked:

#[test]
fn test_ik_solver_neutral() -> hotham::anyhow::Result<()> {
    let _ = start_puffin_server();
    puffin::profile_function!();
    test_ik_solver(
        include_str!("../../test_data/inverse_kinematics_snapshot_2023-04-12_22.23.47.json"),
        None,
    )
}

The function start_puffin_server is something I wrote to create a puffin_http::Server and keep it alive until the test is done. It calls puffin::GlobalProfiler::lock().new_frame(); when created and dropped. I would like to use something like puffin::profile_unit_test!(); instead. Writing to disk is an option but I would prefer if I can keep the viewer running and update automatically as I change the code and run the test again.

@rasmusgo rasmusgo added the enhancement New feature or request label Dec 3, 2023
@emilk
Copy link
Collaborator

emilk commented Dec 4, 2023

We could add a helper to puffin_http for this, including the puffin_http::profile_unit_test macro.

Something similar to this: https://github.com/rerun-io/rerun/blob/main/crates/re_tracing/src/server.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants