08-23-2007 07:59 AM
Thank you GerdW for the test file.
It works very well on my machine as well, which confuses me even more.
08-23-2007 08:05 AM
Two ideas.
1) Put an indicator on the returned postion offset from your file write to see if you are over-flowing the I32 representation.
2) Move your file writes to a seperate loop and pass updates via a queue. Since you are gather data at a sizable fraction of the PCI bandwidth, the systems file cache may be getting filled. This may not show up in the stand-alone test because the DAQ is not keeping the buss busy.
Ben
08-23-2007 08:13 AM
And one more idea...
Use Gerds example to "pre-write" the file then after closing and reopening it, use that file as your data file. The theory behind this idea is that the allocation of the file is slowing down your file writes so by pre-writing it, the space for the file is allready allocated and you are just over-writing the data.
Ben
08-23-2007 10:13 AM
You are right that the problem is related to the high sampling rate. As long as the sampling rate is below 400 kHz there are no problems. However, when going above 450 kHz the program hangs when reaching 152 Mb independently of the frequency.
/Qualle
08-23-2007 10:15 AM
Taking one giant step back to try to see the forest for the trees...
What's this app all about? What is the meaning of the timestamps you are collecting? What kind of processing and analysis will be done on them? At what rate do your Sample Clock (aka "Gate") signals come in?
Counter tasks require frequent PCI bus access. Your board and many others have an *extremely* small hardware buffer on the board for counter samples -- 2 samples worth. So the board's gotta negotiate PCI ownership almost constantly to keep that data moving into your task's RAM buffer.
With 2 counter tasks contending for the PCI bus, and the CPU demand of high-rate disk streaming, you're really up against it. No guarantee that you can get there from here reliably (depending on exactly where here and there are...). You may need to look into ways to re-think the app to reduce the sampling rate.
-Kevin P.
08-24-2007 08:13 AM
08-24-2007 08:21 AM
Thank you for your advice! I'll take this into consideration.
/Qualle
08-24-2007 08:24 AM
I have to agree with Dr Gray but I want to repeat that "pre-writting" the file should eleiminate much of the overhead associated with writting to the file. If there are still problems using the "pre-writting" technique, then the bottle kneck is the disk I/O sub-system and your choices are;
1) faster disk (raid)
2) Deffer file writes by buffering in memory until after the acq is done
3) Divide and conquer - Use two computers with idenical hardware and siycronize acq's so one machine starts at the same sample the other stops and flip-flop back and forth between the machines to collect the data. Post process to merge files from two machines.
4) Collect data on one machine and TCP/IP (or reflective memory) it to another machine for writing to file.
Ben
08-24-2007 08:59 AM
Qualle,
You're getting some fantastic tips from others here about extreme optimization of a difficult very-high-bandwidth task. I'm learning some things here myself.
However, I'd still like to be "convinced" that your app really needs this high degree of complexity and optimization. I've found that a pretty good percentage of the difficult counter/timer questions posed on the forums can be solved to the satisfaction of the poster by answering a simpler question.
So, what is the physical meaning of the measurement? What determines your sample rate? Is it an external signal that generates the sample clock pulses? Is it constant-rate or variable? If variable, how fast can the rate change? If you timestamp individual pulses every few microseconds, but the average rate doesn't change much over a millisecond, you may be working really hard to save huge quantities of high-bandwidth data that's largely redundant.
-Kevin P.
08-24-2007 09:05 AM
"80 MHz clock on each pulse that enters one of the gates."
I assume this is an Non-Destructive Test where the magintude postion of pulses relative to a gate are of interest.
Ben