Update writespeed.c

Fixed indentation
This commit is contained in:
David Lin 2020-10-17 11:26:27 +08:00 committed by GitHub
parent 3ff0c07b38
commit b0591443e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 19 deletions

View File

@ -32,31 +32,31 @@ void writespeed(const char* filename, int total_length, int block_size)
return; return;
} }
/* prepare write data */ /* prepare write data */
for (index = 0; index < block_size; index++) for (index = 0; index < block_size; index++)
{ {
buff_ptr[index] = index; buff_ptr[index] = index;
} }
index = 0; index = 0;
/* get the beginning tick */ /* get the beginning tick */
tick = rt_tick_get(); tick = rt_tick_get();
while (index < total_length / block_size) while (index < total_length / block_size)
{ {
length = write(fd, buff_ptr, block_size); length = write(fd, buff_ptr, block_size);
if (length != block_size) if (length != block_size)
{ {
rt_kprintf("write failed\n"); rt_kprintf("write failed\n");
break; break;
} }
index ++; index ++;
} }
tick = rt_tick_get() - tick; tick = rt_tick_get() - tick;
/* close file and release memory */ /* close file and release memory */
close(fd); close(fd);
rt_free(buff_ptr); rt_free(buff_ptr);
/* calculate write speed */ /* 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 / tick * RT_TICK_PER_SECOND);