Created
September 13, 2009 15:45
-
-
Save atr000/186217 to your computer and use it in GitHub Desktop.
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
#Constants from sys/resources.h | |
#I/O type | |
#IOPOL_TYPE_DISK 0 | |
#scope | |
#IOPOL_SCOPE_PROCESS 0 | |
#IOPOL_SCOPE_THREAD 1 | |
#I/O Priority | |
#IOPOL_DEFAULT 0 | |
#IOPOL_NORMAL 1 | |
#IOPOL_PASSIVE 2 | |
#IOPOL_THROTTLE 3 | |
#int getiopolicy_np(int iotype, int scope); | |
#int setiopolicy_np(int iotype, int scope, int policy); | |
#load libc | |
from ctypes import cdll | |
libc=cdll.LoadLibrary('libc.dylib') | |
print "Get IO Priority Before" | |
intBefore=libc.getiopolicy_np(0,1) | |
print intBefore | |
print "Set IO Priority Result" | |
boolSetResult=libc.setiopolicy_np(0,1,3) | |
print boolSetResult | |
print "Get IO Priority After" | |
intAfter=libc.getiopolicy_np(0,1) | |
print intAfter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment