From 67772facef4eeea61a7e4fe0945c53679c2c94dc Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 28 Nov 2018 15:01:00 -0800 Subject: [PATCH] ircd::fs::aio: Add specific read and write stat counters. --- include/ircd/fs/aio.h | 5 +++++ ircd/aio.cc | 5 ++++- modules/console.cc | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/ircd/fs/aio.h b/include/ircd/fs/aio.h index 70b7e52af..dcf78ba29 100644 --- a/include/ircd/fs/aio.h +++ b/include/ircd/fs/aio.h @@ -49,11 +49,16 @@ struct ircd::fs::aio::stats uint64_t events {0}; ///< count of events from io_getevents uint64_t cancel {0}; ///< count of requests canceled uint64_t errors {0}; ///< count of response errcodes + uint64_t reads {0}; ///< count of read complete + uint64_t writes {0}; ///< count of write complete uint64_t requests_bytes {0}; ///< total bytes for requests created uint64_t complete_bytes {0}; ///< total bytes for requests completed uint64_t errors_bytes {0}; ///< total bytes for completed w/ errc uint64_t cancel_bytes {0}; ///< total bytes for cancels + uint64_t read_bytes {0}; ///< total bytes for read completed + uint64_t write_bytes {0}; ///< total bytes for write completed + }; struct ircd::fs::aio::init diff --git a/ircd/aio.cc b/ircd/aio.cc index e22557d2d..8428c3c19 100644 --- a/ircd/aio.cc +++ b/ircd/aio.cc @@ -125,6 +125,8 @@ ircd::fs::aio::read(const fd &fd, const_cast(data(buf)), bytes }; + aio::stats.read_bytes += bytes; + aio::stats.reads++; return view; } @@ -175,7 +177,8 @@ ircd::fs::aio::write(const fd &fd, // Does linux ever not complete all bytes for an AIO? assert(size(view) == size(buf)); - + aio::stats.write_bytes += bytes; + aio::stats.writes++; return view; } diff --git a/modules/console.cc b/modules/console.cc index 291d31efa..847734fa6 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -755,9 +755,19 @@ console_cmd__aio(opt &out, const string_view &line) << " " << pretty(iec(s.requests_bytes)) << std::endl; - out << std::setw(12) << std::left << "success" - << std::setw(9) << std::right << (s.complete - s.errors) - << " " << pretty(iec(s.complete_bytes - s.errors_bytes)) + out << std::setw(12) << std::left << "requests avg" + << std::setw(9) << std::right << " " + << " " << pretty(iec(s.requests_bytes / s.requests)) + << std::endl; + + out << std::setw(12) << std::left << "reads" + << std::setw(9) << std::right << s.reads + << " " << pretty(iec(s.read_bytes)) + << std::endl; + + out << std::setw(12) << std::left << "writes" + << std::setw(9) << std::right << s.writes + << " " << pretty(iec(s.write_bytes)) << std::endl; out << std::setw(12) << std::left << "errors"