mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
woops, headless crate didnt have the fix to toggle off cpuprofiler by default
This commit is contained in:
parent
0d27a11b2b
commit
a45b393b0d
@ -4,9 +4,13 @@ version = "0.1.0"
|
||||
authors = ["Dustin Carlino <dabreegster@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
profiler = ["cpuprofiler"]
|
||||
|
||||
[dependencies]
|
||||
abstutil = { path = "../abstutil" }
|
||||
cpuprofiler = "0.0.3"
|
||||
cpuprofiler = { version = "0.0.3", optional = true }
|
||||
geom = { path = "../geom" }
|
||||
map_model = { path = "../map_model" }
|
||||
sim = { path = "../sim" }
|
||||
|
@ -29,11 +29,14 @@ fn main() {
|
||||
timer.done();
|
||||
|
||||
if enable_profiler {
|
||||
cpuprofiler::PROFILER
|
||||
.lock()
|
||||
.unwrap()
|
||||
.start("./profile")
|
||||
.unwrap();
|
||||
#[cfg(feature = "profiler")]
|
||||
{
|
||||
cpuprofiler::PROFILER
|
||||
.lock()
|
||||
.unwrap()
|
||||
.start("./profile")
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
let timer = Timer::new("run sim until done");
|
||||
sim.run_until_done(
|
||||
@ -44,7 +47,10 @@ fn main() {
|
||||
sim.save();
|
||||
// Some simulations run for a really long time, just do this.
|
||||
if enable_profiler {
|
||||
cpuprofiler::PROFILER.lock().unwrap().stop().unwrap();
|
||||
#[cfg(feature = "profiler")]
|
||||
{
|
||||
cpuprofiler::PROFILER.lock().unwrap().stop().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
if paranoia {
|
||||
@ -56,6 +62,9 @@ fn main() {
|
||||
timer.done();
|
||||
println!("Done at {}", sim.time());
|
||||
if enable_profiler && save_at.is_none() {
|
||||
cpuprofiler::PROFILER.lock().unwrap().stop().unwrap();
|
||||
#[cfg(feature = "profiler")]
|
||||
{
|
||||
cpuprofiler::PROFILER.lock().unwrap().stop().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user