A customer is claiming the following transfer rates for
QNX/DOS/NT:
QNX 3.3 MB/s
NT 6.2 MB/s
DOS 7.9 MB/s
The program used was as shown below.
I have the following suggestion from QNX support, but I’m interested
in any other inputs to get the near platter speed promised by the
marketers in http://www.qnx.com/products/os/qnxrtos.html
- use read/write instead of the streaming layer (fwrite…)
- you can tune Fsys to match the data being read/written (-P) … is data
being written and then not being read back for a while? then you can
decrease the LRU cache. - increase the cache size as much as possible
Has anyone tried to get really fast disk access?
Any tip, ideas & trick would be appreciated.
=== DOS Code ========
#include <stdio.h>
#include <stdlib.h>
//#include <dos.h>
#include <sys/time.h>
#include <fstream.h>
#include <fcntl.h>
#include <unistd.h>
main()
{
FILE fp;
int fd;
char pBuffer;
struct timespec time_start, time_end;
double milliseconds;
int size = 321024;
int blocks = 1281024/32;
int i;
int iCount;
char filename[256];
char chTemp[1024];
pBuffer = (char*)malloc(size);
for (iCount=0;iCount<2;iCount++) {
sprintf(filename,“test%d.dat”,iCount);
if ( (fp = fopen(filename,“wb”)) == NULL)
return 1;
//chsize(fd,size*blocks);
//seek(fd,0);
clock_gettime(CLOCK_REALTIME,&time_start);
for (i = 0; i < blocks; i++)
{
if (1 != fwrite(pBuffer,size,1,fp))
{
return 2;
}
}
clock_gettime(CLOCK_REALTIME,&time_end);
milliseconds = (time_end.tv_sec - time_start.tv_sec) * 1000;
milliseconds += (time_end.tv_nsec - time_start.tv_nsec) / 1000000;
printf(“Writing:\n”);
printf(“Time: %d:%d\n”,(int)(milliseconds/1000.0),((int)milliseconds)
% 1000);
printf(“Data Size: %7.3fMB\n”,(sizeblocks)/1024.0/1024.0);
printf(“Transfer Rate: %7.3f MB/s\n”, ((sizeblocks)/1024.0/1024.0) /
(milliseconds /1000.0));
memset(chTemp,0,1024);
// sprintf(chTemp,“Transfer Rate: %7.3f MB/s\n”,
((size*blocks)/1024.0/1024.0) / (milliseconds /1000.0));
fclose(fp);
if ( (fp = fopen(filename,“rb”)) == NULL)
return 1;
clock_gettime(CLOCK_REALTIME,&time_start);
for (i = 0; i < blocks; i++)
{
if (1 != fread(pBuffer,size,1,fp))
{
return 2;
}
}
clock_gettime(CLOCK_REALTIME,&time_end);
fclose(fp);
milliseconds = (time_end.tv_sec - time_start.tv_sec) * 1000;
milliseconds += (time_end.tv_nsec - time_start.tv_nsec) / 1000000;
printf(“Reading:\n”);
printf(“Time: %d:%d\n”,(int)(milliseconds/1000.0),((int)milliseconds)
% 1000);
printf(“Data Size: %7.3fMB\n”,(sizeblocks)/1024.0/1024.0);
printf(“Transfer Rate: %7.3f MB/s\n”, ((sizeblocks)/1024.0/1024.0) /
(milliseconds /1000.0));
}
return 0;
}
And for NT:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
//#include <dos.h>
//#include <sys/time.h>
#include <fstream.h>
//#include <fcntl.h>
//#include <unistd.h>
main()
{
FILE fp;
int fd;
char pBuffer;
// struct timespec time_start, time_end;
double milliseconds;
int size = 321024;
int blocks = 1281024/32;
int i;
int iCount;
char filename[256];
char chTemp[1024];
pBuffer = (char*)malloc(size);
for (iCount=0;iCount<2;iCount++) {
sprintf(filename,“test%d.dat”,iCount);
if ( (fp = fopen(filename,“wb”)) == NULL)
return 1;
//chsize(fd,size*blocks);
//seek(fd,0);
//clock_gettime(CLOCK_REALTIME,&time_start);
milliseconds = GetTickCount();
for (i = 0; i < blocks; i++)
{
if (1 != fwrite(pBuffer,size,1,fp))
{
return 2;
}
}
//clock_gettime(CLOCK_REALTIME,&time_end);
milliseconds = GetTickCount() -milliseconds;
//milliseconds = (time_end.tv_sec - time_start.tv_sec) * 1000;
//milliseconds += (time_end.tv_nsec - time_start.tv_nsec) / 1000000;
printf(“Writing:\n”);
printf(“Time: %d:%d\n”,(int)(milliseconds/1000.0),((int)milliseconds)
% 1000);
printf(“Data Size: %7.3fMB\n”,(sizeblocks)/1024.0/1024.0);
printf(“Transfer Rate: %7.3f MB/s\n”, ((sizeblocks)/1024.0/1024.0) /
(milliseconds /1000.0));
memset(chTemp,0,1024);
// sprintf(chTemp,“Transfer Rate: %7.3f MB/s\n”,
((size*blocks)/1024.0/1024.0) / (milliseconds /1000.0));
fclose(fp);
if ( (fp = fopen(filename,“rb”)) == NULL)
return 1;
milliseconds = GetTickCount();
//clock_gettime(CLOCK_REALTIME,&time_start);
for (i = 0; i < blocks; i++)
{
if (1 != fread(pBuffer,size,1,fp))
{
return 2;
}
}
//clock_gettime(CLOCK_REALTIME,&time_end);
fclose(fp);
milliseconds = GetTickCount()-milliseconds;
//milliseconds = (time_end.tv_sec - time_start.tv_sec) * 1000;
//milliseconds += (time_end.tv_nsec - time_start.tv_nsec) / 1000000;
printf(“Reading:\n”);
printf(“Time: %d:%d\n”,(int)(milliseconds/1000.0),((int)milliseconds)
% 1000);
printf(“Data Size: %7.3fMB\n”,(sizeblocks)/1024.0/1024.0);
printf(“Transfer Rate: %7.3f MB/s\n”, ((sizeblocks)/1024.0/1024.0) /
(milliseconds /1000.0));
}
return 0;
}