summaryrefslogtreecommitdiff
path: root/examples/c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/c')
-rw-r--r--examples/c/ex_stat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/c/ex_stat.c b/examples/c/ex_stat.c
index 0614a1de234..86114bb711f 100644
--- a/examples/c/ex_stat.c
+++ b/examples/c/ex_stat.c
@@ -149,12 +149,14 @@ print_derived_stats(WT_SESSION *session)
{
/*! [statistics calculate table fragmentation] */
- uint64_t ckpt_size, file_size;
+ uint64_t ckpt_size, file_size, percent;
ret = get_stat(cursor, WT_STAT_DSRC_BLOCK_CHECKPOINT_SIZE, &ckpt_size);
ret = get_stat(cursor, WT_STAT_DSRC_BLOCK_SIZE, &file_size);
- printf("File is %d%% fragmented\n",
- (int)(100 * (file_size - ckpt_size) / file_size));
+ percent = 0;
+ if (file_size != 0)
+ percent = 100 * ((file_size - ckpt_size) / file_size);
+ printf("Table is %" PRIu64 "%% fragmented\n", percent);
/*! [statistics calculate table fragmentation] */
}