BTW, I threw together a small app that I now run in parallel with comskip, which reads the file throttled to 25MB/s (I haven't made the throttling configurable yet).
This allows me to process 2 HD shows simultaneously before being either CPU or disk limited on the Core i7 920. (For some reason even with 6 threads a single show stays below 40% CPU). SD shows I can get closer to 35MB/s if I pull the whole file into cache when comskip starts, but HD shows are a bit slower than the 25MB/s, and if it lags behind too much, 2 HD shows is bigger than my RAM so it ends up uncached again.
By running this with comskip, (along with the lowres option and 6 threads configured in the ini) I can have 2 1 hour HD shows processed in parallel in about 6 minutes. On a WD20EARS Green drive.
Reading the whole file without throttling an hour of SD takes less than 1 minute. It is kludgy with the separate process though, and if an HD show is slower than normal for some reason and gets kicked out of cache before comskip gets to whats read in it will be back to lots of slow disk seeks.
Here is the code of the app I threw together to read the files into cache:
Code:
// prime_cache.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <iostream>
using namespace std;
const __int64 target_bytes_per_second = 25 * 1048576; // 25MB/s.
__int64 GetExpectedBytesRead() {
static DWORD start_tick = GetTickCount();
DWORD current_tick = GetTickCount();
DWORD elapsed_ticks = current_tick - start_tick;
return (target_bytes_per_second * elapsed_ticks) / 1000LL;
}
int main(int argc, char* argv[]) {
const DWORD buffer_size = 4 * 1048576; // 4MB
int failures = 0;
char* buffer = new char[buffer_size];
__int64 total_bytes_read = 0;
for (int i = 1; i < argc; ++i) {
char* filename = argv[i];
HANDLE hFile = CreateFile(
filename,
FILE_READ_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (hFile == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
cout << "Failed to open file " << filename << " error code: " << err << std::endl;
++failures;
continue;
}
try {
while (true) {
DWORD bytes_read;
if (ReadFile(hFile, buffer, buffer_size, &bytes_read, NULL) == 0) {
DWORD err = GetLastError();
cout << "Read failed from file: " << filename << " error code: " << err << std::endl;
++failures;
break;
}
if (bytes_read == 0) // done with file
break;
total_bytes_read += bytes_read;
while (GetExpectedBytesRead() < total_bytes_read)
Sleep(1);
}
} catch(...) {
cout << "Exception thrown while processing " << filename << "!\n";
++failures;
}
CloseHandle(hFile);
}
delete[] buffer;
return failures;
}