Add Disk IO gauge.
authorBen Loftis <ben@harrisonconsoles.com>
Fri, 16 Feb 2018 15:03:57 +0000 (09:03 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Sat, 17 Feb 2018 15:24:14 +0000 (09:24 -0600)
gtk2_ardour/ardour_gauge.cc
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/disk_io_indicator.cc [new file with mode: 0644]
gtk2_ardour/disk_io_indicator.h [new file with mode: 0644]
gtk2_ardour/disk_space_indicator.cc
gtk2_ardour/dsp_load_indicator.cc
gtk2_ardour/wscript

index 7387b86b3834bf3635f732713e2cc1291b522125..f4877c5f7aa1f9595f4131e56784a0bc9a704489 100644 (file)
@@ -43,7 +43,7 @@ ArdourGauge::on_size_request (Gtk::Requisition* req)
        int w, h;
        _layout->get_pixel_size (w, h);
 
-       req->width = std::max (req->width, 80  /*std::max (20, w + PADDING) */);
+       req->width = std::max (req->width, 100  /*std::max (20, w + PADDING) */);
        req->height = std::max (req->height, std::max (12, h + PADDING));
 }
 
index c1ebaac229049773173e781b08ec9d17f8515d0b..5a37dc1d85e554c87bedae23b7eddfbbc5bda18f 100644 (file)
@@ -1739,22 +1739,10 @@ ARDOUR_UI::update_buffer_load ()
        /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets
           should also be changed.
        */
-
-       if (_session) {
-               snprintf (
-                       buf, sizeof (buf),
-                       _("Buffers: <span foreground=\"green\">p:</span><span foreground=\"%s\">%" PRIu32 "%%</span> "
-                                  "<span foreground=\"green\">c:</span><span foreground=\"%s\">%" PRIu32 "%%</span>"),
-                       playback <= 5 ? X_("red") : X_("green"),
-                       playback,
-                       capture <= 5 ? X_("red") : X_("green"),
-                       capture
-                       );
-
-               buffer_load_label.set_markup (buf);
-       } else {
-               buffer_load_label.set_text ("");
-       }
+       
+       uint32_t max_load = std::min ( playback, capture );
+       
+       disk_io_indicator.set_disk_io(max_load);
 }
 
 void
index a0f6d5f783d82b2ae1d91d63224be6b2b6c309dd..12fa270e17cd1f0869ac58c7771ee24fad4cc933 100644 (file)
@@ -76,6 +76,7 @@
 #include "ardour_window.h"
 #include "dsp_load_indicator.h"
 #include "disk_space_indicator.h"
+#include "disk_io_indicator.h"
 #include "editing.h"
 #include "enums.h"
 #include "mini_timeline.h"
@@ -491,6 +492,7 @@ private:
        MiniTimeline       mini_timeline;
        TimeInfoBox*       time_info_box;
        DspLoadIndicator   dsp_load_indicator;
+       DiskIoIndicator    disk_io_indicator;
        DiskSpaceIndicator disk_space_indicator;
 
        ArdourWidgets::ArdourVSpacer      meterbox_spacer;
index 55d01f3c0c1b757131af705020ac6ffad63abf65..8f3fed3e9303335c8ef816aa52c7da8f62b410ec 100644 (file)
@@ -714,7 +714,7 @@ ARDOUR_UI::build_menu_bar ()
 #if 0
        hbox->pack_end (cpu_load_label, false, false, 4);
 #endif
-       hbox->pack_end (buffer_load_label, false, false, 4);
+       hbox->pack_end (disk_io_indicator, false, false, 4);
        hbox->pack_end (sample_rate_label, false, false, 4);
        hbox->pack_end (timecode_format_label, false, false, 4);
        hbox->pack_end (format_label, false, false, 4);
@@ -733,7 +733,7 @@ ARDOUR_UI::build_menu_bar ()
        _status_bar_visibility.add (&dsp_load_indicator,    X_("DSP"),       _("DSP"), true);
        _status_bar_visibility.add (&xrun_label,            X_("XRun"),      _("X-run"), false);
        _status_bar_visibility.add (&peak_thread_work_label,X_("Peakfile"),  _("Active Peak-file Work"), false);
-       _status_bar_visibility.add (&buffer_load_label,     X_("Buffers"),   _("Buffers"), true);
+       _status_bar_visibility.add (&disk_io_indicator,     X_("Buffers"),   _("Buffers"), true);
        _status_bar_visibility.add (&sample_rate_label,     X_("Audio"),     _("Audio"), true);
        _status_bar_visibility.add (&timecode_format_label, X_("TCFormat"),  _("Timecode Format"), true);
        _status_bar_visibility.add (&format_label,          X_("Format"),    _("File Format"), true);
