Mega-commit with features and tweaks for 1.0:

* Performance improvements
* Support for splitting CPU meters into two or four columns
  (thanks to Wim Heirman)
* Switch from PLPA, which is now deprecated, to HWLOC.
* Bring back support for native Linux sched_setaffinity,
  so we don't have to use HWLOC where we don't need to.
* Support for typing in user names and column fields in selection panels.
This commit is contained in:
Hisham Muhammad
2011-11-18 06:08:56 +00:00
parent 3885648881
commit 7ca1081712
21 changed files with 429 additions and 102 deletions

View File

@ -567,6 +567,7 @@ bool Process_setPriority(Process* this, int priority) {
}
#ifdef HAVE_HWLOC
Affinity* Process_getAffinity(Process* this) {
hwloc_cpuset_t cpuset = hwloc_bitmap_alloc();
bool ok = (hwloc_linux_get_tid_cpubind(this->pl->topology, this->pid, cpuset) == 0);
@ -597,6 +598,31 @@ bool Process_setAffinity(Process* this, Affinity* affinity) {
hwloc_bitmap_free(cpuset);
return ok;
}
#elif HAVE_NATIVE_AFFINITY
Affinity* Process_getAffinity(Process* this) {
cpu_set_t cpuset;
bool ok = (sched_getaffinity(this->pid, sizeof(cpu_set_t), &cpuset) == 0);
if (!ok) return NULL;
Affinity* affinity = Affinity_new();
for (int i = 0; i < this->pl->cpuCount; i++) {
if (CPU_ISSET(i, &cpuset))
Affinity_add(affinity, i);
}
return affinity;
}
bool Process_setAffinity(Process* this, Affinity* affinity) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
for (int i = 0; i < affinity->used; i++) {
CPU_SET(affinity->cpus[i], &cpuset);
}
bool ok = (sched_setaffinity(this->pid, sizeof(unsigned long), &cpuset) == 0);
return ok;
}
#endif
void Process_sendSignal(Process* this, int sgn) {