]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Added write_bytes to statistics
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 14 Jun 2016 19:32:36 +0000 (22:32 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 14 Jun 2016 19:32:36 +0000 (22:32 +0300)
src/lib-fs/fs-api.c
src/lib-fs/fs-api.h

index 2fd4deca69c63e78e0d35ca982bccbc857286050..501318f51a93e177c486be5f0737dc13e295a46a 100644 (file)
@@ -622,6 +622,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;
@@ -688,6 +689,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);
 }
index ddd5b92d6fe9bf4c355a3f2445b342a690e75718..1e42504d5ca667194e21fdeac4751a2438f932ee 100644 (file)
@@ -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];