Skip to content

Commit

Permalink
Add some puffin profiling scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 7, 2023
1 parent 2d54b4b commit bee5d32
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ mod glow_integration {
viewport: &Rc<RefCell<Viewport>>,
event_loop: &EventLoopWindowTarget<UserEvent>,
) -> Result<()> {
crate::profile_function!();

let builder = &self.builders[&viewport.borrow().id_pair.this];
let mut viewport = viewport.borrow_mut();
// make sure we have a window or create one.
Expand Down
4 changes: 4 additions & 0 deletions crates/egui-winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ impl Clipboard {

#[cfg(all(feature = "arboard", not(target_os = "android")))]
fn init_arboard() -> Option<arboard::Clipboard> {
crate::profile_function!();

log::debug!("Initializing arboard clipboard…");
match arboard::Clipboard::new() {
Ok(clipboard) => Some(clipboard),
Expand All @@ -135,6 +137,8 @@ fn init_arboard() -> Option<arboard::Clipboard> {
fn init_smithay_clipboard(
_display_target: &dyn HasRawDisplayHandle,
) -> Option<smithay_clipboard::Clipboard> {
crate::profile_function!();

use raw_window_handle::RawDisplayHandle;
if let RawDisplayHandle::Wayland(display) = _display_target.raw_display_handle() {
log::debug!("Initializing smithay clipboard…");
Expand Down
4 changes: 4 additions & 0 deletions crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ impl State {
native_pixels_per_point: Option<f32>,
max_texture_side: Option<usize>,
) -> Self {
crate::profile_function!();

let egui_input = egui::RawInput {
focused: false, // winit will tell us when we have focus
..Default::default()
Expand Down Expand Up @@ -1128,6 +1130,8 @@ pub fn process_viewport_commands(
}

pub fn create_winit_window_builder(builder: &ViewportBuilder) -> winit::window::WindowBuilder {
crate::profile_function!();

let mut window_builder = winit::window::WindowBuilder::new()
.with_title(
builder
Expand Down
4 changes: 4 additions & 0 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,8 @@ impl Context {
viewport_builder: ViewportBuilder,
viewport_ui_cb: impl Fn(&Context) + Send + Sync + 'static,
) {
crate::profile_function!();

if self.embed_viewports() {
viewport_ui_cb(self);
} else {
Expand Down Expand Up @@ -2626,6 +2628,8 @@ impl Context {
viewport_builder: ViewportBuilder,
viewport_ui_cb: impl FnOnce(&Context) -> T,
) -> T {
crate::profile_function!();

if self.embed_viewports() {
return viewport_ui_cb(self);
}
Expand Down

0 comments on commit bee5d32

Please sign in to comment.