Skip to content

takumakume/mruby-ionice

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

mruby-ionice Build Status

This is a binding for Linux system calls ioprio_set(2) , ioprit_get(2) . And it is compatible with ionice(1) .

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :github => 'takumakume/mruby-ionice'
end

example

ioprio classes

from linux/ionice.h

IOnice::IOPRIO_CLASS_NONE  # => 0
IOnice::IOPRIO_CLASS_RT    # => 1
IOnice::IOPRIO_CLASS_BE    # => 2
IOnice::IOPRIO_CLASS_IDLE  # => 3

iopro who

from linux/ionice.h

IOnice::IOPRIO_WHO_PROCESS  # => 1
IOnice::IOPRIO_WHO_PGRP     # => 2
IOnice::IOPRIO_WHO_USER     # => 3

ionice get

# for process
IOnice::get(Process.pid)
# => { 'class' => IOnice::IOPRIO_CLASS_NONE }
IOnice::get(Process.pid)
# => { 'class' => IOnice::IOPRIO_CLASS_RT, 'priority' => 2 }
  • for process

    IOnice::get(pid)
    IOnice::get(pid, IOnice::IOPRIO_WHO_PROCESS)
  • for process group

    IOnice::get(pgid, IOnice::IOPRIO_WHO_PGRP)
  • for uid

    IOnice::get(uid, IOnice::IOPRIO_WHO_USER)

ionice set

# for process
IOnice::set(Process.pid, IOnice::IOPRIO_CLASS_NONE)
IOnice::set(Process.pid, IOnice::IOPRIO_CLASS_IDLE)
IOnice::set(Process.pid, IOnice::IOPRIO_CLASS_BE, 7) # priority is 0..7
IOnice::set(Process.pid, IOnice::IOPRIO_CLASS_RT, 2) # priority is 0..7
# => true
  • for process

    IOnice::set(pid, IOnice::IOPRIO_CLASS_BE, 2)
    IOnice::set(pid, IOnice::IOPRIO_CLASS_BE, 2, IOnice::IOPRIO_WHO_PROCESS)
  • for process group

    IOnice::set(pgid, IOnice::IOPRIO_CLASS_BE, 2, IOnice::IOPRIO_WHO_PGRP)
  • for uid

    IOnice::set(uid, IOnice::IOPRIO_CLASS_BE, 2, IOnice::IOPRIO_WHO_USER)

License

under the MIT License:

  • see LICENSE file

About

ioprio_get(2) / ioprio_set(2) for mruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published