]> git-server-git.apps.pok.os.sepia.ceph.com Git - ffsb.git/commitdiff
Changed to correct 64bit format-strings.
authorDominik Bruhn <dominik@dbruhn.de>
Mon, 23 Apr 2012 13:33:50 +0000 (15:33 +0200)
committerDominik Bruhn <dominik@dbruhn.de>
Mon, 23 Apr 2012 13:34:57 +0000 (15:34 +0200)
Most of the format-strings for uint64_t were wrong. %llu is architecture
dependant whereas uint64_t is always 64bit long. The PRIu64 macro (from
inttypes.h) provides the correct formatstring.

ffsb_fs.c
ffsb_fs.h
ffsb_op.c
ffsb_tg.c
fh.c
fileops.c
util.c

index 94b80c17c5a6d25262f1f2d8effee3000fc0a439..89c2c2c6b0147844b37aa56edc20d54202f4e29c 100644 (file)
--- a/ffsb_fs.c
+++ b/ffsb_fs.c
@@ -214,7 +214,7 @@ static int verify_file(struct benchfiles *bf, char *fname, void *fs_ptr)
        filesize = ffsb_get_filesize(fname);
 
        if (filesize < minsize || filesize > maxsize) {
-               printf("size %llu bytes for file %s is invalid\n",
+               printf("size %"PRIu64" bytes for file %s is invalid\n",
                       filesize, fname);
                return 1;
        }
@@ -592,7 +592,7 @@ void fs_print_config(ffsb_fs_t *fs)
                int i;
                printf("\t Fileset weight:\n");
                for (i = 0; i < fs->num_weights; i++)
-                       printf("\t\t %12llu (%6s) -> %u (%.2f\%)\n",
+                       printf("\t\t %12"PRIu64" (%6s) -> %u (%.2f%%)\n",
                               fs->size_weights[i].size,
                               ffsb_printsize(buf, fs->size_weights[i].size, 256),
                               fs->size_weights[i].weight,
@@ -600,9 +600,9 @@ void fs_print_config(ffsb_fs_t *fs)
                                (float)fs->sum_weights) * 100);
        }
        else {
-               printf("\t min file size    = %llu\t(%s)\n", fs->minfilesize,
+               printf("\t min file size    = %"PRIu64"\t(%s)\n", fs->minfilesize,
                       ffsb_printsize(buf, fs->minfilesize, 256));
-               printf("\t max file size    = %llu\t(%s)\n", fs->maxfilesize,
+               printf("\t max file size    = %"PRIu64"\t(%s)\n", fs->maxfilesize,
                       ffsb_printsize(buf, fs->maxfilesize, 256));
        }
        printf("\t directio         = %s\n", (fs->flags & FFSB_FS_DIRECTIO) ?
@@ -613,18 +613,18 @@ void fs_print_config(ffsb_fs_t *fs)
               "on" : "off");
        printf("\t\n");
        printf("\t aging is %s\n", (fs->age_fs) ? "on" : "off");
-       printf("\t current utilization = %.2f\%\n", getfsutil(fs->basedir)*100);
+       printf("\t current utilization = %.2f%%\n", getfsutil(fs->basedir)*100);
        if (fs->age_fs) {
-               printf("\t desired utilization = %.2lf%\n", fs->desired_fsutil * 100);
+               printf("\t desired utilization = %.2lf%%\n", fs->desired_fsutil * 100);
                printf("\t \n");
                tg_print_config_aging(fs->aging_tg, fs->basedir);
        }
        printf("\t\n");
 }
 
-int fs_needs_stats(ffsb_fs_t *fs, syscall_t sys)
+intptr_t fs_needs_stats(ffsb_fs_t *fs, syscall_t sys)
 {
-       return (fs != NULL) ? (int)fs->fsd.config : 0;
+       return (fs != NULL) ? (intptr_t)(fs->fsd.config) : 0;
 }
 
 void fs_add_stat(ffsb_fs_t *fs, syscall_t sys, uint32_t val)
index 7b381043510b5c8dd652b7b40c872bd61b4ec88f..def300e68e8c60929dea6c13d6c6df2c5c4fe9fa 100644 (file)
--- a/ffsb_fs.h
+++ b/ffsb_fs.h
@@ -178,7 +178,7 @@ uint32_t fs_get_numdirs(ffsb_fs_t *fs);
 double fs_get_desired_fsutil(ffsb_fs_t *fs);
 
 /* For these two, fs == NULL is OK */
-int fs_needs_stats(ffsb_fs_t *fs, syscall_t s);
+intptr_t fs_needs_stats(ffsb_fs_t *fs, syscall_t s);
 void fs_add_stat(ffsb_fs_t *fs, syscall_t sys, uint32_t val);
 
 #endif /* _FFSB_FS_H_ */
index 0cae59959b01208a9485187dda7641eec0a4d283..588c934f5f5263272863fa9fd0c339d6c1517c78 100644 (file)
--- a/ffsb_op.c
+++ b/ffsb_op.c
@@ -109,7 +109,7 @@ void print_results(struct ffsb_op_results *results, double runtime)
                total_weight += results->op_weight[i];
        }
 
