summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-19 09:13:46 +0100
committerDavid Robillard <d@drobilla.net>2017-03-19 09:13:46 +0100
commitf062189c8219041fad45cfd340c367e5c4796933 (patch)
tree346222e8dc724e2a1d8ebc2a3aacc2bb1d8b4698
parent1a31907d1ad2e9c8ed0cdced09e81f7a7ec07504 (diff)
downloadingen-f062189c8219041fad45cfd340c367e5c4796933.tar.gz
ingen-f062189c8219041fad45cfd340c367e5c4796933.tar.bz2
ingen-f062189c8219041fad45cfd340c367e5c4796933.zip
Shrink status bar text and fix initial DSP load display
-rw-r--r--bundles/ingen.lv2/ingen.ttl7
-rw-r--r--ingen/URIs.hpp3
-rw-r--r--ingen/ingen.h1
-rw-r--r--src/URIs.cpp3
-rw-r--r--src/gui/App.cpp10
-rw-r--r--src/gui/App.hpp3
-rw-r--r--src/server/Engine.cpp44
-rw-r--r--src/server/Engine.hpp38
-rw-r--r--src/server/Load.hpp57
-rw-r--r--src/server/events/Get.cpp23
10 files changed, 102 insertions, 87 deletions
diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl
index e0f52993..90c47c82 100644
--- a/bundles/ingen.lv2/ingen.ttl
+++ b/bundles/ingen.lv2/ingen.ttl
@@ -48,13 +48,6 @@ ingen:canvasY
rdfs:label "canvas Y" ;
rdfs:comment "The Y coordinate of an item on a canvas." .
-ingen:maxEventLoad
- a rdf:Property ,
- owl:DatatypeProperty ;
- rdfs:range xsd:decimal ;
- rdfs:label "maximum event load" ;
- rdfs:comment "The maximum fraction of a cycle spent processing events." .
-
ingen:minRunLoad
a rdf:Property ,
owl:DatatypeProperty ;
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp
index 44f1056e..9bc21592 100644
--- a/ingen/URIs.hpp
+++ b/ingen/URIs.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -118,7 +118,6 @@ public:
const Quark ingen_head;
const Quark ingen_incidentTo;
const Quark ingen_loadedBundle;
- const Quark ingen_maxEventLoad;
const Quark ingen_maxRunLoad;
const Quark ingen_meanRunLoad;
const Quark ingen_minRunLoad;
diff --git a/ingen/ingen.h b/ingen/ingen.h
index ba56ae52..e3313e28 100644
--- a/ingen/ingen.h
+++ b/ingen/ingen.h
@@ -58,7 +58,6 @@
#define INGEN__head INGEN_NS "head"
#define INGEN__incidentTo INGEN_NS "incidentTo"
#define INGEN__loadedBundle INGEN_NS "loadedBundle"
-#define INGEN__maxEventLoad INGEN_NS "maxEventLoad"
#define INGEN__maxRunLoad INGEN_NS "maxRunLoad"
#define INGEN__meanRunLoad INGEN_NS "meanRunLoad"
#define INGEN__minRunLoad INGEN_NS "minRunLoad"
diff --git a/src/URIs.cpp b/src/URIs.cpp
index 1c0a6b23..47cf64c9 100644
--- a/src/URIs.cpp
+++ b/src/URIs.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -101,7 +101,6 @@ URIs::URIs(Forge& f, URIMap* map, LilvWorld* lworld)
, ingen_head (forge, map, lworld, INGEN__head)
, ingen_incidentTo (forge, map, lworld, INGEN__incidentTo)
, ingen_loadedBundle (forge, map, lworld, INGEN__loadedBundle)
- , ingen_maxEventLoad (forge, map, lworld, INGEN__maxEventLoad)
, ingen_maxRunLoad (forge, map, lworld, INGEN__maxRunLoad)
, ingen_meanRunLoad (forge, map, lworld, INGEN__meanRunLoad)
, ingen_minRunLoad (forge, map, lworld, INGEN__minRunLoad)
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index cc2ab74a..d303348a 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -78,7 +78,6 @@ App::App(Ingen::World* world)
, _sample_rate(48000)
, _block_length(1024)
, _n_threads(1)
- , _max_event_load(0.0f)
, _mean_run_load(0.0f)
, _min_run_load(0.0f)
, _max_run_load(0.0f)
@@ -309,8 +308,6 @@ App::property_change(const Raul::URI& subject,
_block_length = value.get<int32_t>();
} else if (key == uris().ingen_numThreads && value.type() == forge().Int) {
_n_threads = value.get<int>();
- } else if (key == uris().ingen_maxEventLoad && value.type() == forge().Float) {
- _max_event_load = value.get<float>();
} else if (key == uris().ingen_minRunLoad && value.type() == forge().Float) {
_min_run_load = value.get<float>();
} else if (key == uris().ingen_meanRunLoad && value.type() == forge().Float) {
@@ -344,15 +341,12 @@ fraction_label(float f)
std::string
App::status_text() const
{
- return (fmt("<b>Audio:</b> %2.1f kHz / %.1f ms <b>Load: </b> %s events + %s <b>DSP:</b> %s ≤ %s ≤ %s")
+ return (fmt("%2.1f kHz / %.1f ms, %s, %s DSP")
% (_sample_rate / 1e3f)
% (_block_length * 1e3f / (float)_sample_rate)
- % fraction_label(_max_event_load)
% ((_n_threads == 1)
? "1 thread"
: (fmt("%1% threads") % _n_threads).str())
- % fraction_label(_min_run_load)
- % fraction_label(_mean_run_load)
% fraction_label(_max_run_load)).str();
}
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 3dc09ff9..4967513c 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -171,7 +171,6 @@ protected:
int32_t _sample_rate;
int32_t _block_length;
int32_t _n_threads;
- float _max_event_load;
float _mean_run_load;
float _min_run_load;
float _max_run_load;
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 647fa6e6..27ca83e4 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -330,29 +330,27 @@ Engine::quit()
_quit_flag = true;
}
-bool
-Engine::main_iteration()
+Properties
+Engine::load_properties() const
{
const Ingen::URIs& uris = world()->uris();
+ return { { uris.ingen_meanRunLoad,
+ uris.forge.make(floorf(_run_load.mean) / 100.0f) },
+ { uris.ingen_minRunLoad,
+ uris.forge.make(_run_load.min / 100.0f) },
+ { uris.ingen_maxRunLoad,
+ uris.forge.make(_run_load.max / 100.0f) } };
+}
+
+bool
+Engine::main_iteration()
+{
_post_processor->process();
_maid->cleanup();
- if (_event_load.changed) {
- _broadcaster->set_property(Raul::URI("ingen:/engine"),
- uris.ingen_maxEventLoad,
- uris.forge.make(_event_load.max / 100.0f));
- _event_load.changed = false;
- }
-
if (_run_load.changed) {
- _broadcaster->put(Raul::URI("ingen:/engine"),
- { { uris.ingen_meanRunLoad,
- uris.forge.make(floorf(_run_load.mean) / 100.0f) },
- { uris.ingen_minRunLoad,
- uris.forge.make(_run_load.min / 100.0f) },
- { uris.ingen_maxRunLoad,
- uris.forge.make(_run_load.max / 100.0f) } });
+ _broadcaster->put(Raul::URI("ingen:/engine"), load_properties());
_run_load.changed = false;
}
@@ -472,7 +470,12 @@ Engine::run(uint32_t sample_count)
// Process events that came in during the last cycle
// (Aiming for jitter-free 1 block event latency, ideally)
const unsigned n_processed_events = process_events();
- const uint64_t t_events = current_time(ctx);
+
+ // Reset load if graph structure has changed
+ if (_reset_load_flag) {
+ _run_load = Load();
+ _reset_load_flag = false;
+ }
// Run root graph
if (_root_graph) {
@@ -490,12 +493,7 @@ Engine::run(uint32_t sample_count)
// Update load for this cycle
if (ctx.duration() > 0) {
- _event_load.update(t_events - _cycle_start_time, ctx.duration());
- _run_load.update(current_time(ctx) - t_events, ctx.duration());
- if (_reset_load_flag) {
- _run_load = Load();
- _reset_load_flag = false;
- }
+ _run_load.update(current_time(ctx) - _cycle_start_time, ctx.duration());
}
return n_processed_events;
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index 084e995d..9b0afc2f 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -25,13 +25,15 @@
#include "ingen/Clock.hpp"
#include "ingen/EngineBase.hpp"
#include "ingen/Interface.hpp"
+#include "ingen/Properties.hpp"
#include "ingen/ingen.h"
#include "ingen/types.hpp"
#include "raul/Noncopyable.hpp"
#include "Event.hpp"
-#include "RunContext.hpp"
#include "EventWriter.hpp"
+#include "Load.hpp"
+#include "RunContext.hpp"
namespace Raul { class Maid; }
@@ -165,38 +167,11 @@ public:
bool atomic_bundles() const { return _atomic_bundles; }
bool activated() const { return _activated; }
+ Properties load_properties() const;
+
private:
Ingen::World* _world;
- struct Load {
- void update(uint64_t time, uint64_t available) {
- const uint64_t load = time * 100 / available;
- if (load < min) {
- min = load;
- changed = true;
- }
- if (load > max) {
- max = load;
- changed = true;
- }
- if (++n == 1) {
- mean = load;
- } else {
- const float a = mean + ((float)load - mean) / (float)++n;
- if (a != mean) {
- changed = floorf(a) != floorf(mean);
- mean = a;
- }
- }
- }
-
- uint64_t min = std::numeric_limits<uint64_t>::max();
- uint64_t max = 0;
- float mean = 0.0f;
- uint64_t n = 0;
- bool changed = false;
- };
-
Raul::Maid* _maid;
BlockFactory* _block_factory;
Broadcaster* _broadcaster;
@@ -219,7 +194,6 @@ private:
std::vector<Raul::RingBuffer*> _notifications;
std::vector<RunContext*> _run_contexts;
uint64_t _cycle_start_time;
- Load _event_load;
Load _run_load;
Clock _clock;
diff --git a/src/server/Load.hpp b/src/server/Load.hpp
new file mode 100644
index 00000000..ed9ee406
--- /dev/null
+++ b/src/server/Load.hpp
@@ -0,0 +1,57 @@
+/*
+ This file is part of Ingen.
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
+
+ Ingen is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or any later version.
+
+ Ingen 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 Affero General Public License for details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Ingen. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INGEN_ENGINE_LOAD_HPP
+#define INGEN_ENGINE_LOAD_HPP
+
+namespace Ingen {
+namespace Server {
+
+struct Load
+{
+ void update(uint64_t time, uint64_t available) {
+ const uint64_t load = time * 100 / available;
+ if (load < min) {
+ min = load;
+ changed = true;
+ }
+ if (load > max) {
+ max = load;
+ changed = true;
+ }
+ if (++n == 1) {
+ mean = load;
+ changed = true;
+ } else {
+ const float a = mean + ((float)load - mean) / (float)++n;
+ if (a != mean) {
+ changed = floorf(a) != floorf(mean);
+ mean = a;
+ }
+ }
+ }
+
+ uint64_t min = std::numeric_limits<uint64_t>::max();
+ uint64_t max = 0;
+ float mean = 0.0f;
+ uint64_t n = 0;
+ bool changed = false;
+};
+
+} // namespace Server
+} // namespace Ingen
+
+#endif // INGEN_ENGINE_LOAD_HPP
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 5988f0e0..7bc2cb6f 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2016 David Robillard <http://drobilla.net/>
+ Copyright 2007-2017 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -88,15 +88,18 @@ Get::post_process()
_engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins);
} else if (_uri == "ingen:/engine") {
// TODO: Keep a proper RDF model of the engine
- URIs& uris = _engine.world()->uris();
- _request_client->put(
- Raul::URI("ingen:/engine"),
- { { uris.param_sampleRate,
- uris.forge.make(int32_t(_engine.sample_rate())) },
- { uris.bufsz_maxBlockLength,
- uris.forge.make(int32_t(_engine.block_length())) },
- { uris.ingen_numThreads,
- uris.forge.make(int32_t(_engine.n_threads())) } });
+ URIs& uris = _engine.world()->uris();
+ Properties props = {
+ { uris.param_sampleRate,
+ uris.forge.make(int32_t(_engine.sample_rate())) },
+ { uris.bufsz_maxBlockLength,
+ uris.forge.make(int32_t(_engine.block_length())) },
+ { uris.ingen_numThreads,
+ uris.forge.make(int32_t(_engine.n_threads())) } };
+
+ const Properties load_props = _engine.load_properties();
+ props.insert(load_props.begin(), load_props.end());
+ _request_client->put(Raul::URI("ingen:/engine"), props);
} else {
_response.send(_request_client.get());
}