Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionice - get/set process IO priority #147

Closed
giampaolo opened this issue May 23, 2014 · 4 comments
Closed

ionice - get/set process IO priority #147

giampaolo opened this issue May 23, 2014 · 4 comments

Comments

@giampaolo
Copy link
Owner

From g.rodola on January 12, 2011 14:11:22

I've just found this interesting article: 
http://friedcpu.wordpress.com/2007/07/17/why-arent-you-using-ionice-yet/ 
...describing how, on Linux, the "renice" command can be used to change the IO 
priority of a process.
Proposal  
is to add this functionality in psutil by adding a new property to the Process 
class which permits to  get and set/change process IO priority.

= API = 

This should be the same we used for process niceness/priority ( issue 142 ), 
consisting in a unique property for both getting and setting process IO priority.
IOPRIO_CLASS_RT, IOPRIO_CLASS_BE and IOPRIO_CLASS_IDLE constants should be 
exposed as well.
Example:

>>> psutil.Process(os.getpid())
>>> psutil.ionice
0
>>> psutil.ionice = psutil.IOPRIO_CLASS_RT
>>> psutil.ionice
2

= Linux implementation = 

renice source code: 
http://www.kernel.org/pub/linux/utils/util-linux-ng/v2.19/util-linux-2.19-rc1.tar.gz
 ioprio_get() and ioprio_set() system calls: 
http://linux.die.net/man/2/ioprio_get http://linux.die.net/man/2/ioprio_set = 
Other platforms = 

FreeBSD (and probably OSX as well) seems not to have this functionnality yet 
although it might appear in the future: 
http://old.nabble.com/ionice-in-FreeBSD--td27424108.html On Windows this seems 
to be possible but only starting from Windows Vista: 
http://forum.sysinternals.com/printer_friendly_posts.asp?TID=12767 As for now, 
my proposal is to provide this functionnality only on Linux.
On all other platforms Process.nice will just raise an AttributeError exception.

Original issue: http://code.google.com/p/psutil/issues/detail?id=147

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From g.rodola on January 13, 2011 02:45:21

Cc: guichaz

@giampaolo
Copy link
Owner Author

From g.rodola on January 13, 2011 14:25:50

Implemented in r892 .
I decided not to use a property but to split everything in two separate 
functions, get_ionice() and set_ionice(), because it must be possible to 
differentiate priority class and level (see ionice command).

Status: FixedInSVN

@giampaolo
Copy link
Owner Author

From g.rodola on March 20, 2011 14:55:37

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:58:12

Updated csets after the SVN -> Mercurial migration: r892 == revision 
d17f087b01e3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant