This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function will periodically print cpu information about the given process name | |
# Place it in your .zshrc or equivalent file or modify it to run via #!/bin/zsh | |
# | |
# Usage: monitor_cpu mediaanalysisd 28800 5 > ~/Desktop/cpu_log.txt | |
# Monitors processes containing "mediaanalysisd" for 12 hours reporting every 5 seconds | |
# | |
# Run this to output statistics: | |
# cat ~/Desktop/cpu_log.txt | grep "mediaanalysisd " | grep -v "0.0" | awk '{sum += $NF; count++} END {if (count > 0) {print sum / count; print count;} else print "No data"}' | |
function monitor_cpu() { |