better but still not workable
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use teleprof::instrument;
|
||||
|
||||
fn main() {
|
||||
// Start the telemetry window
|
||||
@@ -7,7 +8,9 @@ fn main() {
|
||||
|
||||
println!("Teleprof demo running...");
|
||||
println!("Press Space in the profiler window to pause/unpause");
|
||||
println!("Mouse wheel to zoom, drag to pan");
|
||||
println!("Press Escape in the profiler window to quit");
|
||||
println!();
|
||||
|
||||
// Simulate some work
|
||||
for i in 0..1000 {
|
||||
@@ -26,9 +29,8 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn frame_work(frame: u32) {
|
||||
teleprof::span!("frame_work");
|
||||
|
||||
physics_update();
|
||||
render();
|
||||
|
||||
@@ -37,9 +39,8 @@ fn frame_work(frame: u32) {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn physics_update() {
|
||||
teleprof::span!("physics_update");
|
||||
|
||||
// Spawn some worker threads
|
||||
let handles: Vec<_> = (0..3).map(|i| {
|
||||
thread::spawn(move || {
|
||||
@@ -52,32 +53,30 @@ fn physics_update() {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn physics_worker(id: u32) {
|
||||
teleprof::span!("physics_worker");
|
||||
|
||||
// Simulate work
|
||||
let work_ms = 5 + (id * 2);
|
||||
thread::sleep(Duration::from_millis(work_ms as u64));
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn render() {
|
||||
teleprof::span!("render");
|
||||
|
||||
build_command_buffer();
|
||||
submit_to_gpu();
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn build_command_buffer() {
|
||||
teleprof::span!("build_command_buffer");
|
||||
thread::sleep(Duration::from_millis(3));
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn submit_to_gpu() {
|
||||
teleprof::span!("submit_to_gpu");
|
||||
thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
fn occasional_task() {
|
||||
teleprof::span!("occasional_task");
|
||||
thread::sleep(Duration::from_millis(10));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user