I just committed a mail statistics gathering patch to v1.2:
http://hg.dovecot.org/dovecot-1.2/rev/fdaf0bda70d5
It keeps track of:
struct mail_private { .. /* open(), stat(), .. */ unsigned long stats_dentry_lookup_count; /* fstat() mostly */ unsigned long stats_attr_lookup_count; /* number of files we've opened and read */ unsigned long stats_files_read_count; /* number of bytes we've had to read from files */ unsigned long long stats_files_read_bytes; /* number of cache lookup hits */ unsigned long stats_cache_hit_count;
So it's possible to write a plugin that does whatever with those values. You can get them per-command or even per-single-mail-access.
Any thoughts on if those are good variables? Like would it be useful to split dentry lookups to opens and stats?