fix speed calculate bug
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1231 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
6389520f5e
commit
74bb729462
|
@ -55,7 +55,7 @@ void readspeed(const char* filename, int block_size)
|
|||
rt_free(buff_ptr);
|
||||
|
||||
/* calculate read speed */
|
||||
rt_kprintf("File read speed: %d byte/s\n", total_length/ (tick/RT_TICK_PER_SECOND));
|
||||
rt_kprintf("File read speed: %d byte/s\n", total_length*RT_TICK_PER_SECOND/tick);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
|
|
|
@ -20,7 +20,7 @@ void writespeed(const char* filename, int total_length, int block_size)
|
|||
char *buff_ptr;
|
||||
rt_tick_t tick;
|
||||
|
||||
fd = open(filename, O_WRONLY | O_WRONLY | O_TRUNC, 0);
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
rt_kprintf("open file:%s failed\n", filename);
|
||||
|
@ -53,7 +53,7 @@ void writespeed(const char* filename, int total_length, int block_size)
|
|||
rt_kprintf("write failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
index ++;
|
||||
}
|
||||
tick = rt_tick_get() - tick;
|
||||
|
@ -63,7 +63,7 @@ void writespeed(const char* filename, int total_length, int block_size)
|
|||
rt_free(buff_ptr);
|
||||
|
||||
/* calculate write speed */
|
||||
rt_kprintf("File write speed: %d byte/s\n", total_length/ (tick/RT_TICK_PER_SECOND));
|
||||
rt_kprintf("File write speed: %d byte/s\n", total_length*RT_TICK_PER_SECOND/tick);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
|
|
Loading…
Reference in New Issue