Budget the sample buffer in samples per signal, under a hard memory limit
--buffer-samples (k/M/G) replaces --buffer-mb: the request is rounded down to a power of two for every signal and the shared time ring. A separate memory limit (--memory-limit-mb, a Preferences row, default 8 GiB) halves the plan until the real ring bytes fit and says so on stderr and in the status line. The per-source key buffer_mb becomes buffer_samples; an old buffer_mb is ignored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
616cde5b13
commit
034c82f7d7
20 files changed
+516
-134
No files matched your search
@@ -328,7 +328,7 @@ std::vector<KnownSource> known_sources() {
|
||||
s.port = port;
|
||||
s.config = name;
|
||||
s.comment = st.comment;
|
||||
s.buffer_mb = st.buffer_mb;
|
||||
s.buffer_samples = st.buffer_samples;
|
||||
s.relative_time = st.relative_time;
|
||||
s.capture_packets = st.capture_packets;
|
||||
s.multicast = st.multicast;
|
||||
@@ -347,7 +347,7 @@ std::vector<KnownSource> known_sources() {
|
||||
// session file per probe run and every one holds `signals = ["", "", "", ""]`. One that
|
||||
// carries a *setting* is worth a row even before it has ever streamed -- that is how a host is
|
||||
// set up from the chooser's form, and the settings are the whole point of editing one.
|
||||
const bool configured = s.signals > 0 || s.buffer_mb > 0.0 || !st.comment.empty() ||
|
||||
const bool configured = s.signals > 0 || s.buffer_samples > 0 || !st.comment.empty() ||
|
||||
st.relative_time || st.capture_packets > 0;
|
||||
if (!configured) continue;
|
||||
struct stat fb {};
|
||||
@@ -583,9 +583,11 @@ bool load_layout(const std::string& path, LayoutState& out) {
|
||||
if (SourceConfig::valid_key(k)) st.source_opts.set(k, strip_quote(value));
|
||||
} else if (key == "comment") {
|
||||
st.comment = strip_quote(value);
|
||||
} else if (key == "buffer_mb") {
|
||||
} else if (key == "buffer_samples") {
|
||||
try {
|
||||
st.buffer_mb = std::stod(value);
|
||||
// A negative or absurd count is "not stored", not a request: `stoull` wraps a minus sign.
|
||||
const unsigned long long n = value.find('-') == std::string::npos ? std::stoull(value) : 0;
|
||||
st.buffer_samples = n >= 128 && n <= 1000000000000ull ? n : 0;
|
||||
} catch (...) {
|
||||
}
|
||||
} else if (key == "relative_time") {
|
||||
@@ -768,7 +770,7 @@ bool save_layout(const std::string& path, const LayoutState& state) {
|
||||
o << "trigger_density_tau = " << state.trigger.density_tau_s << "\n";
|
||||
o << "trigger_density_factor = " << state.trigger.density_factor << "\n";
|
||||
if (!state.comment.empty()) o << "comment = " << toml_escape(state.comment) << "\n";
|
||||
if (state.buffer_mb > 0.0) o << "buffer_mb = " << state.buffer_mb << "\n";
|
||||
if (state.buffer_samples > 0) o << "buffer_samples = " << state.buffer_samples << "\n";
|
||||
o << "relative_time = " << (state.relative_time ? "true" : "false") << "\n";
|
||||
if (state.capture_packets > 0) o << "capture_packets = " << state.capture_packets << "\n";
|
||||
for (const auto& row : state.rows) {
|
||||
|
||||
Reference in new issue
Block a user