Monitor Usage Regularly
Throughout the development process, verify that your app is running efficiently by regularly monitoring, testing, and retesting its performance. A variety of tools and utilities can help you analyze your app's energy impact.
Activity Monitor
Jul 07, 2018 Question: Q: Webpage using significant energy / memory on Mac. Hello, I'm continuing to get this alert at the top of Safari. This webpage is using significant energy. Closing it may improve the responsiveness of your Mac. This began fairly recently. I have no Safari extensions, I have no apps that didn't come from the App Store.
Activity Monitor is installed in the
/Applications/Utilities
folder on every Mac. It provides a running list of active processes, along with various metrics.Assess Energy Usage
You can quickly check to see which apps are using a significant amount of energy by left clicking on the battery icon in the upper right corner of your laptop's tool bar. From the dropdown list, wait a few seconds until your Mac finishes collecting power usage information. Any apps that are using a lot of energy. Mar 22, 2012 Get ready to change the way you think about your utility bill data. With the Energy Department’s new Apps for Energy competition, we’re challenging developers to use the Green Button data access program to bring residential and commercial utility data to life. The Energy Department – in partnership with Pacific Gas and Electric Company, Itron, and Gridwise Alliance – is offering. However, it is a convenient way–and the only way in Windows–to see which apps are using the most power. This information doesn’t even appear in the slick new Task Manager. With this information, you can get an idea of where your power is going and make informed decisions to.
Metrics that relate to energy use and can be viewed in the Energy pane of Activity Monitor (see Figure 16-1). Use the View > Columns menu to enable or customize the metrics displayed.
As shown in Figure 16-2, graphs denoting overall energy impact and battery statistics are displayed at the bottom of the Energy pane.
The Energy pane in Activity Monitor displays the following columns:
- Preventing Sleep. Indicates when an app is preventing the system from sleeping, perhaps because it has initiated activity that has disabled sleep (see Determine When Your App Is Preventing Sleep).
- Energy Impact. Assigns an energy impact score to your app, based on how efficiently it is operating. A variety of factors are taken into account when this score is assigned, including CPU usage, network activity, disk I/O, and more.
- Avg Energy Impact. Indicates the average energy impact score over the past 8 hours, or since the time the Mac was restarted.
- App Nap. Indicates when an app has been placed in App Nap (see Extend App Nap). You can use this column to monitor your running app and make sure App Nap activates when it’s placed in the background and hidden or fully obscured by another app.
Assess CPU Usage
High CPU usage is a major contributing factor to high energy consumption, and Activity Monitor implements a variety of features that can help assess the amount of CPU your app is utilizes. The CPU pane shows the percentage of CPU your app is using at any given time, in relation to the other active processes on the system, as shown in Figure 16-3. When your app isn’t active, the number in this column should be 0.0. High values here, especially consistent ones, indicate that your app may not be as energy efficient as it could be. You should look carefully at your app for ways to reduce its CPU requirements.
Graphs and statistics related to overall system CPU usage are displayed at the bottom of the CPU pane. See Figure 16-4.
![Using Using](/uploads/1/2/6/2/126202464/839290031.png)
Activity Monitor also includes provides graphical displays of historical and current state CPU core utilization.
- CPU Usage. Represents system-wide usage across all CPU cores. To display this window, choose Window > CPU Usage. See Figure 16-5.
- CPU History. Represents system-wide usage across all CPU cores over a period of time. It begins to capture usage once the window is displayed, and updates as usage fluctuates. To display this window, choose Window > CPU History. See Figure 16-5.
Xcode
There’s no better time to diagnose your app’s energy footprint than when you are in the process of developing your app. Xcode includes a number of features that can help.
Debugging Gauges
The debug navigator in Xcode (choose View > Navigators > Show Debug Navigator) provides a series of gauges that allow you to analyze the energy impact of your app while testing it within Xcode. These gauges are displayed when your app has been launched by Xcode and is actively running or paused.
- Energy impact gauge. Displays a report of your app’s current energy impact and a bar graph of its recent impact. When users interact with your app, it should have a low energy impact. When users aren’t interacting with your app, it should have zero energy impact.
- CPU gauge. Monitors your app and reports on its current and historical CPU usage. Spikes when your app is supposed to have low CPU activity or when your app is idle may indicate problem areas where optimizations can be made.
- Disk usage gauge. Alerts you to disk read and write activity and files your app has opened. Use this gauge to identify unexpected or recurring small I/O activity.
- Network usage gauge. Accounts for all inbound and outbound network traffic. Look for discretionary activity that your app performs directly, and consider updating it to be performed by the system at more energy optimal times.
Debugging
Knowing how to test and debug your app can go a long way toward helping you identify potential energy problems and areas for improvement. Debug Your App in Xcode Overview and Testing with Xcode describe common debugging techniques. If your app performs tasks asynchronously using GCD,
NSOperationQueue
, or XPC, debugging can be a little harder. There are, however, techniques that can help you debug your app even in these complex situations.- Queue debugging. If your app uses GCD dispatch queues to perform operations, use queue debugging techniques to ensure that work is being performed as expected. To learn about GCD, dispatch queues, and queue debugging, watch the session WWDC 2013: Debugging with Xcode, and review the Concurrency Programming Guide and Grand Central Dispatch (GCD) Reference.
- Activity tracing. This technology makes finding bugs faster and easier by logging trace messages as your app runs. When a problem occurs, follow these messages to identify the code that produced the failure. For information on activity tracing, see the session WWDC 2014: Fix Bugs Faster Using Activity Tracing.
Instruments
The Instruments app, which is included with Xcode, gathers data from your running app and presents it in a graphical timeline. You gather data about such performance areas as your app’s CPU usage, disk activity, network activity, and graphics operations. By viewing the data together, you can analyze different aspects of your app’s performance to identify potential areas of improvement.
Instruments provides a variety of preconfigured profiling templates, which help you analyze your app and ensure that it is performing efficiently. Some of these relate directly to energy.
- Activity Monitor template. Monitors the CPU, memory, disk, and network usage statistics of your app. Results are graphically represented at a high level in a timeline. If you prefer, you can dive deeper into detailed statistics for more comprehensive analysis.
- Time Profiler template. Captures stack trace information at prescribed intervals, while displaying a timeline of the percentage of CPU being used.
Note
For detailed information about using Instruments, see Instruments User Guide.
Command-Line Tools
Command-line tools can be useful if you are already working in command-line mode or if you are building scripts to monitor your apps.
- dtrace. Access low-level information about the operating system kernel and the user processes running on your computer. To learn about DTrace and the D scripting language, see the Solaris Dynamic Tracing Guide, available from the Oracle Technology Network, and the dtrace(1) Mac OS X Manual Page.
- fs_usage. Get a running list of system calls related to activity in the file system. Use
fs_usage
command options to specify a timeout, filtering, and more. See fs_usage in Minimize I/O or refer to the fs_usage(1) Mac OS X Manual Page. - pmset. Adjust system-wide power management settings, such as idle sleep timing, automatic restart on power loss, and more. It can also be used to put the device to sleep, and to determine whether any power assertions are in place. See pmset(1) Mac OS X Manual Page.
- powermetrics. Monitor CPU usage and determine how much CPU time is being allocated to different quality of service classes. This can be helpful for ensuring that quality of service classes are properly implemented. See powermetrics in Prioritize Work at the Task Level or the powermetrics(1) Mac OS X Manual Page.
- sample. Gather information about your app at specified intervals and produce a report of functions occurring at those intervals. This information helps you diagnose responsiveness problems, high CPU use problems, and more. See sample(1) Mac OS X Manual Page.
- spindump. Use this tool with the
-timeline
option to sample and profile your app in order to determine which QoS class applies to a thread as a specific portion of code executes at a given time. spindump in Prioritize Work at the Task Level demonstrates usage. See spindump(8) Mac OS X Manual Page. - timerfires. Get logs indicating each time your app is woken as a result of a timer firing. See Recognize and Address Timer Issues in Minimize Timer Usage and timerfires(1) Mac OS X Manual Page.
- top. Get CPU usage information, as shown in Listing 16-1.
Listing 16-1Using top to identify CPU usage for a specified process $ top -pid 68041
PID COMMAND %CPU
68041 Adventure 18.1
Quartz Debug Utility
The Quartz Debug utility (part of the Graphics Tools for Xcode package in the Developer site Downloads section) helps you debug graphics-related issues in your apps. See Detect Extraneous Updates.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-09-13
Put your Mac to sleep
You can save energy by putting your Mac to sleep when you're not using it. When your Mac is sleeping, it's on but consumes less power. And waking your Mac from sleep is quicker than starting it up after it's been shut down.
Random Apps Using Significant Energy On Mac Free
To put your Mac to sleep immediately, do one of the following:
- Choose Apple () menu > Sleep.
- If you use a Mac notebook computer, close its built-in display.
- Press Command (⌘)–Media Eject (⏏).*
- Tap the power button on your computer.*
*These options don't apply to MacBook Pro models with Touch ID.
Adjust settings in Energy Saver
When you don't use your Mac for a while, macOS can automatically turn off features that you aren't using. When the computer needs to perform a task, related components power back up.
You can adjust energy-related settings in the Energy Saver pane of System Preferences:
- Choose Apple menu > System Preferences.
- Click Energy Saver.
Display sleep
You can tell your Mac how long to wait before it puts its display to sleep. Turning your display off is useful if your computer is performing a task (such as playing music) but you don't need to see anything that the computer is doing.
Putting your display to sleep stops the video signal to any internal and external displays. For Apple displays and built-in displays, this also means that the backlight on the LCD is turned off to save energy.
When your display goes to sleep, the screen goes dark or turns off, but apps that are still busy on your Mac stay active. If your display has a power indicator, it may change to indicate that the display is in low-power mode. To wake your display, move the mouse, touch the trackpad, or press a key on the keyboard.
Put hard disks to sleep when possible
This setting powers down the hard drive motor when you aren't reading or writing files from the drive. Solid-state drives (SSDs) don’t have moving parts, so this setting doesn’t affect Mac computers that use only SSDs to store data.
Consider deselecting this option if you have an internal or external non-SSD drive and you use apps—for example, pro audio or video editing software—that work better with continued read and write access to the hard disk.
Wake for network access
Select this option if you want your computer to automatically wake up when someone accesses its shared resources, such as shared printers or iTunes playlists.
This setting applies to wired connections from other computers, such as Ethernet connections. It also applies to Wi-Fi connections if you use a properly configured AirPort base station. Some tasks might prevent the computer from sleeping when idle.
Enable Power Nap
Power Nap allows your Mac to occasionally wake from sleep to perform tasks such as checking for new email or software updates.
During Power Nap, your Mac leaves its displays and other hardware that isn't needed for these tasks powered down to save energy. After it's finished, your Mac automatically goes back to sleep to save energy.
If you don't want your Mac to wake up on its own to perform these tasks, deselect this option.
More options
You might see more options in Energy Saver preferences depending on whether you use a Mac desktop or notebook.
iMac, Mac Pro, and Mac mini
When you use a desktop Mac, you can control when your computer, display, and hard disks are put to sleep to save energy.
These options are available on iMac and Mac Pro:
Mac mini has these options:
Turn display off
With some Mac desktop computers, you can set how long to wait until the computer enters its lowest idle power mode. This setting is different from display sleep because other parts of the computer also sleep.
If you set the computer to never sleep using this slider, the display and other elements of the computer remain in a fully powered state.
Start up automatically after a power failure
You can set your Mac desktop computer to automatically restart if its AC power connection becomes unavailable. For example, if there's a power outage, or you inadvertently disconnect the AC power cord, your Mac starts up again on its own once power is reconnected.
You can automatically re-open windows, apps, and documents on your Mac after it restarts, which is useful if you have your computer set to perform tasks when it's left unattended.
MacBook Pro, MacBook Air, and MacBook
With Mac notebooks, some options are available when the computer operates on battery power, and others are available on AC power. For example, you might want your computer to never sleep when you are connected to AC power. But when it’s on battery power, you might want it to sleep when it’s been idle for only a short time so that the battery remains charged longer.
In the Energy Saver preference pane, select the Battery or Power Adapter tab:
Automatic graphics switching
The automatic graphics switching option appears on Mac notebooks that have more than one built-in graphics chip. When you select it, your computer uses its low power graphics chip for tasks like text editing to save energy. For higher-intensity tasks, like playing games or compressing video, macOS automatically switches to another more complex graphics chip.
If you deselect this option, your computer always uses high-performance graphics, which uses more energy.
Other sleep modes
Some Mac computers enter special sleep modes when you leave them idle for a long time, helping them conserve even more energy.
Standby Mode
For Mac computers that start up from an internal SSD, macOS includes a deep sleep mode known as Standby Mode.
Mac computers manufactured in 2013 or later enter standby after being in sleep mode for three hours. Earlier models enter standby after just over an hour of sleep. During standby, the state of your session is saved to flash storage (SSD). Then, the power turns off to some hardware systems such as RAM and USB buses.
Standby extends how long a notebook computer can stay asleep on battery power. A notebook with a fully charged battery can remain in standby for up to thirty days without being plugged in to power.
Safe sleep
![Free Free](/uploads/1/2/6/2/126202464/565499808.png)
macOS also includes a deep sleep mode known as safe sleep. Your Mac might enter safe sleep if your battery begins to run low, or your computer is left idle for a long time.
Safe sleep copies the contents of memory to your startup drive and powers down the computer, allowing you to pick up where you left off without losing your work.
To wake your Mac from safe sleep, press its power button. If you use a Mac notebook and its battery is low, connect the AC adapter first.
When you wake your computer from safe sleep, a progress indicator appears. This indicates that the previously stored contents of memory are being read from the startup disk and copied back into RAM.
Waking your Mac
To wake your Mac from any of these sleep modes, do one of these:
- Tap the computer's power button.
- Click your mouse or trackpad.
- Open the lid on your Mac notebook.
- Press a key on a connected keyboard.
If you use sharing features on your Mac, other computers that use these services may be able to wake your computer on demand.
Learn more
- You can also save energy by adjusting your display’s brightness and the brightness of your backlit keyboard.
- Learn what to do if your Mac doesn't sleep or wake when expected.