ExportData2 takes a longer time with each subsequent call

I’m writing a simple c# program to save some csv data in a while loop. The time required for ExportData2 seems to increase with each call. Starts at about 300 ms, next call 600ms, 900 and so on. Any idea how to get around this?

while (true)
{
if (sample_count % 2 == 0)
{
export_settings.FileName = folder_path + “cso_capture1”;
}
else
{
export_settings.FileName = folder_path + “cso_capture2”;
}
sample_count++;

			Client.SetCaptureSeconds(5);
			Client.Capture(); //blocks until capture is complete, but processing is not complete.
			watch.Start();
			if (Client.BlockUntillProcessingCompleteOrTimeout(new TimeSpan(0, 0, 5)) == false)
				throw new Exception("processing took too long");
			
			Client.ExportData2(export_settings, true, false);
			watch.Stop();
			Console.WriteLine($"Export Time: {watch.ElapsedMilliseconds} ms");
		}

@steve.auchschwelk Hmm… I’m wondering if the increasing “watch” time is due to a backlog of data being processed, or if it is due to the actual export time by itself.

To help isolate the issue, could you run two tests below to see if you find any differences?

watch.Start();
if (Client.BlockUntillProcessingCompleteOrTimeout(new TimeSpan(0, 0, 5)) == false)
	throw new Exception("processing took too long");
watch.Stop();
			
watch.Start();
Client.ExportData2(export_settings, true, false);
watch.Stop();

@steve.auchschwelk I had another quick look at your code with the team here. You might need to call Reset() or Restart(). Can you check if that might be the issue?

1 Like

We’ve just launched a preview of the new automation API for the Logic 2 software! You can find everything you need to get started here: Saleae Logic 2 Automation API

Thanks Tim and Mark. Had to go off and do another task for a while, but I’m back now and will try to test. Will also look at the new API.

1 Like

Thanks Tim. You were right. Much appreciated.

1 Like