Skip to content

Commit

Permalink
iops
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Nov 7, 2024
1 parent 2aaf0c6 commit 7787edc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
32 changes: 18 additions & 14 deletions gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,30 @@ struct data_descriptor {
};

struct io_stats_t {
uint64_t n_reads { 0 };
uint64_t bytes_read { 0 };
uint64_t n_writes { 0 };
uint64_t bytes_written { 0 };
uint64_t n_syncs { 0 };
uint64_t n_trims { 0 };
uint64_t n_reads { 0 };
uint64_t bytes_read { 0 };
uint64_t n_writes { 0 };
uint64_t bytes_written { 0 };
uint64_t n_syncs { 0 };
uint64_t blocks_trimmed { 0 };
// 1.3.6.1.4.1.2021.11.54: "The number of 'ticks' (typically 1/100s) spent waiting for IO."
// https://www.circitor.fr/Mibs/Html/U/UCD-SNMP-MIB.php#ssCpuRawWait
uint64_t io_wait { 0 };
uint64_t io_wait { 0 };

io_stats_t() {
}

uint64_t get_n_iops() const {
return n_reads + n_writes;
}

void reset() {
n_reads = 0;
bytes_read = 0;
n_writes = 0;
bytes_written = 0;
n_syncs = 0;
n_trims = 0;
io_wait = 0;
n_reads = 0;
bytes_read = 0;
n_writes = 0;
bytes_written = 0;
n_syncs = 0;
blocks_trimmed = 0;
io_wait = 0;
}
};
2 changes: 1 addition & 1 deletion scsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ scsi::scsi_rw_result scsi::write(io_stats_t *const is, const uint64_t block_nr,
scsi::scsi_rw_result scsi::trim(io_stats_t *const is, const uint64_t block_nr, const uint32_t n_blocks)
{
if (locking_status() != l_locked_other) { // locked by myself or not locked?
is->n_trims += n_blocks;
is->blocks_trimmed += n_blocks;

auto start = get_micros();
if (trim_level == 0) { // 0 = do not trim/unmap
Expand Down
8 changes: 4 additions & 4 deletions server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,15 @@ void server::handler()
const io_stats_t *const is = ses->get_io_stats();

DOLOG(logging::ll_info, "server::handler", endpoint,
"PDU/s: %.2f, "
"PDU/s: %.2f, IOPS: %.2f "
"send: %.2f kB/s, recv: %.2f kB/s, "
"written: %.2f kB/s, read: %.2f kB/s, "
"syncs: %.2f/s, unmaps: %.2f kB/s, "
"syncs: %.2f/s, unmapped: %.2f kB/s, "
"load: %.2f%%, errors: %u, mem: %u",
ses->get_pdu_count() / dtook,
ses->get_pdu_count() / dtook, is->get_n_iops() / dtook,
ses->get_bytes_tx() / dkB, ses->get_bytes_rx() / dkB,
is->bytes_written / dkB, is->bytes_read / dkB,
is->n_syncs / dtook, is->n_trims * block_size / 1024 / 1024 / dtook,
is->n_syncs / dtook, is->blocks_trimmed * block_size / 1024 / 1024 / dtook,
busy * 0.1 / took, ses->get_error_count(), get_free_heap_space());

ses->reset_pdu_count();
Expand Down

0 comments on commit 7787edc

Please sign in to comment.