Skip to content

Instantly share code, notes, and snippets.

@chapmanjacobd
Created June 16, 2023 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapmanjacobd/9c0be8a41aed854f9d7faa2def15c7f1 to your computer and use it in GitHub Desktop.
Save chapmanjacobd/9c0be8a41aed854f9d7faa2def15c7f1 to your computer and use it in GitHub Desktop.
def calculate_sparseness(stat) -> int:
if stat.st_size == 0:
sparseness = 0
else:
blocks_allocated = stat.st_blocks * 512
sparseness = blocks_allocated / stat.st_size
return sparseness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment