mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
another round of fixes for the cpuset code
This commit is contained in:
parent
d78b327d34
commit
fb61dc31ef
3 changed files with 7 additions and 12 deletions
|
@ -167,17 +167,12 @@ public:
|
||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool& operator[](std::size_t cpu)
|
|
||||||
//{
|
|
||||||
// void cpuset_set_cpu(cpuset_t*setp, cpu_t cpu, int state)
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool operator[](size_t cpu) const
|
bool operator[](size_t cpu) const
|
||||||
{
|
{
|
||||||
return isset(cpu);
|
return isSet(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isset(size_t cpu) const
|
bool isSet(size_t cpu) const
|
||||||
{
|
{
|
||||||
return CPU_ISSET_S(cpu, sz, setp);
|
return CPU_ISSET_S(cpu, sz, setp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ CpuSet::operator uintmax_t()
|
||||||
uintmax_t iset = 0;
|
uintmax_t iset = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < num_cpus; i++) {
|
for (size_t i = 0; i < num_cpus; i++) {
|
||||||
if (isset(i))
|
if (isSet(i))
|
||||||
iset |= 1ULL << i;
|
iset |= 1ULL << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,10 +98,10 @@ CpuSet::operator std::string ()
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < num_cpus; i++) {
|
for (size_t i = 0; i < num_cpus; i++) {
|
||||||
if (isset(i)) {
|
if (isSet(i)) {
|
||||||
size_t run = 0;
|
size_t run = 0;
|
||||||
for (size_t j = i + 1; j < num_cpus; j++) {
|
for (size_t j = i + 1; j < num_cpus; j++) {
|
||||||
if (!isset(j))
|
if (!isSet(j))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
run++;
|
run++;
|
||||||
|
|
|
@ -88,8 +88,8 @@ Test(utils, cpuset)
|
||||||
cr_assert_eq(cset3, cset4);
|
cr_assert_eq(cset3, cset4);
|
||||||
cr_assert_eq(cset3.count(), 5);
|
cr_assert_eq(cset3.count(), 5);
|
||||||
|
|
||||||
cr_assert(cset3.isset(3));
|
cr_assert(cset3.isSet(3));
|
||||||
cr_assert_not(cset3.isset(6));
|
cr_assert_not(cset3.isSet(6));
|
||||||
|
|
||||||
cr_assert(cset3[3]);
|
cr_assert(cset3[3]);
|
||||||
cr_assert_not(cset3[6]);
|
cr_assert_not(cset3[6]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue