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: c077b8d18fa2
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: 7ed2ed4f48cf
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 2, 2019

  1. Copy the full SHA
    7ed2ed4 View commit details
Showing with 17 additions and 4 deletions.
  1. +17 −4 glscopeclient/main.cpp
21 changes: 17 additions & 4 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -268,14 +268,26 @@ void ScopeThread(Oscilloscope* scope)
size_t npolls = 0;
uint32_t delay_max = 500 * 1000;
uint32_t delay_min = 250;
double dt = 0;
while(!g_terminating)
{
//LogDebug("delay = %.2f ms\n", delay_us * 0.001f);
size_t npending = scope->GetPendingWaveformCount();

//LogDebug("delay = %.2f ms, pending=%zu\n", delay_us * 0.001f, npending );

//If the queue is too big, stop grabbing data
//TODO: make the cap be time-based and not waveform-based
if(scope->GetPendingWaveformCount() > 5000)
if(npending > 5000)
{
usleep(50 * 1000);
tlast = GetTime();
continue;
}

//If the queue is more than 5 sec long, wait for a while before polling any more.
//We've gotten ahead of the UI!
if(npending*dt > 5)
{
//LogDebug("Capture thread got 5 sec ahead of UI, pausing\n");
usleep(50 * 1000);
tlast = GetTime();
continue;
@@ -297,7 +309,7 @@ void ScopeThread(Oscilloscope* scope)

//Measure how long the acquisition took
double now = GetTime();
double dt = now - tlast;
dt = now - tlast;
tlast = now;
//LogDebug("Triggered, dt = %.3f ms (npolls = %zu, delay_ms = %.2f)\n",
// dt*1000, npolls, delay_us * 0.001f);
@@ -328,6 +340,7 @@ void ScopeThread(Oscilloscope* scope)
}

npolls = 0;

continue;
}
npolls ++;