未验证 提交 917beb74 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #3968 from DavidLin1577/patch-8

Update writespeed.c
......@@ -32,31 +32,31 @@ void writespeed(const char* filename, int total_length, int block_size)
return;
}
/* prepare write data */
for (index = 0; index < block_size; index++)
{
buff_ptr[index] = index;
}
index = 0;
/* prepare write data */
for (index = 0; index < block_size; index++)
{
buff_ptr[index] = index;
}
index = 0;
/* get the beginning tick */
/* get the beginning tick */
tick = rt_tick_get();
while (index < total_length / block_size)
{
length = write(fd, buff_ptr, block_size);
if (length != block_size)
{
rt_kprintf("write failed\n");
break;
}
while (index < total_length / block_size)
{
length = write(fd, buff_ptr, block_size);
if (length != block_size)
{
rt_kprintf("write failed\n");
break;
}
index ++;
}
index ++;
}
tick = rt_tick_get() - tick;
/* close file and release memory */
/* close file and release memory */
close(fd);
rt_free(buff_ptr);
rt_free(buff_ptr);
/* calculate write speed */
rt_kprintf("File write speed: %d byte/s\n", total_length / tick * RT_TICK_PER_SECOND);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册