OSDN Git Service

emmc test: fix counter overflow
authorAndriy Naborskyy <andriyn@google.com>
Thu, 15 Oct 2015 17:33:52 +0000 (10:33 -0700)
committerAndriy Naborskyy <andriyn@google.com>
Thu, 15 Oct 2015 17:33:52 +0000 (10:33 -0700)
Fix iops counter overflow that is observed with smaller write size

Bug: 24099467
Change-Id: Ibb1001bde4b68cabf4d0bced6df553f4f772685a

tests/ext4/rand_emmc_perf.c

index ed6a05c..ebd10c8 100644 (file)
@@ -147,7 +147,7 @@ static void perf_test(int fd, int write_mode, off64_t max_blocks)
 {
     struct timeval start, end, res;
     char buf[TST_BLK_SIZE] = { 0 };
-    int iops = 0;
+    long long iops = 0;
     int msecs;
 
     res.tv_sec = 0;
@@ -177,7 +177,7 @@ static void perf_test(int fd, int write_mode, off64_t max_blocks)
     timersub(&end, &start, &res);
 
     msecs = (res.tv_sec * 1000) + (res.tv_usec / 1000);
-    printf("%d %dbyte iops/sec\n", iops * 1000 / msecs, TST_BLK_SIZE);
+    printf("%.0f %dbyte iops/sec\n", (float)iops * 1000 / msecs, TST_BLK_SIZE);
 }
 
 int main(int argc, char *argv[])