Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show bytes in human readable format #3819

Merged
merged 11 commits into from
Dec 14, 2023
Merged

Conversation

lemmih
Copy link
Contributor

@lemmih lemmih commented Dec 13, 2023

Summary of changes

Changes introduced in this pull request:

  • Show bytes in human-readable format.
  • Include total size when available.

Before:

$ cargo run --bin forest-tool -- snapshot fetch --chain calibnet
2023-12-13T11:14:17.386015Z  INFO forest::snapshot: downloading snapshot url=https://forest-archive.chainsafe.dev/latest/calibnet/
2023-12-13T11:14:23.333352Z  INFO forest::progress: Loading 122474496 (elapsed time: 5s)
2023-12-13T11:14:28.351351Z  INFO forest::progress: Loading 246546432 (elapsed time: 10s)
2023-12-13T11:14:33.371548Z  INFO forest::progress: Loading 369876992 (elapsed time: 15s)
2023-12-13T11:14:38.371557Z  INFO forest::progress: Loading 495095808 (elapsed time: 20s)

After:

$ cargo run --bin forest-tool -- snapshot fetch --chain calibnet
2023-12-13T11:11:45.398062Z  INFO forest::snapshot: downloading snapshot url=https://forest-archive.chainsafe.dev/latest/calibnet/
2023-12-13T11:11:52.218596Z  INFO forest::progress: Loading 115.6 MiB / 2.7 GiB, 4%, 115.6 MiB/s, elapsed time: 5s
2023-12-13T11:11:57.218769Z  INFO forest::progress: Loading 232.5 MiB / 2.7 GiB, 8%, 117 MiB/s, elapsed time: 10s
2023-12-13T11:12:02.230479Z  INFO forest::progress: Loading 343.6 MiB / 2.7 GiB, 12%, 111.1 MiB/s, elapsed time: 15s
2023-12-13T11:12:07.230596Z  INFO forest::progress: Loading 459.4 MiB / 2.7 GiB, 16%, 115.8 MiB/s, elapsed time: 20s

Before:

2023-12-13T11:20:53.492928Z  INFO forest_filecoin::chain_sync::chain_muxer: Local node is behind the network, starting BOOTSTRAP from LOCAL_HEAD = 1128407 -> NETWORK_HEAD = 1171335
2023-12-13T11:20:58.695216Z  INFO forest::progress: Downloading headers 613 (elapsed time: 5s)
2023-12-13T11:21:03.781629Z  INFO forest::progress: Downloading headers 1228 (elapsed time: 10s)
2023-12-13T11:21:09.223284Z  INFO forest::progress: Downloading headers 1843 (elapsed time: 15s)
2023-12-13T11:21:14.946055Z  INFO forest::progress: Downloading headers 2356 (elapsed time: 21s)

After:

023-12-13T11:19:46.107371Z  INFO forest_filecoin::chain_sync::chain_muxer: Local node is behind the network, starting BOOTSTRAP from LOCAL_HEAD = 1128407 -> NETWORK_HEAD = 1171333
2023-12-13T11:19:51.242939Z  INFO forest::progress: Downloading headers 714, 714 items/s, elapsed time: 5s
2023-12-13T11:19:56.833518Z  INFO forest::progress: Downloading headers 1433, 719 items/s, elapsed time: 10s
2023-12-13T11:20:02.541617Z  INFO forest::progress: Downloading headers 2149, 716 items/s, elapsed time: 16s
2023-12-13T11:20:08.072752Z  INFO forest::progress: Downloading headers 2657, 508 items/s, elapsed time: 21s

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@lemmih lemmih marked this pull request as ready for review December 13, 2023 13:36
@lemmih lemmih requested a review from a team as a code owner December 13, 2023 13:36
@lemmih lemmih requested review from LesnyRumcajs and sudo-shashank and removed request for a team December 13, 2023 13:36
Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rock solid, with tests and all

src/utils/io/progress_log.rs Outdated Show resolved Hide resolved
src/utils/io/progress_log.rs Outdated Show resolved Hide resolved
src/utils/io/progress_log.rs Outdated Show resolved Hide resolved
lemmih and others added 3 commits December 13, 2023 15:59
Co-authored-by: Hubert <hubert@chainsafe.io>
Co-authored-by: Hubert <hubert@chainsafe.io>
src/utils/io/progress_log.rs Outdated Show resolved Hide resolved
@lemmih lemmih added this pull request to the merge queue Dec 14, 2023
@lemmih lemmih removed this pull request from the merge queue due to a manual request Dec 14, 2023
@lemmih lemmih added this pull request to the merge queue Dec 14, 2023
Merged via the queue into main with commit eccc15f Dec 14, 2023
26 checks passed
@lemmih lemmih deleted the lemmih/humanize-progress-output branch December 14, 2023 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants