Whamcloud - gitweb
LU-1934 ofd: implement precreate batching
[fs/lustre-release.git] / lustre / tests / mpi / lp_utils.c
index ae7bd77..62fe40d 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -50,6 +48,7 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <libcfs/libcfs.h>
 #include "lustre/lustre_user.h"
 #include "lp_utils.h"
 
@@ -87,14 +86,15 @@ inline void end(char *str) {
         MPI_Barrier(MPI_COMM_WORLD);
         if (verbose > 0 && rank == 0) {
                 gettimeofday(&t2, NULL);
-                elapsed = (t2.tv_sec + ((float)t2.tv_usec/1000000))
-                          - (t1.tv_sec + ((float)t1.tv_usec/1000000));
+
+                elapsed = t2.tv_sec - t1.tv_sec +
+                          (float)(t2.tv_usec-t1.tv_usec)/1000000;
                 if (elapsed >= 60) {
                         printf("%s:\tFinished %-15s(%.2f min)\n",
                                timestamp(), str, elapsed / 60);
                 } else {
                         printf("%s:\tFinished %-15s(%.3f sec)\n",
-                              timestamp(), str, elapsed);
+                               timestamp(), str, elapsed);
 
                 }
                 fflush(stdout);