summaryrefslogtreecommitdiffhomepage
path: root/UI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'UI.cpp')
-rw-r--r--UI.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/UI.cpp b/UI.cpp
index 5332bba..a28608a 100644
--- a/UI.cpp
+++ b/UI.cpp
@@ -18,18 +18,24 @@ const int midi_monitor_max_size = 3;
using namespace std::chrono_literals;
-static std::vector<std::string> mode_names{
+namespace {
+
+const int midi_bandwidth = 3125; // bytes/s
+
+std::vector<std::string> mode_names{
"NoteClick", "Clock", "Internal"
};
-static std::vector<std::string> output_names{
+std::vector<std::string> output_names{
"Off", "On"
};
-static std::vector<std::string> active_sensing_names{
+std::vector<std::string> active_sensing_names{
"Not Detected", "Detected"
};
+}
+
IntervalCounter::IntervalCounter()
{
}
@@ -49,15 +55,16 @@ int IntervalCounter::get_count_per_second()
return count_per_second;
}
-void IntervalCounter::count()
+void IntervalCounter::count(uint64_t n)
{
- m_count++;
+ m_count += n;
}
UI::UI(Config& config):
m_config(config),
m_main_loops{},
m_midi_events{},
+ m_midi_bytes{},
m_midi_notes{},
m_active_sensing_timestamp{},
m_midi_timestamp{},
@@ -90,6 +97,7 @@ void UI::draw()
std::vector<int> cpuloads = get_cpu_loads();
int main_loops_per_second = m_main_loops.get_count_per_second();
int midi_events_per_second = m_midi_events.get_count_per_second();
+ int midi_bytes_per_second = m_midi_bytes.get_count_per_second();
int midi_notes_per_second = m_midi_notes.get_count_per_second();
int temperature = m_temperature.read_degree();
@@ -165,6 +173,7 @@ void UI::draw()
std::cout << " MIDI Active Sensing: " << fmt::format(value_color, "{}", active_sensing_names[active_sensing_detected]) << std::endl;
std::cout << fmt::format(" MIDI Events/s:{:3}", midi_events_per_second) << std::endl;
std::cout << fmt::format(" MIDI Notes/s: {:3}", midi_notes_per_second) << std::endl;
+ std::cout << fmt::format(" MIDI Bytes/s: {:3} ({}%)", midi_bytes_per_second, midi_bytes_per_second * 100 / midi_bandwidth) << std::endl;
std::cout << fmt::format(" MIDI Click: {:3} BPM", m_note_bpm) << std::endl;
std::cout << fmt::format(" MIDI Clock: {:3} BPM", m_clock_bpm) << std::endl;
std::cout << fmt::format(" Internal: {:3} BPM", internal_bpm) << std::endl;
@@ -228,9 +237,10 @@ void UI::count_main_loops()
m_main_loops.count();
}
-void UI::count_midi_events()
+void UI::count_midi_events(size_t size)
{
m_midi_events.count();
+ m_midi_bytes.count(size);
}
void UI::count_midi_notes()