detkit.Disk.read#

Disk.read()#

Inquiry the amount of read from disk.

Returns:
read_sizeint

The amount of read from disk divided by the specified unit size.

See also

write

Notes

The read amount is measured from the point where detkit.Disk.set() is called to the current. The reported read amount is divided by the give unit (see argument to detkit.Disk).

Note

To properly measure the read from disk, the memory cache should be dropped before calling this function. To do so, execute the following in terminal:

echo 3 | sudo tee /proc/sys/vm/drop_caches

Examples

>>> from detkit import Disk, memdet

>>> # Initialize with MB unit
>>> disk = Disk(unit='MB')

>>> # Set (or reset) the starting point of disk inquiry
>>> disk.set()

>>> # Perform an operation that reads from and writes to disk
>>> import numpy
>>> A = numpy.random.randn(1000, 1000)
>>> ld = memdet(A, num_blocks=4)

>>> # Inquiry read from disk during the above operation, in MB unit
>>> print(disk.read())
5.72