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

Added the watchers total count #3

Merged
merged 1 commit into from Aug 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion utils/scripts/inotify-consumers
Expand Up @@ -66,9 +66,13 @@ printf "%10s %5s %s\n" " COUNT " "PID" "CMD"
printf -- "----------------------------------------\n"

IFS=''; # to avoid `read` from interpreting whitespace and keep whole lines
generateRawData | while read line; do
total_watchers=0
generateRawData | { while read line; do
watcher_count=$(echo $line | sed -e 's/.*://')
total_watchers=$((total_watchers+watcher_count))
pid=$(echo $line | sed -e 's/\/proc\/\([0-9]*\)\/.*/\1/')
cmdline=$(ps --columns 120 -o command --no-headers -p $pid)
printf "%8d %7d %s\n" "$watcher_count" "$pid" "$cmdline"
done
printf "\n%8d %s\n" "$total_watchers" "WATCHERS TOTAL COUNT"
}