Created
April 9, 2015 20:16
-
-
Save willvincent/55bf1e7baeecec564a89 to your computer and use it in GitHub Desktop.
Spits out approximate memory usage of an app (passed as an argument) -- mac os 10.9+ (maybe earlier)
This file contains 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
<?php | |
$app = $argv[1]; | |
print exec('hostinfo | grep memory | perl -ne \'$used = `ps aux | grep ' . | |
$app . ' | awk \'"\'"\'{x+=\$4} END{print x/100}\'"\'"\'` and /Primary memory available: (\d+)/ and printf("' . | |
$app . ' is using approximately ") and printf($1*$used) and print ("GB\n");\''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment