Skip to content

Instantly share code, notes, and snippets.

@rmohr
Last active October 15, 2015 11:08
Show Gist options
  • Save rmohr/23b7ae12ac0b8d0201a5 to your computer and use it in GitHub Desktop.
Save rmohr/23b7ae12ac0b8d0201a5 to your computer and use it in GitHub Desktop.
Use pyudev to monitor cpu hotplug events
import pyudev
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='cpu')
for action, device in monitor:
print('CPU %s went %s ' % (device.sys_path, action))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment