Skip to content

jpcerezo/macoh

 
 

Repository files navigation

MacOH

Small tool for Mac OS X runs CPU and GPU stress tests, monitoring CPU frequency, temperature and power draw which are plotted versus time. The purpose is to evaluate CPU throttling and/or overheating (not performance).

Output examples: x264 (no throttling), Prime95 (heavy throttling), 3D-Intel 5100 (throttling), 3D-Nvidia 750M (no throttling).

  • Can do FFTs, x264 encodes, Prime95, GpuTest or a custom command/script of your choice
  • Monitors and logs CPU temperature and frequency during the test
  • Plots a graph of CPU temperature and frequency vs. time
  • Grabs free and open source tools as needed: Intel Power Gadget (measuring and logging), HandBrake CLI (x264 transcoding), Prime95 (CPU stress), GpuTest (GPU stress), gfxCardStatus (GPU switching), Ggraphics Layout Engine (graph plotting), ImageMagick (better image processing than sips)
  • Grabs the free movie Big Buck Bunny in 1080p (692 MB) as needed

I recommend the FFT test with as many threads as physical cores (this is the default). This is more stressful than most common operations one typically does, but less stressful than the x264 test or Prime95 test. If the FFT test with half the threads is throttling then you have a real problem (2 threads for a quad core CPU). Expect Prime95 to cause heavy throttling on laptops. The x264 test is in between but (on my rMBP at least) it still causes higher power draw than the TDP limit which can trigger throttling. The 3D GpuTest, when run on integrated GPU, can also cause CPU throttling.

Feedback

The dedicated thread on MacRumors forums started containing results and discussions. Your contribution there would be very welcome. If it doesn't work for you, or if you find bugs, have suggestions, questions or comments then drop a line on Github or just contact me.

Disclaimer: As per the usual nitty gritty, I cannot be held responsible if your spouse leaves you after running this tool, or worse: if your Mac gets damaged. Most likely you'll be just fine though.

Usage

  1. Donwload the latest .zip release and extract it somewhere
  2. Open Terminal and do bash macoh.sh
  3. Choose a command in the (old school) menu

Config file

There is a macoh.conf configuration file which you can edit it to set various options (defaults). It is sourced by Bash in the main script so make sure you use valid Bash syntax.

Command line alternative

bash macoh.sh [-OPTION VALUE [-OPTION VALUE ...]]

Where -OPTION VALUE can be:

  • -do - launch a test, one of: x264, x264-long, gputest, prime95
  • -get - fetch one of: ipg, gle, gfx, imagick, video, handbrake, gputest, prime95. These are downloaded as necessary upon launching of a test but can be invoked separately. The script will prompt if it detects already downloaded/installed items. Downloads are placed in $HOME/macoh/tmp and installations in $HOME/macoh/bin.
  • -cmd - A user defined command to execute and monitor. This must be the last option in the command line, everything after it is considered part of the user command. You can use this to launch your own stress test to be monitored and have the temp and freq vs time plotted. The command must not terminate immediately (e.g. do not use ''open MyBenchmark.app''). Also take note of the duration value (-t) below. The -cmd option needs more thorough testing, please report bugs.
  • -t,-time - duration of Prime95, GpuTest and user defined command in seconds, use 0 to run indefinitely (default is 600 for GpuTest and 300 for the rest, see macoh.conf). Prime95 and the user defined command are assumed to run indefintely by default, so this option is used to stop them, unless they exit or if you abort them early.
  • -w,-wait - waiting time before the test, to get idle temperature (default is 15 seconds, see macoh.conf)
  • -g,-gputest - change the GpuTest type to one of: fur, tess_x8, tess_x16, tess_x32, tess_x64, gi,pixmark_piano, pixmark_volplosion, plot3d, triangle (default is tess_x64, see macoh.conf)
  • -r,-res - change the resolution of GpuTest (default is 1280x720, unless altered in macoh.conf)
  • -m,-msaa - change the MSAA level of GpuTest to 0 (disabled), 2, 4, or 8 (default is 2, see macoh.conf).
  • -s,-gpuswitch - force the GPU to either of: integrated, discrete or dynamic. You can also use 1, 2 or 3 as synonyms. This setting only affects laptops with dual GPU (e.g. Intel Iris Pro and Nvidia). Note that this persists even after the script exits. The default setting is dynamic (unless you altrered it priorly) which means that the discrete GPU is in 3D. If you do not specify -do or -cmd then the script will exit after swicthing GPU (useful for scripting).

Command line examples

macoh.sh -do x264 -wait 30 will launch the x264 transcode test with 30 seconds wait time beforehand and afterwards, downloading and installing the tools and the video as needed (skipping those already done), and generating $HOME/macoh/${DATE}-x264.png, $HOME/macoh/logs/${DATE}-ipg.csv and $HOME/macoh/logs/${DATE}-hb.log.

macoh.sh -do gputest -wait 10 -res 1600x900 -msaa 0 -gputest tess_x64 will launch the TessMark test from GpuTest in a 1600x900 window with MSAA disabled and a wait time beforehand and afterwards of 10 seconds.

macoh.sh -time 180 -cmd /Applications/Heaven.app/Contents/MacOS/heaven will launch the Unigine Heaven 3D benchmark (installed separately) and will kill it after 180 seconds unless you quit it by then. You must start the Heaven benchmark manually once its app GUI opens since the script has no control over it.

Uninstall, Folders, etc.

To unistall, do: (1) /Applications > Intel Power Gadget > Uninstaller and (2) rm -rf ~/macoh/*/*. The latter wipes everything except generated graphs and downloaded video (note the /*/*).

The script writes only to your home dir in $HOME/macoh. The only exception is Intel Power Gadget which is installed in /Applications.

You can make it executable with chmod u+x macoh.sh and then do ./macoh.sh.

Known issues

gfxCardStatus has a bug, it needs somes convincing to switch the GPU. The macoh script makes two attempts and normally gets it. Just in case it doesn't, you may need to insist or open the app normally (via Finder/Spotlight) and switch the GPU there.

Todo

  • Fan speed monitoring +graph (any free tool?) #2
  • GPU freq and temp monitoring +graph (any free tool?) #6
  • Add GPU testing
  • Add Prime95
  • Stats, Tjunction and TDP detection, etc #3
  • GpuTest results
  • Uninstall/clean option #4
  • Auto-upload results and graph somewhere (with prompt)?
  • Cross-platform version?

Credits

A local version of Intel Power Gadget is stored in the project for consistency. All copyright is of Intel. Binary versions of the open source applications ImageMagick, gfxCardStatus and Prime95 are also stored in the project. Using the FFTW library for the FFT computations. The sources of gfxCardStatus and Prime95 were modified and compiled to fit the current project.

About

Automated stress tests for measuring throttle and temperature on Macs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 65.0%
  • C 28.9%
  • C++ 6.1%