Skip to content

Commit

Permalink
Put real-time allocation counter into status line 2
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Nov 22, 2023
1 parent 357e1e0 commit da19ec2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions main/src/infrastructure/ui/main_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ impl MainPanel {
if !control_and_feedback_state.feedback_active {
text.push_str(" | FEEDBACK off");
}
if cfg!(debug_assertions) {
let _ = write!(&mut text, " | rt-allocs: {}", undesired_allocation_count());
}
let label = self.view.require_control(root::ID_MAIN_PANEL_STATUS_2_TEXT);
label.disable();
label.set_text(text.as_str());
Expand All @@ -239,14 +242,9 @@ impl MainPanel {
}

fn invalidate_version_text(&self) {
use std::fmt::Write;
let mut text = format!("ReaLearn {}", App::detailed_version_label());
if cfg!(debug_assertions) {
let _ = write!(&mut text, " | rt-allocs: {}", undesired_allocation_count());
}
self.view
.require_control(root::ID_MAIN_PANEL_VERSION_TEXT)
.set_text(text);
.set_text(format!("ReaLearn {}", App::detailed_version_label()));
}

fn invalidate_all_controls(&self) {
Expand Down Expand Up @@ -334,7 +332,7 @@ impl MainPanel {
fn handle_info_event(self: SharedView<Self>, event: &InfoEvent) {
match event {
InfoEvent::UndesiredAllocationCountChanged => {
self.invalidate_version_text();
self.invalidate_status_2_text();
}
}
}
Expand Down

0 comments on commit da19ec2

Please sign in to comment.