How can I ensure that a drive is spinning and ready to write data?
-
Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam
-
Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam
TragicComic wrote:
...if I start to write while the drive is idle, I lose a significant number of initial video frames.
I would be more concerned with data loss than I would with drive speed/idling. Think about it -- even if the data to be written was not very much, if you happened to write to the HD when it was not spinning and it lost that data, you've got much bigger problems.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam
Put your ear on it.....
Steve
-
Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam
This is more about Power Management than Disk Management. So (assuming that the disk doesn't have inbuilt smartness to act on power management and completely relies on OS for power mgt), 1. You could set the power management policy in windows (Control Panel!!!) so that it doesn't put the HD in sleep. This doesn't require coding but than needs human intervention in every PC where you run your app. 2. Play with power management API ( SetSystemPowerState(..) or alike) so that your app can notify the OS to not step in and do power management. Don't forget to revert system state on application exit (if required). But must say, above are from my concept rather than any real work relating to such situation. But I know for sure that there exists some API where a app can tell OS to not kick in power mgnt policy.