-       printf("             Op Name   Transactions\t Trans/sec\t% Trans\t    % Op Weight\t   Throughput\n");
+       printf("             Op Name   Transactions\t Trans/sec\t%% Trans\t    %% Op Weight\t   Throughput\n");
        printf("             =======   ============\t =========\t=======\t    ===========\t   ==========\n");
        for (i = 0; i < FFSB_NUMOPS ; i++)
                if (results->ops[i] != 0)
index 908e89c2daee3e93278e8bba5811a268f14d709e..f63a735de99a13d9f911cc7fede9325b9331a9f7 100644 (file)
--- a/ffsb_tg.c
+++ b/ffsb_tg.c
@@ -271,7 +271,7 @@ static void tg_print_config_helper(ffsb_tg_t *tg)
        printf("\t num_threads      = %d\n", tg->num_threads);
        printf("\t\n");
        printf("\t read_random      = %s\n", (tg->read_random) ? "on" : "off");
-       printf("\t read_size        = %llu\t(%s)\n", tg->read_size,
+       printf("\t read_size        = %"PRIu64"\t(%s)\n", tg->read_size,
               ffsb_printsize(buf, tg->read_size, 256));
        printf("\t read_blocksize   = %u\t(%s)\n", tg->read_blocksize,
               ffsb_printsize(buf, tg->read_blocksize, 256));
@@ -280,7 +280,7 @@ static void tg_print_config_helper(ffsb_tg_t *tg)
               ffsb_printsize(buf, tg->read_skipsize, 256));
        printf("\t\n");
        printf("\t write_random     = %s\n", (tg->write_random) ? "on" : "off");
-       printf("\t write_size       = %llu\t(%s)\n", tg->write_size,
+       printf("\t write_size       = %"PRIu64"\t(%s)\n", tg->write_size,
               ffsb_printsize(buf, tg->write_size, 256));
        printf("\t fsync_file       = %d\n", tg->fsync_file);
        printf("\t write_blocksize  = %u\t(%s)\n", tg->write_blocksize,
diff --git a/fh.c b/fh.c
index f99b45506b54efe5c29d0dba180b8ce59c92b79e..624bd0da91cd5012b4c0453a78dd8a760c233320 100644 (file)
--- a/fh.c
+++ b/fh.c
@@ -177,7 +177,7 @@ void fhwrite(int fd, void *buf, uint32_t size, ffsb_thread_t *ft, ffsb_fs_t *fs)
        }
 
        if (realsize != size) {
-               printf("Wrote %d instead of %d bytes.\n"
+               printf("Wrote %zd instead of %d bytes.\n"
                          "Probably out of disk space\n", realsize, size);
                perror("write");
                exit(1);
@@ -209,10 +209,10 @@ void fhseek(int fd, uint64_t offset, int whence, ffsb_thread_t *ft,
 
        if (res == -1) {
                if (whence == SEEK_SET)
-                       fprintf(stderr, "tried to seek to %lld\n", offset);
+                       fprintf(stderr, "tried to seek to %"PRIu64"\n", offset);
                else
                        fprintf(stderr, "tried to seek from current "
-                               "position to %lld\n", offset);
+                               "position to %"PRIu64"\n", offset);
 
                perror("seek");
                exit(1);
index 801fa42f7cca8a62e7b0099d303e732bf173306c..dd2911d5621cea7e785aaa5ef72dd45a6dc5edb9 100644 (file)
--- a/fileops.c
+++ b/fileops.c
@@ -135,14 +135,14 @@ void ffsb_readfile(ffsb_thread_t *ft, ffsb_fs_t *fs, unsigned opnum)
                                        (read_blocksize + read_skipsize);
 
                        if (minfilesize > filesize) {
-                                 printf("Error: read size %llu bytes too big "
+                                 printf("Error: read size %"PRIu64" bytes too big "
                                         "w/ skipsize %u and blocksize %u,"
-                                        " for file of size %llu bytes\n"
+                                        " for file of size %"PRIu64" bytes\n"
                                         " aborting\n\n", read_size,
                                         read_skipsize, read_blocksize,
                                         filesize);
                                  printf("minimum file size must be at least "
-                                        " %llu bytes\n", minfilesize);
+                                        " %"PRIu64" bytes\n", minfilesize);
                                         exit(1);
                        }
 
diff --git a/util.c b/util.c
index df5d755fea38867c3df6a82b58141aa01b24d014..664981480b9439418cddec825c2046758183b7da 100644 (file)
--- a/util.c
+++ b/util.c
@@ -330,7 +330,7 @@ void ffsb_bench_gettimeofday(void)
        total_usec = difftime.tv_sec * 1000000;
        total_usec += difftime.tv_usec;
        average = total_usec / 1000ull;
-       printf("average time for gettimeofday(): %llu nsec\n", average);
+       printf("average time for gettimeofday(): %"PRIu64" nsec\n", average);
 }
 
 void ffsb_bench_getpid(void)
@@ -347,5 +347,5 @@ void ffsb_bench_getpid(void)
        total_usec = difftime.tv_sec * 1000000;
        total_usec += difftime.tv_usec;
        average = total_usec / 1000ull;
-       printf("average time for getpid(): %llu nsec\n", average);
+       printf("average time for getpid(): %"PRIu64" nsec\n", average);
 }