Class: Vmstat::Disk

Inherits:
Struct
  • Object
show all
Defined in:
lib/vmstat/disk.rb

Overview

Gathered disk statistics snapshot.

Direct Known Subclasses

LinuxDisk

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#available_blocksFixnum

Available blocks in the file system.

Returns:

  • (Fixnum)

    the current value of available_blocks



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def available_blocks
  @available_blocks
end

#block_sizeFixnum

Size of file system blocks in bytes.

Returns:

  • (Fixnum)

    the current value of block_size



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def block_size
  @block_size
end

#free_blocksFixnum

Free blocks in the file system.

Returns:

  • (Fixnum)

    the current value of free_blocks



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def free_blocks
  @free_blocks
end

#mountString

The mount point of the device e.g. /mnt/store.

Returns:

  • (String)

    the current value of mount



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def mount
  @mount
end

#originString

The location of the device e.g. /dev/disk0.

Returns:

  • (String)

    the current value of origin



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def origin
  @origin
end

#total_blocksFixnum

Total number of blocks in the file system.

Returns:

  • (Fixnum)

    the current value of total_blocks



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def total_blocks
  @total_blocks
end

#typeSymbol

The file system name e. g. hfs.

Returns:

  • (Symbol)

    the current value of type



17
18
19
# File 'lib/vmstat/disk.rb', line 17

def type
  @type
end

Instance Method Details

#available_bytesFixnum

Calculates the number of available bytes for the file system.

Returns:

  • (Fixnum)

    number of available bytes



27
28
29
# File 'lib/vmstat/disk.rb', line 27

def available_bytes
  available_blocks * block_size
end

#free_bytesFixnum

Calculates the number of free bytes for the file system.

Returns:

  • (Fixnum)

    number of free bytes



21
22
23
# File 'lib/vmstat/disk.rb', line 21

def free_bytes
  free_blocks * block_size
end

#total_bytesFixnum

Calculates the number of total bytes for the file system. This is the max. number of bytes possible on the device.

Returns:

  • (Fixnum)

    number of total bytes



40
41
42
# File 'lib/vmstat/disk.rb', line 40

def total_bytes
  total_blocks * block_size
end

#used_bytesFixnum

Calculates the number of used bytes for the file system.

Returns:

  • (Fixnum)

    number of used bytes



33
34
35
# File 'lib/vmstat/disk.rb', line 33

def used_bytes
  (total_blocks - free_blocks) * block_size
end