diff --git a/gtk2_ardour/disk_io_indicator.cc b/gtk2_ardour/disk_io_indicator.cc
new file mode 100644 (file)
index 0000000..3b8c616
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "ardour_ui.h"
+#include "disk_io_indicator.h"
+
+#include "ardour/audioengine.h"
+
+#include "pbd/i18n.h"
+
+#define PADDING 3
+
+DiskIoIndicator::DiskIoIndicator ()
+       : ArdourGauge ("00.0%")
+       , _disk_io (0)
+{
+}
+
+void
+DiskIoIndicator::set_disk_io (const double load)
+{
+       if (load == _disk_io) {
+               return;
+       }
+       _disk_io = load;
+
+       char buf[64];
+       snprintf (buf, sizeof (buf), "Dsk: %.1f%%", _disk_io);
+       update (std::string (buf));
+}
+
+float
+DiskIoIndicator::level () const {
+       return (_disk_io / 100.f);
+}
+
+bool
+DiskIoIndicator::alert () const
+{
+       return false;
+}
+
+ArdourGauge::Status
+DiskIoIndicator::indicator () const
+{
+       if (_disk_io < 50) {
+               return ArdourGauge::Level_CRIT;
+       } else if (_disk_io < 75) {
+               return ArdourGauge::Level_WARN;
+       } else {
+               return ArdourGauge::Level_OK;
+       }
+}
+
+std::string
+DiskIoIndicator::tooltip_text ()
+{
+       char buf[64];
+
+       snprintf (buf, sizeof (buf), _("Disk I/O cache: %.1f"), _disk_io);
+
+       return buf;
+}
diff --git a/gtk2_ardour/disk_io_indicator.h b/gtk2_ardour/disk_io_indicator.h
new file mode 100644 (file)
index 0000000..f2b10cd
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __gtkardour_disk_io_indicator_h__
+#define __gtkardour_disk_io_indicator_h__
+
+#include <pangomm.h>
+
+#include "ardour_gauge.h"
+
+class DiskIoIndicator : public ArdourGauge
+{
+public:
+       DiskIoIndicator ();
+
+       void set_disk_io (const double load);
+
+protected:
+       bool alert () const;
+       ArdourGauge::Status indicator () const;
+       float level () const;
+       std::string tooltip_text ();
+
+private:
+
+       float _disk_io;
+};
+
+#endif
index 2bc31babcef0951c7e1fa83b22483156c6a08cc1..acdfa56d74cbdd4d7a364f0b579fffed7cb8c83c 100644 (file)
@@ -44,14 +44,14 @@ DiskSpaceIndicator::set_available_disk_sec (float sec)
 
        char buf[64];
        if (_sec > 86400) {
-               update (_(">24h"));
+               update (_("Rec: >24h"));
                return;
        } else if (_sec > 32400 /* 9 hours */) {
-               snprintf (buf, sizeof (buf), "%.0fh", _sec / 3600.f);
+               snprintf (buf, sizeof (buf), "Rec: %.0fh", _sec / 3600.f);
        } else if (_sec > 5940 /* 99 mins */) {
-               snprintf (buf, sizeof (buf), "%.1fh", _sec / 3600.f);
+               snprintf (buf, sizeof (buf), "Rec: %.1fh", _sec / 3600.f);
        } else {
-               snprintf (buf, sizeof (buf), "%.0fm", _sec / 60.f);
+               snprintf (buf, sizeof (buf), "Rec: %.0fm", _sec / 60.f);
        }
        update (std::string (buf));
 }
index 1149c7d6a56fad1c78e5d77dc66eb630f616f7a0..1def589eee8d7e5e7cbca20548af9bcc99725c94 100644 (file)
@@ -52,7 +52,11 @@ DspLoadIndicator::set_dsp_load (const double load)
        _dsp_load = load;
 
        char buf[64];
-       snprintf (buf, sizeof (buf), "DSP %.1f%%", _dsp_load);
+       if (_xrun_count > 0) {
+               snprintf (buf, sizeof (buf), "DSP: %.1f%% (%d)", _dsp_load, _xrun_count);
+       } else {
+               snprintf (buf, sizeof (buf), "DSP: %.1f%%", _dsp_load);
+       }
        update (std::string (buf));
 }
 
@@ -94,11 +98,11 @@ DspLoadIndicator::tooltip_text ()
 
        //xruns
        if (_xrun_count == UINT_MAX) {
-               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: ?"), _dsp_load);
+               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: ?\nClick to clear xruns."), _dsp_load);
        } else if (_xrun_count > 9999) {
-               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: >10k"), _dsp_load);
+               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: >10k\nClick to clear xruns."), _dsp_load);
        } else {
-               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u"), _dsp_load, _xrun_count);
+               snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u\nClick to clear xruns."), _dsp_load, _xrun_count);
        }
 
        return buf;
index a564c3c1097ec7da5b2fa128aa6f0d72c0c30077..4857ebd89e98738fd8233226424cf23dcdd5ed09 100644 (file)
@@ -67,6 +67,7 @@ gtk2_ardour_sources = [
         'debug.cc',
         'disk_space_indicator.cc',
         'duplicate_routes_dialog.cc',
+        'disk_io_indicator.cc',
         'dsp_load_indicator.cc',
         'edit_note_dialog.cc',
         'editing.cc',