Skip to content

Commit

Permalink
Profile more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KoffeinFlummi committed Nov 25, 2023
1 parent a324d19 commit f113985
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ impl Sam {

// Bottom status bar
egui::TopBottomPanel::bottom("bottombar").min_height(30.0).show(ctx, |ui| {
#[cfg(feature = "profiling")]
puffin::profile_function!();

ui.set_enabled(!self.archive_window.open);
ui.horizontal_centered(|ui| {
// Give the data source some space on the left ...
Expand Down
3 changes: 3 additions & 0 deletions src/gui/panels/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ impl HeaderPanel {
}

pub fn show(ctx: &egui::Context, data_source: &mut dyn DataSource, enabled: bool) {
#[cfg(feature = "profiling")]
puffin::profile_function!();

if ctx.screen_rect().width() > 1000.0 {
egui::TopBottomPanel::top("topbar").min_height(60.0).max_height(60.0).show(ctx, |ui| {
ui.set_enabled(enabled);
Expand Down
3 changes: 3 additions & 0 deletions src/gui/panels/menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub struct MenuBarPanel {}

impl MenuBarPanel {
pub fn show(ctx: &egui::Context, sam: &mut Sam, enabled: bool) {
#[cfg(feature = "profiling")]
puffin::profile_function!();

let any = sam.data_source.as_any();
let data_source_is_sim = any.is::<SimulationDataSource>();
let data_source_is_log = any.is::<LogFileDataSource>();
Expand Down
3 changes: 3 additions & 0 deletions src/gui/panels/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub struct SimulationPanel {}

impl SimulationPanel {
pub fn show(ctx: &egui::Context, data_source: &mut SimulationDataSource, enabled: bool) {
#[cfg(feature = "profiling")]
puffin::profile_function!();

let old_settings = data_source.settings.clone();

egui::SidePanel::left("sim").min_width(300.0).max_width(500.0).resizable(true).show(ctx, |ui| {
Expand Down
6 changes: 6 additions & 0 deletions src/gui/tabs/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ impl PlotTab {
}

fn plot_orientation(&mut self, ui: &mut egui::Ui, data_source: &mut dyn DataSource) {
#[cfg(feature = "profiling")]
puffin::profile_function!();

let mut viewport = ui.cursor();
viewport.set_width(ui.available_width());
viewport.set_height(ui.available_height());
Expand All @@ -242,6 +245,9 @@ impl PlotTab {
}

pub fn main_ui(&mut self, ui: &mut egui::Ui, data_source: &mut dyn DataSource) {
#[cfg(feature = "profiling")]
puffin::profile_function!();

self.shared_plot.borrow_mut().set_end(data_source.end());

if ui.available_width() > 1000.0 {
Expand Down

0 comments on commit f113985

Please sign in to comment.