Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyproto/gionice
Port of ionice to Go
https://github.com/xyproto/gionice
go ionice linux util-linux utility
Last synced: 24 days ago
JSON representation
Port of ionice to Go
- Host: GitHub
- URL: https://github.com/xyproto/gionice
- Owner: xyproto
- License: gpl-2.0
- Created: 2021-02-03T09:37:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-17T13:34:17.000Z (over 1 year ago)
- Last Synced: 2024-12-25T09:23:20.972Z (about 1 month ago)
- Topics: go, ionice, linux, util-linux, utility
- Language: Go
- Homepage:
- Size: 115 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# gionice
This is an port of the core parts of the `ionice` utility from `util-linux`, to a Go module, without using `cgo`.
The command line utility [easy](https://github.com/xyproto/easy) (a drop-in replacement for `ionice`), uses this module.
This package can be used by any Go program that wishes to run without taking up the I/O capabilities of the current system.
## Example use
To make your own Go program run as "idle" and not hog the I/O capabilities of the system, simply call `ionice.Idle()`:
```go
package mainimport (
"io/ioutil"
"os""github.com/xyproto/gionice"
)func main() {
// Make the current process group priority to be "idle" (level 7)
gionice.Idle()// Generate I/O activity
for {
_ = ioutil.WriteFile("frenetic.dat", []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 0644)
_ = os.Remove("frenetic.dat")
}
}
```By using `iotop` it's easy to check that the process PRIO is now `idle`.
See the `cmd/supernice` example for how to make a Go program have a lower priority both when it comes to I/O and CPU.
## General info
* Version: 1.3.0
* License: GPL2
* Author: Alexander F. Rødseth <[email protected]>