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

add subcommand summary #3381

Merged
merged 33 commits into from
Apr 3, 2023
Merged

add subcommand summary #3381

merged 33 commits into from
Apr 3, 2023

Conversation

Hexilee
Copy link
Contributor

@Hexilee Hexilee commented Mar 24, 2023

Print statistics of directories in the tree structure.

> ./juicefs summary -h
NAME:
   juicefs summary - Show tree summary of a directory

USAGE:
   juicefs summary [command options] PATH/INODE

CATEGORY:
   INSPECTOR

DESCRIPTION:
   It is used to show tree summary of target directory.
    
    Examples:
    # Show with path
    $ juicefs summary /mnt/jfs/foo
    
    # Show max depth of 5
    $ juicefs summary --depth 5 /mnt/jfs/foo
   
    # Show top 20 entries
    $ juicefs summary --entries 20 /mnt/jfs/foo
   
    # Show accurate result
    $ juicefs summary --strict /mnt/jfs/foo

OPTIONS:
   --depth value, -d value    depth of tree to show (zero means only show root) (default: 2)
   --entries value, -e value  show top N entries (sort by size) (default: 10)
   --strict                   show accurate summary, including directories and files (may be slow) (default: false)
   --help, -h                 show help (default: false)

Example

> ./juicefs summary ~/mnt/jfs/
/home/hexi/mnt/jfs/: 490959                       135972.5/s   
/home/hexi/mnt/jfs/: 5.9 GiB (6347730944 Bytes)   1.6 GiB/s    
+--------------------+---------+-------+--------+
|        PATH        |   SIZE  |  DIRS |  FILES |
+--------------------+---------+-------+--------+
| .                  | 5.9 GiB | 47203 | 490959 |
| lani               | 2.8 GiB | 23570 | 236454 |
| lani/common        | 2.8 GiB | 23354 | 235378 |
| lani/apps          | 5.5 MiB |   123 |    840 |
| lani/.git          | 3.3 MiB |    16 |     26 |
| lani/docs          | 880 KiB |    17 |     48 |
| lani/tools         | 500 KiB |    23 |     79 |
| lani/libs          | 464 KiB |    27 |     65 |
| lani/.github       |  24 KiB |     1 |      4 |
| lani/rush.json     |  24 KiB |     0 |      1 |
| lani/node_modules  | 8.0 KiB |     0 |      2 |
| lani/.vscode       | 8.0 KiB |     0 |      2 |
| lani/...           |  36 KiB |     0 |      9 |
| lani1              | 2.8 GiB | 23570 | 236454 |
| lani1/common       | 2.8 GiB | 23354 | 235378 |
| lani1/apps         | 5.5 MiB |   123 |    840 |
| lani1/.git         | 3.3 MiB |    16 |     26 |
| lani1/docs         | 880 KiB |    17 |     48 |
| lani1/tools        | 500 KiB |    23 |     79 |
| lani1/libs         | 464 KiB |    27 |     65 |
| lani1/.github      |  24 KiB |     1 |      4 |
| lani1/rush.json    |  24 KiB |     0 |      1 |
| lani1/.vscode      | 8.0 KiB |     0 |      2 |
| lani1/node_modules | 8.0 KiB |     0 |      2 |
| lani1/...          |  36 KiB |     0 |      9 |
| test               | 332 MiB |     0 |  17912 |
| test/file14698.bin |  36 KiB |     0 |      1 |
| test/file6303.bin  |  36 KiB |     0 |      1 |
| test/file14862.bin |  36 KiB |     0 |      1 |
| test/file17670.bin |  36 KiB |     0 |      1 |
| test/file050.bin   |  36 KiB |     0 |      1 |
| test/file099.bin   |  36 KiB |     0 |      1 |
| test/file1943.bin  |  36 KiB |     0 |      1 |
| test/file12992.bin |  36 KiB |     0 |      1 |
| test/file4031.bin  |  36 KiB |     0 |      1 |
| test/file4792.bin  |  36 KiB |     0 |      1 |
| test/...           | 332 MiB |     0 |  17902 |
| roa                | 2.2 MiB |    58 |    139 |
| roa/.git           | 1.4 MiB |    16 |     26 |
| roa/roa            | 248 KiB |     8 |     30 |
| roa/integration    | 144 KiB |    12 |     22 |
| roa/roa-core       | 120 KiB |     3 |     17 |
| roa/roa-async-std  |  32 KiB |     1 |      6 |
| roa/.github        |  28 KiB |     1 |      6 |
| roa/roa-diesel     |  28 KiB |     1 |      5 |
| roa/examples       |  28 KiB |     0 |      7 |
| roa/assets         |  24 KiB |     1 |      5 |
| roa/.vscode        |  20 KiB |     0 |      1 |
| roa/...            |  68 KiB |     1 |     14 |
+--------------------+---------+-------+--------+

@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2023

Codecov Report

Patch coverage: 21.51% and project coverage change: +0.18 🎉

Comparison is base (471d836) 56.17% compared to head (4c395df) 56.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3381      +/-   ##
==========================================
+ Coverage   56.17%   56.35%   +0.18%     
==========================================
  Files         147      148       +1     
  Lines       35842    36143     +301     
==========================================
+ Hits        20135    20370     +235     
- Misses      13521    13565      +44     
- Partials     2186     2208      +22     
Impacted Files Coverage Δ
cmd/clone.go 26.27% <0.00%> (ø)
pkg/meta/interface.go 55.00% <ø> (ø)
pkg/meta/utils.go 51.27% <0.00%> (-17.25%) ⬇️
pkg/vfs/internal.go 49.59% <0.00%> (-1.45%) ⬇️
pkg/sync/sync.go 43.44% <7.14%> (-0.63%) ⬇️
cmd/warmup.go 56.81% <30.00%> (+21.90%) ⬆️
cmd/summary.go 30.46% <30.46%> (ø)
cmd/format.go 57.61% <83.33%> (+0.47%) ⬆️
cmd/info.go 31.25% <100.00%> (+16.40%) ⬆️
cmd/main.go 47.36% <100.00%> (+1.55%) ⬆️
... and 6 more

... and 9 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Hexilee Hexilee marked this pull request as ready for review March 27, 2023 03:15
@Hexilee Hexilee requested review from davies and SandyXSD March 27, 2023 03:15
@Hexilee Hexilee requested a review from zhijian-pro March 27, 2023 07:41
cmd/summary.go Outdated Show resolved Hide resolved
cmd/summary.go Outdated Show resolved Hide resolved
pkg/vfs/internal.go Outdated Show resolved Hide resolved
cmd/summary.go Outdated Show resolved Hide resolved
Signed-off-by: xixi <[email protected]>
pkg/vfs/internal.go Outdated Show resolved Hide resolved
pkg/meta/utils.go Outdated Show resolved Hide resolved
pkg/meta/utils.go Outdated Show resolved Hide resolved
pkg/meta/utils.go Outdated Show resolved Hide resolved
cmd/summary.go Outdated Show resolved Hide resolved
cmd/summary.go Outdated Show resolved Hide resolved
@Hexilee Hexilee requested a review from davies April 3, 2023 05:25
@davies davies merged commit 6b7a267 into main Apr 3, 2023
@davies davies deleted the summary-subcommand branch April 3, 2023 06:19
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.

3 participants