Skip to content

Commit

Permalink
Added docs for sched_setaffinity and sched_getaffinity.
Browse files Browse the repository at this point in the history
Changed version/release to 1.3.2a-1
  • Loading branch information
efocht committed Dec 10, 2018
1 parent bf5b8ff commit 43e3fd0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on the SX-Aurora Vector Engines located in the current host:
* load and memory statistics of VEs,
* information on processes running on the VEs,
* fan, temperature, voltage of VEs,
* reading and setting the VE core affinity of processes,
* various statistical infos,
* a mechanism to read VE register values of own processes.

Expand Down Expand Up @@ -253,6 +254,32 @@ Example:
'', '', '', '', '', '']}
```

### `sched_getaffinity(int nodeid, pid_t pid)` and `sched_setaffinity(int nodeid, pid_t pid, uint64_t mask)`

A VE thread's CPU affinity mask determines the set of cores on its VE
node on which it is eligible to run. These functions are equivalent to
the normal Linux
[*sched_getaffinity(2)*](https://linux.die.net/man/2/sched_getaffinity)
and
[*sched_setaffinity(2)*](https://linux.die.net/man/2/sched_setaffinity)
calls but refers to a particular *pid* running on a particular
*nodeid*. Setting the VE core affinity of a thread requires as third
argument a bitmask that specifies the cores. For 8 cores only the
lowest 8 bits are relevant.

The functions return 0 on success and -1 on failure.

Example:
```
>>> from veosinfo import *
>>> sched_getaffinity(0, 23360)
255L
>>> sched_setaffinity(0, 23360, 0x4)
4L
>>> sched_getaffinity(0, 23360)
4L
```

### `stat_info(int nodeid)`

Returns CPU statistics information of each code of the specified VE.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
executable=/usr/bin/env python

[bdist_rpm]
release = 2
release = 1
packager = Erich Focht <efocht@gmail.com>

[install]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

setup(
name = "py-veosinfo",
version = "1.3.2",
version = "1.3.2a",
ext_modules = ext_mods,
scripts = ["veperf"],
author = "Erich Focht",
Expand Down

0 comments on commit 43e3fd0

Please sign in to comment.