Skip to content

Commit

Permalink
Log disk space available and consumed by SPMI download (#91683)
Browse files Browse the repository at this point in the history
Example output in the DEBUG log:
```
[10:39:04] Disk usage (c:\spmi): total 2,047 GB; free 1,411 GB
[10:42:45] Disk usage (c:\spmi): total 2,047 GB; free 1,378 GB; consumed by download 33 GB
```
  • Loading branch information
BruceForstall authored Sep 6, 2023
1 parent 30b443b commit 9c4b135
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/coreclr/scripts/superpmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3198,8 +3198,22 @@ def process_mch_files_arg(coreclr_args):
logging.info("Found download cache directory \"%s\" and --force_download not set; skipping download", mch_cache_dir)
return [ mch_cache_dir ]

# MCH files can be large. Log the disk space before and after the download.
if os.path.isdir(coreclr_args.spmi_location):
before_total, _, before_free = shutil.disk_usage(coreclr_args.spmi_location)
before_total_gb = int(before_total / 1024 / 1024 / 1024)
before_free_gb = int(before_free / 1024 / 1024 / 1024)
logging.debug("Disk usage (%s): total %s GB; free %s GB", coreclr_args.spmi_location, format(before_total_gb, ','), format(before_free_gb, ','))

local_mch_paths = download_mch_from_azure(coreclr_args, mch_cache_dir)

if os.path.isdir(coreclr_args.spmi_location): # This should always be true here; just being defensive.
after_total, _, after_free = shutil.disk_usage(coreclr_args.spmi_location)
after_total_gb = int(after_total / 1024 / 1024 / 1024)
after_free_gb = int(after_free / 1024 / 1024 / 1024)
consumed_gb = before_free_gb - after_free_gb
logging.debug("Disk usage (%s): total %s GB; free %s GB; consumed by download %s GB", coreclr_args.spmi_location, format(after_total_gb, ','), format(after_free_gb, ','), format(consumed_gb, ','))

# Add the private store files
if coreclr_args.private_store is not None:
# Only include the directories corresponding to the current JIT/EE version, target OS, and MCH architecture (this is the
Expand Down

0 comments on commit 9c4b135

Please sign in to comment.