Skip to contentSkip to conversation

fsck.f2fs: show elapsed time of full scan

PATCH In review Jaegeuk Kim 2 participants 4 messages May 22, 2019 – May 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.f2fs: show elapsed time of full scan

This patch introduces the elapsed time of fsck.

---
 fsck/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fsck/main.c +3 -1
index d844820..9aca024 100644
@@ -18,6 +18,7 @@
 #include "fsck.h"
 #include <libgen.h>
 #include <ctype.h>
+#include <time.h>
 #include <getopt.h>
 #include "quotaio.h"
 
@@ -745,6 +746,7 @@ int main(int argc, char **argv)
 {
 	struct f2fs_sb_info *sbi;
 	int ret = 0;
+	clock_t start = clock();
 
 	f2fs_init_configuration();
 
@@ -853,7 +855,7 @@ retry:
 	if (ret < 0)
 		return ret;
 
-	printf("\nDone.\n");
+	printf("\nDone: %lf secs\n", (clock() - start) / (double)CLOCKS_PER_SEC);
 	return 0;
 
 out_err:
Signature · 1 line
2.19.0.605.g01d371f741-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Jaegeuk Kim

This patch introduces the elapsed time of fsck.

---
 fsck/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fsck/main.c +2 -0
index d844820..9aca024 100644
@@ -18,6 +18,7 @@
 #include "fsck.h"
 #include <libgen.h>
 #include <ctype.h>
+#include <time.h>
 #include <getopt.h>
 #include "quotaio.h"
 
@@ -745,6 +746,7 @@ int main(int argc, char **argv)
 {
 	struct f2fs_sb_info *sbi;
 	int ret = 0;
+	clock_t start = clock();
 
 	f2fs_init_configuration();
 

fsck/main.c retry: · line 858

Quoted 5 lines
fsck/main.c +1 -1
@@ -853,7 +855,7 @@ retry:
 	if (ret < 0)
 		return ret;
 
-	printf("\nDone.\n");
+	printf("\nDone: %lf secs\n", (clock() - start) / (double)CLOCKS_PER_SEC);

Minor, as comment log says it's only for fsck.

if (c.func == FSCK)

	printf();

Thanks,

Quoted 4 lines
fsck/main.c +0 -0
 	return 0;
 
 out_err:
#2 lore raw
Quoted 28 lines · Chao Yu
Quoted 27 lines · Jaegeuk Kim

This patch introduces the elapsed time of fsck.

---
 fsck/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fsck/main.c +2 -0
index d844820..9aca024 100644
@@ -18,6 +18,7 @@
 #include "fsck.h"
 #include <libgen.h>
 #include <ctype.h>
+#include <time.h>
 #include <getopt.h>
 #include "quotaio.h"
 
@@ -745,6 +746,7 @@ int main(int argc, char **argv)
 {
 	struct f2fs_sb_info *sbi;
 	int ret = 0;
+	clock_t start = clock();
 
 	f2fs_init_configuration();
 
Quoted 8 lines

fsck/main.c retry: · line 858

Quoted 6 lines
fsck/main.c +1 -1
@@ -853,7 +855,7 @@ retry:
 	if (ret < 0)
 		return ret;
 
-	printf("\nDone.\n");
+	printf("\nDone: %lf secs\n", (clock() - start) / (double)CLOCKS_PER_SEC);

Minor, as comment log says it's only for fsck.

I think it doesn't matter for other use cases, even though main reason was for fsck.

Quoted 12 lines

if (c.func == FSCK)

	printf();

Thanks,

Quoted 4 lines
fsck/main.c +0 -0
 	return 0;
 
 out_err:
#3 lore raw
Quoted 33 lines · Jaegeuk Kim
Quoted 32 lines · Chao Yu
Quoted 31 lines · Jaegeuk Kim

This patch introduces the elapsed time of fsck.

---
 fsck/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fsck/main.c +2 -0
index d844820..9aca024 100644
@@ -18,6 +18,7 @@
 #include "fsck.h"
 #include <libgen.h>
 #include <ctype.h>
+#include <time.h>
 #include <getopt.h>
 #include "quotaio.h"
 
@@ -745,6 +746,7 @@ int main(int argc, char **argv)
 {
 	struct f2fs_sb_info *sbi;
 	int ret = 0;
+	clock_t start = clock();
 
 	f2fs_init_configuration();
 
@@ -853,7 +855,7 @@ retry:
 	if (ret < 0)
 		return ret;
 
Quoted 7 lines
Quoted 4 lines

fsck/main.c retry: · line 858

Quoted 2 lines
fsck/main.c +1 -1
-	printf("\nDone.\n");
+	printf("\nDone: %lf secs\n", (clock() - start) / (double)CLOCKS_PER_SEC);

Minor, as comment log says it's only for fsck.

I think it doesn't matter for other use cases, even though main reason was for fsck.

Okay, it's not a big deal. :)

Thanks,

Quoted 13 lines
Quoted 13 lines

if (c.func == FSCK)

	printf();

Thanks,

Quoted 4 lines
fsck/main.c +0 -0
 	return 0;
 
 out_err: