Add Disk IO gauge.

This commit is contained in:
Ben Loftis 2018-02-16 09:03:57 -06:00
parent ed459ab70a
commit 309ca938e6
9 changed files with 144 additions and 27 deletions

View File

@ -43,7 +43,7 @@ ArdourGauge::on_size_request (Gtk::Requisition* req)
int w, h; int w, h;
_layout->get_pixel_size (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)); req->height = std::max (req->height, std::max (12, h + PADDING));
} }

View 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 /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets
should also be changed. should also be changed.
*/ */
if (_session) { uint32_t max_load = std::min ( playback, capture );
snprintf (
buf, sizeof (buf), disk_io_indicator.set_disk_io(max_load);
_("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 ("");
}
} }
void void

View File

@ -76,6 +76,7 @@
#include "ardour_window.h" #include "ardour_window.h"
#include "dsp_load_indicator.h" #include "dsp_load_indicator.h"
#include "disk_space_indicator.h" #include "disk_space_indicator.h"
#include "disk_io_indicator.h"
#include "editing.h" #include "editing.h"
#include "enums.h" #include "enums.h"
#include "mini_timeline.h" #include "mini_timeline.h"
@ -491,6 +492,7 @@ private:
MiniTimeline mini_timeline; MiniTimeline mini_timeline;
TimeInfoBox* time_info_box; TimeInfoBox* time_info_box;
DspLoadIndicator dsp_load_indicator; DspLoadIndicator dsp_load_indicator;
DiskIoIndicator disk_io_indicator;
DiskSpaceIndicator disk_space_indicator; DiskSpaceIndicator disk_space_indicator;
ArdourWidgets::ArdourVSpacer meterbox_spacer; ArdourWidgets::ArdourVSpacer meterbox_spacer;

View File

@ -714,7 +714,7 @@ ARDOUR_UI::build_menu_bar ()
#if 0 #if 0
hbox->pack_end (cpu_load_label, false, false, 4); hbox->pack_end (cpu_load_label, false, false, 4);
#endif #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 (sample_rate_label, false, false, 4);
hbox->pack_end (timecode_format_label, false, false, 4); hbox->pack_end (timecode_format_label, false, false, 4);
hbox->pack_end (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 (&dsp_load_indicator, X_("DSP"), _("DSP"), true);
_status_bar_visibility.add (&xrun_label, X_("XRun"), _("X-run"), false); _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 (&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 (&sample_rate_label, X_("Audio"), _("Audio"), true);
_status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true); _status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true);
_status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true); _status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true);

View File

@ -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;
}

View File

@ -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

View File

@ -44,14 +44,14 @@ DiskSpaceIndicator::set_available_disk_sec (float sec)
char buf[64]; char buf[64];
if (_sec > 86400) { if (_sec > 86400) {
update (_(">24h")); update (_("Rec: >24h"));
return; return;
} else if (_sec > 32400 /* 9 hours */) { } 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 */) { } else if (_sec > 5940 /* 99 mins */) {
snprintf (buf, sizeof (buf), "%.1fh", _sec / 3600.f); snprintf (buf, sizeof (buf), "Rec: %.1fh", _sec / 3600.f);
} else { } else {
snprintf (buf, sizeof (buf), "%.0fm", _sec / 60.f); snprintf (buf, sizeof (buf), "Rec: %.0fm", _sec / 60.f);
} }
update (std::string (buf)); update (std::string (buf));
} }

View File

@ -52,7 +52,11 @@ DspLoadIndicator::set_dsp_load (const double load)
_dsp_load = load; _dsp_load = load;
char buf[64]; 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)); update (std::string (buf));
} }
@ -94,11 +98,11 @@ DspLoadIndicator::tooltip_text ()
//xruns //xruns
if (_xrun_count == UINT_MAX) { 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) { } 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 { } 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; return buf;

View File

@ -67,6 +67,7 @@ gtk2_ardour_sources = [
'debug.cc', 'debug.cc',
'disk_space_indicator.cc', 'disk_space_indicator.cc',
'duplicate_routes_dialog.cc', 'duplicate_routes_dialog.cc',
'disk_io_indicator.cc',
'dsp_load_indicator.cc', 'dsp_load_indicator.cc',
'edit_note_dialog.cc', 'edit_note_dialog.cc',
'editing.cc', 'editing.cc',