printf("**********************************************\n");\r
}\r
\r
+static clock_t get_ms(void)\r
+{\r
+ return (clock() * 1000) / (CLOCKS_PER_SEC);\r
+}\r
+\r
static bool dir_test(int len)\r
{\r
ext4_file f;\r
clock_t diff;\r
clock_t stop;\r
clock_t start;\r
- start = clock() / (CLOCKS_PER_SEC / 1000);\r
+ start = get_ms();\r
\r
printf("Directory create: /mp/dir1\n");\r
r = ext4_dir_mk("/mp/dir1");\r
}\r
}\r
\r
- stop = clock() / (CLOCKS_PER_SEC / 1000);\r
+ stop = get_ms();\r
diff = stop - start;\r
dir_ls("/mp/dir1");\r
printf("dir_test time: %d ms\n", (int)diff);\r
\r
printf("ext4_fopen: test1\n");\r
\r
- start = clock() / (CLOCKS_PER_SEC / 1000);\r
+ start = get_ms();\r
r = ext4_fopen(&f, "/mp/test1", "wb");\r
if(r != EOK){\r
printf("ext4_fopen ERROR = %d\n", r);\r
}\r
\r
printf("OK\n");\r
- stop = clock() / (CLOCKS_PER_SEC / 1000);\r
+ stop = get_ms();\r
diff = stop - start;\r
size_bytes = rw_szie * rw_count;\r
size_bytes = (size_bytes * 1000) / 1024;\r
printf("ext4_fopen: test1\n");\r
\r
\r
- start = clock() / (CLOCKS_PER_SEC / 1000);\r
+ start = get_ms();\r
r = ext4_fopen(&f, "/mp/test1", "r+");\r
if(r != EOK){\r
printf("ext4_fopen ERROR = %d\n", r);\r
return false;\r
}\r
printf("OK\n");\r
- stop = clock() / (CLOCKS_PER_SEC / 1000);\r
+ stop = get_ms();\r
diff = stop - start;\r
size_bytes = rw_szie * rw_count;\r
size_bytes = (size_bytes * 1000) / 1024;\r
ext4_fremove("/mp/hello.txt");\r
\r
printf("cleanup: remove /mp/test1\n");\r
- start = clock() / (CLOCKS_PER_SEC / 1000);\r
+ start = get_ms();\r
ext4_fremove("/mp/test1");\r
- stop = clock() / (CLOCKS_PER_SEC / 1000);\r
+ stop = get_ms();\r
diff = stop - start;\r
printf("cleanup: time: %d ms\n", (int)diff);\r
\r
\r
printf("cleanup: remove /mp/test1\n");\r
- start = clock() / (CLOCKS_PER_SEC / 1000);\r
+ start =get_ms();\r
ext4_dir_rm("/mp/dir1");\r
- stop = clock() / (CLOCKS_PER_SEC / 1000);\r
+ stop = get_ms();\r
diff = stop - start;\r
printf("cleanup: time: %d ms\n", (int)diff);\r
}\r