From: Timo Sirainen Date: Tue, 14 Jun 2016 19:32:36 +0000 (+0300) Subject: lib-fs: Added write_bytes to statistics X-Git-Tag: 2.2.25.rc1~141 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c36510421861bda8fbdfb49d0dcd55f89bee0cb7;p=thirdparty%2Fdovecot%2Fcore.git lib-fs: Added write_bytes to statistics --- diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c index dc892d2014..7bd981eb3b 100644 --- a/src/lib-fs/fs-api.c +++ b/src/lib-fs/fs-api.c @@ -608,6 +608,7 @@ int fs_write(struct fs_file *file, const void *data, size_t size) } T_END; if (!(ret < 0 && errno == EAGAIN)) { file->fs->stats.write_count++; + file->fs->stats.write_bytes += size; fs_file_timing_end(file, FS_OP_WRITE); } return ret; @@ -674,6 +675,7 @@ int fs_write_stream_finish(struct fs_file *file, struct ostream **output) o_stream_get_error(file->output)); success = FALSE; } + file->fs->stats.write_bytes += file->output->offset; } return fs_write_stream_finish_int(file, success); } diff --git a/src/lib-fs/fs-api.h b/src/lib-fs/fs-api.h index 2f8da389cc..21979d4b14 100644 --- a/src/lib-fs/fs-api.h +++ b/src/lib-fs/fs-api.h @@ -175,6 +175,9 @@ struct fs_stats { /* Number of fs_iter_init() calls. */ unsigned int iter_count; + /* Number of bytes written by fs_write*() calls. */ + uint64_t write_bytes; + /* Cumulative sum of usecs spent on calls - set only if fs_settings.enable_timing=TRUE */ struct timing *timings[FS_OP_COUNT];