Integrate profiling into gpui (#8176)
[Profiling](https://crates.io/crates/profiling) crate allows easy integration with various profiler tools. The best thing is - annotations compile to nothing unless you request a specific feature. For example, I used this command to enable Tracy support: ```bash cargo run --features profiling/profile-with-tracy ``` At the same time I had Tracy tool open and waiting for connection. It gathered nice stats from the run:  Release Notes: - N/A
This commit is contained in:
parent
250df707bf
commit
991c9ec441
10 changed files with 45 additions and 2 deletions
|
@ -444,6 +444,7 @@ impl BladeRenderer {
|
|||
self.gpu.metal_layer().unwrap().as_ptr()
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
fn rasterize_paths(&mut self, paths: &[Path<ScaledPixels>]) {
|
||||
self.path_tiles.clear();
|
||||
let mut vertices_by_texture_id = HashMap::default();
|
||||
|
@ -506,7 +507,10 @@ impl BladeRenderer {
|
|||
}
|
||||
|
||||
pub fn draw(&mut self, scene: &Scene) {
|
||||
let frame = self.gpu.acquire_frame();
|
||||
let frame = {
|
||||
profiling::scope!("acquire frame");
|
||||
self.gpu.acquire_frame()
|
||||
};
|
||||
self.command_encoder.start();
|
||||
self.command_encoder.init_texture(frame.texture());
|
||||
|
||||
|
@ -529,6 +533,7 @@ impl BladeRenderer {
|
|||
}],
|
||||
depth_stencil: None,
|
||||
}) {
|
||||
profiling::scope!("render pass");
|
||||
for batch in scene.batches() {
|
||||
match batch {
|
||||
PrimitiveBatch::Quads(quads) => {
|
||||
|
@ -718,6 +723,7 @@ impl BladeRenderer {
|
|||
self.command_encoder.present(frame);
|
||||
let sync_point = self.gpu.submit(&mut self.command_encoder);
|
||||
|
||||
profiling::scope!("finish");
|
||||
self.instance_belt.flush(&sync_point);
|
||||
self.atlas.after_frame(&sync_point);
|
||||
self.atlas.clear_textures(AtlasTextureKind::Path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue