Home » Questions » Computers [ Ask a new question ]

How to check which video card is active in a MacBook Pro?

How to check which video card is active in a MacBook Pro?

There is a big difference in both performance and power consumption between the two video cards in a MacBook Pro.

Asked by: Guest | Views: 142
Total answers/comments: 3
bert [Entry]

"Using the basic idea presented in the other two answers, I wrote the following scripts to determine if you are using the ""correct"" video card (Correct = ""on battery and using the 9400"" or ""on ac adapter and using the 9600"")

I have no idea how fragile these scripts are... they rely on specific data appearing in a particular order in the system_profile plist... but this order seems consistent on my machine. Placing it here for anyone who ever finds this via Google.

Ruby: (requires the ""Plist"" gem to be installed)

# video_profiler.rb
require 'rubygems'
require 'plist'

# calculate video data
data = `system_profiler SPDisplaysDataType -xml`
structured_video_data = Plist.parse_xml(data)
display_status = structured_video_data[0][""_items""][0][""spdisplays_ndrvs""][0][""spdisplays_status""]

if (display_status.eql?('spdisplays_not_connected')) then
card = '9400'
else
card = '9600'
end

# calculate power source data
data = `system_profiler SPPowerDataType -xml`
structured_power_data = Plist.parse_xml(data)
on_ac_power = (structured_power_data[0][""_items""][3][""sppower_battery_charger_connected""] == 'TRUE')

# output results
if (on_ac_power and card.eql?'9400') or (not on_ac_power and card.eql?'9600'):
result = 'You\'re on the wrong video card.'
else
result = ""You\'re on the correct video card.""
end

puts(result)

Python:

# video_profiler.py
from subprocess import Popen, PIPE
from plistlib import readPlistFromString
from pprint import pprint
sp = Popen([""system_profiler"", ""SPDisplaysDataType"", ""-xml""], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
display_status = pl[0][""_items""][0][""spdisplays_ndrvs""][0][""spdisplays_status""]
if (display_status == 'spdisplays_not_connected'):
card = '9400'
else:
card = '9600'

# figure out battery status
sp = Popen([""system_profiler"", ""SPPowerDataType"", ""-xml""], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
on_ac_power = (pl[0][""_items""][3][""sppower_battery_charger_connected""] == 'TRUE')

if (on_ac_power and card == '9400') or (not on_ac_power and card == '9600'):
result = 'You\'re on the wrong video card.'
else:
result = ""You\'re on the correct video card.""

pprint(result)"
bert [Entry]

"Using the basic idea presented in the other two answers, I wrote the following scripts to determine if you are using the ""correct"" video card (Correct = ""on battery and using the 9400"" or ""on ac adapter and using the 9600"")

I have no idea how fragile these scripts are... they rely on specific data appearing in a particular order in the system_profile plist... but this order seems consistent on my machine. Placing it here for anyone who ever finds this via Google.

Ruby: (requires the ""Plist"" gem to be installed)

# video_profiler.rb
require 'rubygems'
require 'plist'

# calculate video data
data = `system_profiler SPDisplaysDataType -xml`
structured_video_data = Plist.parse_xml(data)
display_status = structured_video_data[0][""_items""][0][""spdisplays_ndrvs""][0][""spdisplays_status""]

if (display_status.eql?('spdisplays_not_connected')) then
card = '9400'
else
card = '9600'
end

# calculate power source data
data = `system_profiler SPPowerDataType -xml`
structured_power_data = Plist.parse_xml(data)
on_ac_power = (structured_power_data[0][""_items""][3][""sppower_battery_charger_connected""] == 'TRUE')

# output results
if (on_ac_power and card.eql?'9400') or (not on_ac_power and card.eql?'9600'):
result = 'You\'re on the wrong video card.'
else
result = ""You\'re on the correct video card.""
end

puts(result)

Python:

# video_profiler.py
from subprocess import Popen, PIPE
from plistlib import readPlistFromString
from pprint import pprint
sp = Popen([""system_profiler"", ""SPDisplaysDataType"", ""-xml""], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
display_status = pl[0][""_items""][0][""spdisplays_ndrvs""][0][""spdisplays_status""]
if (display_status == 'spdisplays_not_connected'):
card = '9400'
else:
card = '9600'

# figure out battery status
sp = Popen([""system_profiler"", ""SPPowerDataType"", ""-xml""], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
on_ac_power = (pl[0][""_items""][3][""sppower_battery_charger_connected""] == 'TRUE')

if (on_ac_power and card == '9400') or (not on_ac_power and card == '9600'):
result = 'You\'re on the wrong video card.'
else:
result = ""You\'re on the correct video card.""

pprint(result)"
bert [Entry]

"You can use the ruby gem active_gfx I wrote:
github.com/ChaosCoder/active_gfx

active_gfx shows the graphics card currently in use by your macOS system.

Instead of going through the list of open processes in Activity Monitor, this tool spits out the currently used graphics chip by querying the system_profiler.

As active_gfx is a ruby gem, install it via gem install active_gfx."
"You can use the ruby gem active_gfx I wrote:
github.com/ChaosCoder/active_gfx

active_gfx shows the graphics card currently in use by your macOS system.

Instead of going through the list of open processes in Activity Monitor, this tool spits out the currently used graphics chip by querying the system_profiler.

As active_gfx is a ruby gem, install it via gem install active_gfx."