Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions btrfs-snapshots-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ def main():
parser.add_argument(
'-j', '--json', action='store_true', help='JSON output (commands only)'
)
parser.add_argument(
'--stats', action='store_true', help='Print simple statistics'
)
parser.add_argument(
'--pretty', action='store_true', help=argparse.SUPPRESS
)
Expand Down Expand Up @@ -619,6 +622,16 @@ def main():
exit(1)
commands, paths = stream.decode(bogus=args.bogus)

if args.stats:
from collections import Counter

print('Commands:')
command_counts = Counter(d["command"] for d in commands)
for key, count in command_counts.most_common():
print(f'{count}\t{key}')

exit(0)

if args.by_path:
print(f'Found a valid Btrfs stream header, version {stream.version}\n')
print_by_paths(paths, commands, args.filter, args.csv)
Expand Down