Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 41ba86e3e9c7
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 52724cb0730c
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Dec 13, 2019

  1. HistoryWindow: don't save historical waveforms for disabled channels,…

    … several optimizations for RAM usage
    azonenberg committed Dec 13, 2019
    Copy the full SHA
    52724cb View commit details
Showing with 13 additions and 3 deletions.
  1. +13 −3 glscopeclient/HistoryWindow.cpp
16 changes: 13 additions & 3 deletions glscopeclient/HistoryWindow.cpp
Original file line number Diff line number Diff line change
@@ -143,9 +143,19 @@ void HistoryWindow::OnWaveformDataReady(Oscilloscope* scope)
{
auto c = scope->GetChannel(i);
auto dat = c->GetData();
if(!c->IsEnabled()) //don't save historical waveforms from disabled channels
{
hist[c] = NULL;
continue;
}
if(!dat)
continue;
hist[c] = dat;

//Clear excess space out of the waveform buffer
auto adat = dynamic_cast<AnalogCapture*>(data);
if(adat)
adat->m_samples.shrink_to_fit();
}
row[m_columns.m_history] = hist;

@@ -194,17 +204,17 @@ void HistoryWindow::OnWaveformDataReady(Oscilloscope* scope)
bytes_used += sizeof(AnalogCapture);

//Add size of each sample
bytes_used += sizeof(AnalogSample) * acap->GetDepth();
bytes_used += sizeof(AnalogSample) * acap->m_samples.capacity();
}
}

//Convert to MB/GB
float mb = bytes_used / (1024.0f * 1024.0f);
float gb = mb / 1024;
if(gb > 1)
snprintf(tmp, sizeof(tmp), "Memory: %.2f GB", gb);
snprintf(tmp, sizeof(tmp), "%u WFM / %.2f GB", children.size(), gb);
else
snprintf(tmp, sizeof(tmp), "Memory: %.0f MB", mb);
snprintf(tmp, sizeof(tmp), "%u WFM / %.0f MB", children.size(), mb);
m_memoryLabel.set_label(tmp);

m_updating = false;