# Datalogger get\_stream\_data() execution time increase

**URL:** https://forum.liquidinstruments.com/t/datalogger-get-stream-data-execution-time-increase/1214
**Category:** Support & Troubleshooting
**Created:** [July 10, 2025, 10:02am UTC](https://forum.liquidinstruments.com/t/datalogger-get-stream-data-execution-time-increase/1214 "2025-07-10T10:02:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michkern](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@michkern](https://forum.liquidinstruments.com/u/michkern)
#### Post date: [July 10, 2025, 10:02am UTC](https://forum.liquidinstruments.com/t/datalogger-get-stream-data-execution-time-increase/1214/1 "2025-07-10T10:02:43Z")

</div>

**Moku model:** Go  
**Operating system:** Windows, Matlab API  
**Software version:**  
**Bug or support request description:**  
When periodically fetching data from the Datalogger stream over a longer period of time (hours), the execution time of the get\_stream\_data() command behaves very strangely and increases over time (see picture below), which limits long-term measurements. The code used to record this can be found below. The reason we are performing the measurement in this way is that we are simultaneously sweeping a different parameter on a different instrument and we need to correlate that parameter with the data from the Datalogger - of course, if you have a better suggestion, we are more than happy to try it out.

 ![command_execution_time](https://canada1.discourse-cdn.com/flex035/uploads/liquidinstruments/original/1X/597717f42b1b8b695c8e364a6d8c1cd4b94ecf68.png)

**Used code (cleaned up slightly)**

**Connect to instruments**

```auto
dl = MokuDatalogger('192.168.203.5',force_connect=true);
sgen=SMA100B_initialize('TCPIP0::192.168.203.3::inst0::INSTR')

```

**Instrument configuration**

```auto
fstart=50e6; %start of freq sweep
fend=90e6; %end of freq sweep
step=0.25e6;
freqs = linspace(fstart,fend, (fend-fstart)/step);
...
%Moku stream
stream_duration=200*length(freqs);

```

**Measurement**

```auto
SMA100B_setfrq(sgen,freqs(1));
dl.start_streaming('duration', stream_duration);
pause(1)
on_Res_x_av=zeros(length(freqs),1);
on_Res_y_av=zeros(length(freqs),1);
tfreqav=[];
tdatav=[];
tmeanav=[];
tplotav=[];
tavgav=[];
ttot=[];
	for j = 1:ave
	tstart=tic;
	tfreq=[];
	tdat=[];
	tmean=[];
	tplot=[];
	tavg=[];
		for i = 1:length(freqs)
		tic
		SMA100B_setfrq(sgen,freqs(i)); %sweeping frequencies
		pause(t_settle);
		tfreq(end+1)=toc;
		tic
		data = dl.get_stream_data();
		tdat(end+1)=toc;
		tic
		onRes_x(i) = mean(data.ch1);
		tmean(end+1)=toc;
		tic
		plot(freqs(1:i)/1e6, onRes_x(1:i))
		title(strcat('Raw data'))
		xlabel('MW frequency / MHz ')
		ylabel('Ch1 / V')
		tplot(end+1)=toc;
		end
	tic
	on_Res_x_av=on_Res_x_av(:,1)+onRes_x(:,1);
	on_Res_x_av=on_Res_x_av(:,1)/2;
	tavg(end+1)=toc;
	tfreqav(end+1)=mean(tfreq);
	tdatav(end+1)=mean(tdat);
	tmeanav(end+1)=mean(tmean);
	tplotav(end+1)=mean(tplot);
	tavgav(end+1)=mean(tavg);
	ttot(end+1)=toc(tstart);
	fprintf('%f\n sweep took %f\n',j ,ttot(end))
end
plot(freqs/1e6, on_Res_x_av)
dl.stop_streaming();

```

---

<div class="post-metadata">

### Author: ![Dylan](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Dylan](https://forum.liquidinstruments.com/u/Dylan)
#### Post date: [July 10, 2025, 10:54pm UTC](https://forum.liquidinstruments.com/t/datalogger-get-stream-data-execution-time-increase/1214/2 "2025-07-10T22:54:05Z")

</div>

Hello @michkern ,  
Thank you for reaching out! This is very interesting; I will work on replicating this and update the thread with my findings and any workarounds. Thank you!
