Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
*
*
*
*/
#include <ll/i386/cons.h>
#include <kernel/func.h>
#include <fs/bdevinit.h>
#include <fs/bdev.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#define DISKDEVICE "ide/hda"
#define TEST_MB 16
#define NUMBLOCK (TEST_MB*1024l*1024l/512l)
__dev_t dev;
__uint8_t buffer[2048];
int main(int argc,char *argv[])
{
__blkcnt_t blk;
int res;
int errors;
TIME sttime,etime;
showmessage("\n"
"This test read data from first hard disk to test\n"
"disk throughtput.\n"
"Remeber that the reads are made block by block so\n"
"don't worry if you see a low throughtput.\n"
);
dev=bdev_find_byname(DISKDEVICE);
if (dev<0) {
cprintf("\nCan't find device to operate with\n");
return -1;
}
cprintf("\nUsing device %s (dev=%04x)\n",DISKDEVICE,dev);
cprintf("Please wait (reading %i MB linearly?!?)...",TEST_MB);
sttime=sys_gettime(NULL);
errors=0;
for (blk=0;blk<NUMBLOCK;blk++) {
res=bdev_read(dev,blk,buffer);
//res=bdev_seek(dev,blk);
if (res!=0) errors++;
}
etime=sys_gettime(NULL)-sttime;
cprintf("\nDone\n\n");
cprintf("elapse time : %li sec %li msec\n",
etime/1000000l,
(etime/1000l)%1000l);
cprintf("throughtput : %6.3f MB/s\n",
NUMBLOCK*512.0/1024.0/1024.0/etime*1000000.0);
//cprintf("soft reset made: %i\n",ide[0].errors);
cprintf("errors : %i\n",errors);
cprintf("\n");
return 0;
}