Skip to content

Commit

Permalink
Merge pull request #637 from AmbientRun/switch_to_upstream_profiling
Browse files Browse the repository at this point in the history
Switch from ambient_profiling to upstream profiling
  • Loading branch information
Pombal authored Aug 4, 2023
2 parents 13946bb + 92271cf commit 273e4ca
Show file tree
Hide file tree
Showing 52 changed files with 112 additions and 112 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rust-version = "1.67.0"

[workspace.dependencies]
aho-corasick = "0.7.20"
ambient_profiling = { version = "1.0.9", features = ["profile-with-puffin"] }
profiling = { version = "1.0.9", features = ["profile-with-puffin"] }
tracing = "0.1.35"
tracing-tree = { version = "0.2" }
tracing-stackdriver = "0.6.2"
Expand Down Expand Up @@ -53,11 +53,11 @@ strum = { version = "0.24", features = ["derive"] }
derivative = "2.2.0"
async-trait = "0.1.56"
png = "0.17.2"
puffin = "0.14.3"
puffin = "0.16.0"
puffin_http = "0.13.0"
futures-signals = "0.3"
open = "2.0.2"
which = "4.3.0"
puffin_http = "0.11.1"
fbxcel = { version = "0.9.0", features = ["tree"] }
reqwest = { version = "0.11.11", default-features = false, features = [
'blocking',
Expand Down
4 changes: 2 additions & 2 deletions crates/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ winit = { workspace = true }
flume = { workspace = true }
glam = { workspace = true }
tokio = { workspace = true }
ambient_profiling = { workspace = true }
profiling = { workspace = true }
anyhow = { workspace = true }
wgpu = { workspace = true }
puffin = { workspace = true, optional = true }
Expand All @@ -42,7 +42,7 @@ parking_lot = { workspace = true }
ambient_primitives = { path = "../primitives" }

[features]
profile = ["puffin", "puffin_http", "ambient_profiling/profile-with-puffin"]
profile = ["puffin", "puffin_http", "profiling/profile-with-puffin"]
hotload-includes = [
"ambient_native_std/hotload-includes",
'ambient_gpu/hotload-includes',
Expand Down
8 changes: 4 additions & 4 deletions crates/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,11 @@ impl App {
}
}

ambient_profiling::scope!("frame");
profiling::scope!("frame");
world.next_frame();

{
ambient_profiling::scope!("systems");
profiling::scope!("systems");
systems.run(world, &FrameEvent);
gpu_world_sync_systems.run(world, &GpuWorldSyncEvent);
}
Expand All @@ -716,7 +716,7 @@ impl App {
if let Some(window) = &self.window {
window.request_redraw();
}
ambient_profiling::finish_frame!();
profiling::finish_frame!();
}

Event::WindowEvent { event, .. } => match event {
Expand Down Expand Up @@ -825,7 +825,7 @@ impl System<Event<'static, ()>> for ExamplesSystem {
pub struct MeshBufferUpdate;
impl System for MeshBufferUpdate {
fn run(&mut self, world: &mut World, _event: &FrameEvent) {
ambient_profiling::scope!("MeshBufferUpdate.run");
profiling::scope!("MeshBufferUpdate.run");
let assets = world.resource(asset_cache()).clone();
let gpu = world.resource(gpu()).clone();
let mesh_buffer = MeshBufferKey.get(&assets);
Expand Down
22 changes: 11 additions & 11 deletions crates/app/src/renderers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ impl std::fmt::Debug for MainRenderer {

impl System for MainRenderer {
fn run(&mut self, world: &mut World, _: &FrameEvent) {
ambient_profiling::scope!("Renderers.run");
profiling::scope!("Renderers.run");
let gpu = world.resource(gpu()).clone();
let mut encoder = gpu
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
let mut post_submit = Vec::new();

if let Some(main) = &mut self.main {
ambient_profiling::scope!("Main");
profiling::scope!("Main");
main.render(
&gpu,
world,
Expand All @@ -217,7 +217,7 @@ impl System for MainRenderer {

if let Some(ui) = &mut self.ui {
// tracing::info!("Drawing UI");
ambient_profiling::scope!("UI");
profiling::scope!("UI");
ui.render(
&gpu,
world,
Expand All @@ -235,7 +235,7 @@ impl System for MainRenderer {
if let Some(surface) = &gpu.surface {
if self.size.x > 0 && self.size.y > 0 {
let frame = {
ambient_profiling::scope!("Get swapchain texture");
profiling::scope!("Get swapchain texture");
match surface.get_current_texture() {
Ok(v) => v,
// Reconfigure the surface if lost
Expand Down Expand Up @@ -267,20 +267,20 @@ impl System for MainRenderer {
);

{
ambient_profiling::scope!("Submit");
profiling::scope!("Submit");
gpu.queue.submit(Some(encoder.finish()));
}
{
ambient_profiling::scope!("Present");
profiling::scope!("Present");
frame.present();
}
} else {
ambient_profiling::scope!("Submit");
profiling::scope!("Submit");
gpu.queue.submit(Some(encoder.finish()));
}
} else {
{
ambient_profiling::scope!("Submit");
profiling::scope!("Submit");
gpu.queue.submit(Some(encoder.finish()));
}
}
Expand Down Expand Up @@ -383,7 +383,7 @@ impl UiRenderer {
label: Some("UIRenderer"),
});
let frame = {
ambient_profiling::scope!("Get swapchain texture");
profiling::scope!("Get swapchain texture");
gpu.surface
.as_ref()
.unwrap()
Expand Down Expand Up @@ -417,11 +417,11 @@ impl UiRenderer {
Some(app_background_color()),
);
{
ambient_profiling::scope!("Submit");
profiling::scope!("Submit");
gpu.queue.submit(Some(encoder.finish()));
}
{
ambient_profiling::scope!("Present");
profiling::scope!("Present");
frame.present();
}
for action in post_submit {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ yaml-rust = { workspace = true }
tracing = { workspace = true }
glam = { workspace = true }
wgpu = { workspace = true }
ambient_profiling = { workspace = true }
profiling = { workspace = true }
derive_more = { workspace = true }
bytemuck = { workspace = true }
lazy_static = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/bounding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl VisibilityFromToGpuSystem {
}
impl System<GpuWorldSyncEvent> for VisibilityFromToGpuSystem {
fn run(&mut self, world: &mut World, _: &GpuWorldSyncEvent) {
ambient_profiling::scope!("VisibilityFromToGpu.run");
profiling::scope!("VisibilityFromToGpu.run");
let gpu_world = world.resource(gpu_world()).lock();
let gpu = world.resource(gpu());
for arch in world.archetypes() {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/gpu_ecs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl GpuComponentsBuffer {
pub struct GpuWorldUpdate;
impl System<GpuWorldSyncEvent> for GpuWorldUpdate {
fn run(&mut self, world: &mut World, _event: &GpuWorldSyncEvent) {
ambient_profiling::scope!("GpuWorldUpdate.run");
profiling::scope!("GpuWorldUpdate.run");
let gpu = world.resource(gpu()).clone();
world
.resource_mut(gpu_world())
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/gpu_ecs/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<T: ComponentValue + bytemuck::Pod> ComponentToGpuSystem<T> {
}
impl<T: ComponentValue + bytemuck::Pod> System<GpuWorldSyncEvent> for ComponentToGpuSystem<T> {
fn run(&mut self, world: &mut World, _: &GpuWorldSyncEvent) {
ambient_profiling::scope!("ComponentToGpuSystem.run");
profiling::scope!("ComponentToGpuSystem.run");
let gpu_world = world.resource(gpu_world()).lock();
let gpu = world.resource(gpu()).clone();
for arch in self.source_archetypes.iter_archetypes(world) {
Expand Down Expand Up @@ -123,7 +123,7 @@ impl<A: ComponentValue, B: bytemuck::Pod> System<GpuWorldSyncEvent>
for MappedComponentToGpuSystem<A, B>
{
fn run(&mut self, world: &mut World, _: &GpuWorldSyncEvent) {
ambient_profiling::scope!("MappedComponentToGpu.run");
profiling::scope!("MappedComponentToGpu.run");
let gpu_world = world.resource(gpu_world()).lock();
let gpu = world.resource(gpu());
for arch in world.archetypes() {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl FixedTimestepSystem {
}
}
impl System for FixedTimestepSystem {
#[ambient_profiling::function]
#[profiling::function]
fn run(&mut self, world: &mut World, event: &FrameEvent) {
let delta_time = *world.resource(self::delta_time());
self.acc += delta_time;
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl TransformSystem {
}
}

#[ambient_profiling::function]
#[profiling::function]
fn parented(&mut self, world: &mut World) {
let mut changed_roots = HashSet::<EntityId>::new();
for (id, _) in
Expand Down Expand Up @@ -461,7 +461,7 @@ impl TransformSystem {
}
impl System for TransformSystem {
fn run(&mut self, world: &mut World, event: &FrameEvent) {
ambient_profiling::scope!("TransformSystem::run");
profiling::scope!("TransformSystem::run");
self.systems.run(world, event);
if let Some(camera) =
get_active_camera(world, main_scene(), world.resource_opt(local_user_id()))
Expand Down
2 changes: 1 addition & 1 deletion crates/ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ambient_project_macro = { path = "../project_macro" , version = "0.3.0-dev" }
itertools = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
ambient_profiling = { workspace = true }
profiling = { workspace = true }
yaml-rust = { workspace = true }
log = { workspace = true }
derive_more = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/ecs/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl Archetype {
}
}

#[ambient_profiling::function]
#[profiling::function]
pub fn next_frame(&mut self) {
self.movein_events.next_frame();
self.moveout_events.next_frame();
Expand Down
2 changes: 1 addition & 1 deletion crates/ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl World {
self.despawn(id);
}
}
#[ambient_profiling::function]
#[profiling::function]
pub fn next_frame(&mut self) {
for arch in &mut self.archetypes {
arch.next_frame();
Expand Down
8 changes: 4 additions & 4 deletions crates/ecs/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ impl Query {
) -> Box<dyn System<E> + Sync + Send> {
let mut state = QueryState::new();
Box::new(FnSystem(Box::new(move |world, event| {
ambient_profiling::scope!(name);
profiling::scope!(name);
update(&self, world, &mut state, event);
})))
}
Expand Down Expand Up @@ -875,7 +875,7 @@ impl<'a, R: ComponentQuery<'a> + Clone + 'static> TypedReadQuery<R> {
) -> DynSystem<E> {
let mut state = QueryState::new();
Box::new(FnSystem(Box::new(move |world, event| {
ambient_profiling::scope!(name);
profiling::scope!(name);
update(&self, world, Some(&mut state), event);
})))
}
Expand Down Expand Up @@ -1028,7 +1028,7 @@ impl<'a, RW: ComponentQuery<'a> + Clone + 'static, R: ComponentQuery<'a> + Clone
) -> DynSystem<E> {
let mut state = QueryState::new();
Box::new(FnSystem(Box::new(move |world, event| {
ambient_profiling::scope!(name);
profiling::scope!(name);
update(&self, world, Some(&mut state), event);
})))
}
Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl<E> SystemGroup<E> {

impl<E> System<E> for SystemGroup<E> {
fn run(&mut self, world: &mut World, event: &E) {
ambient_profiling::scope!("SystemGroup::run", &self.0);
profiling::scope!("SystemGroup::run", &self.0);
let _span = tracing::debug_span!("SystemGroup::run", "{}", &self.0).entered();
for system in self.1.iter_mut() {
system.run(world, event);
Expand Down
2 changes: 1 addition & 1 deletion crates/ecs/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl WorldStream {
pub fn filter(&self) -> &WorldStreamFilter {
&self.filter
}
#[ambient_profiling::function]
#[profiling::function]
pub fn next_diff(&mut self, world: &World) -> WorldDiff {
let shape_changes = self
.shape_stream_reader
Expand Down
2 changes: 1 addition & 1 deletion crates/editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
log = { workspace = true }
ambient_profiling = { workspace = true }
profiling = { workspace = true }
closure = { workspace = true }
wgpu = { workspace = true }
winit = { workspace = true }
Expand Down
10 changes: 5 additions & 5 deletions crates/editor/src/intents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn axis_aligned_plane(normal: Vec3) -> (Vec3, Vec3) {
}
}

#[ambient_profiling::function]
#[profiling::function]
fn resolve_clipping(
world: &mut World,
entities: &[EntityId],
Expand Down Expand Up @@ -221,7 +221,7 @@ fn resolve_clipping(
.iter()
.zip_eq(ids)
.flat_map(|(_, &id)| -> Option<_> {
ambient_profiling::scope!("query_intersection");
profiling::scope!("query_intersection");
// let id = *world.resource(uid_lookup()).get(&entity.id)?;

let transform = get_world_transform(world, id).ok()?;
Expand Down Expand Up @@ -279,7 +279,7 @@ pub fn register_intents(reg: &mut IntentRegistry) {
intent_place_ray(),
intent_place_ray_undo(),
|ctx, IntentPlaceRay { targets, ray, snap }| {
ambient_profiling::scope!("handle_intent_move");
profiling::scope!("handle_intent_move");
let world = ctx.world;

#[allow(dead_code)]
Expand Down Expand Up @@ -307,7 +307,7 @@ pub fn register_intents(reg: &mut IntentRegistry) {
.fold(Vec3::ZERO, |acc, x| acc + x)
/ transforms.len().max(1) as f32;

ambient_profiling::scope!("intent_move");
profiling::scope!("intent_move");
// tracing::info!("Bounding box: {bounds:?}");

let intersect = find_world_intersection_without_entities(world, ray, &ids, 500.);
Expand Down Expand Up @@ -385,7 +385,7 @@ pub fn register_intents(reg: &mut IntentRegistry) {
intent_translate(),
intent_translate_undo(),
|ctx, IntentTranslate { targets, position }| {
ambient_profiling::scope!("handle_intent_move");
profiling::scope!("handle_intent_move");
let world = ctx.world;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion crates/editor/src/ui/build_mode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl ElementComponent for EditorBuildMode {
let mut prev = None;

let update_targets = move |selection: &Selection| {
ambient_profiling::scope!("update_targets");
profiling::scope!("update_targets");
let state = game_state.lock();

let res = selection
Expand Down
2 changes: 1 addition & 1 deletion crates/editor/src/ui/build_mode/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct SelectionPanel {
}

impl ElementComponent for SelectionPanel {
#[ambient_profiling::function]
#[profiling::function]
fn render(self: Box<Self>, hooks: &mut Hooks) -> Element {
let Self {
selection,
Expand Down
Loading

0 comments on commit 273e4ca

Please sign in to comment.