polish the rendering a bit, add a macro
This commit is contained in:
@@ -32,6 +32,7 @@ impl Ball {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn main() {
|
||||
// Start the telemetry window
|
||||
teleprof::start();
|
||||
@@ -49,7 +50,7 @@ fn main() {
|
||||
println!("- Flame graph rendering (all depth-N spans on row N)");
|
||||
println!("- instrument_calls macro for automatic call instrumentation");
|
||||
println!("- Runtime deduplication preventing double-wrapping");
|
||||
println!();
|
||||
println!();
|
||||
|
||||
let mut window = Window::new(
|
||||
"Bouncing Ball",
|
||||
@@ -102,6 +103,7 @@ fn main_frame(
|
||||
teleprof::set_thread_name(format!("ColorPicker-{}", id));
|
||||
pick_new_color(ball_clone);
|
||||
});
|
||||
let _ = COLOR_PICKER_COUNTER.fetch_update(Ordering::Relaxed,Ordering::Relaxed,|cnt| Some(cnt -1));
|
||||
}
|
||||
|
||||
// Render - also instrumented, so dedup will handle it
|
||||
@@ -118,7 +120,7 @@ fn main_frame(
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
|
||||
fn update_physics(ball: &Arc<Mutex<Ball>>, dt: f32) -> bool {
|
||||
let mut ball = ball.lock().unwrap();
|
||||
|
||||
@@ -163,7 +165,6 @@ fn pick_new_color(ball: Arc<Mutex<Ball>>) {
|
||||
}
|
||||
|
||||
// Using instrument_calls here too to see the breakdown of rendering
|
||||
#[instrument_calls]
|
||||
fn render(ball: &Arc<Mutex<Ball>>, framebuffer: &mut [u32]) {
|
||||
clear_background(framebuffer);
|
||||
draw_ball(ball, framebuffer);
|
||||
@@ -203,7 +204,6 @@ fn submit_frame() {
|
||||
thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn print_status(ball: &Arc<Mutex<Ball>>, frame: u32) {
|
||||
let ball = ball.lock().unwrap();
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user