Skip to content

Commit

Permalink
Added total disk IO metric
Browse files Browse the repository at this point in the history
  • Loading branch information
nettag committed Aug 4, 2013
1 parent b13b8dc commit 0d91f7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bindings/SigarWrapper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,11 @@ use vars qw(%classes %cmds);
name => 'bytes_written', type => 'Long',
desc => 'Bytes Written',
plat => 'LW'
},
{
name => 'bytes_total', type => 'Long',
desc => 'Bytes Total',
plat => 'LW'
}
],
ProcState => [
Expand Down
3 changes: 2 additions & 1 deletion include/sigar.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ SIGAR_DECLARE(int) sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
typedef struct {
sigar_uint64_t
bytes_read,
bytes_written;
bytes_written,
bytes_total;
} sigar_proc_disk_io_t;

SIGAR_DECLARE(int) sigar_proc_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
Expand Down
1 change: 1 addition & 0 deletions src/os/linux/linux_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ int sigar_proc_disk_io_get(sigar_t *sigar, sigar_pid_t pid,

proc_disk_io->bytes_read = get_named_proc_token(buffer, "\nread_bytes");
proc_disk_io->bytes_written = get_named_proc_token(buffer, "\nwrite_bytes");
proc_disk_io->bytes_total = proc_disk_io->bytes_read + proc_disk_io->bytes_written;

return SIGAR_OK;
}
Expand Down
5 changes: 3 additions & 2 deletions src/os/win32/win32_sigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,9 @@ SIGAR_DECLARE(int) sigar_proc_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
return status;
}

proc_disk_io->bytes_read = pinfo->bytes_read;
proc_disk_io->bytes_written = pinfo->bytes_written;
proc_disk_io->bytes_read = pinfo->bytes_read;
proc_disk_io->bytes_written = pinfo->bytes_written;
proc_disk_io->bytes_total = proc_disk_io->bytes_read + proc_disk_io->bytes_written;

return SIGAR_OK;
}
Expand Down

0 comments on commit 0d91f7d

Please sign in to comment.