1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

another round of fixes for the cpuset code

This commit is contained in:
Steffen Vogel 2020-09-13 11:11:03 +02:00
parent eb81ab4545
commit 7e9583187b
3 changed files with 7 additions and 12 deletions

View file

@ -167,17 +167,12 @@ public:
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
{
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);
}

View file

@ -84,7 +84,7 @@ CpuSet::operator uintmax_t()
uintmax_t iset = 0;
for (size_t i = 0; i < num_cpus; i++) {
if (isset(i))
if (isSet(i))
iset |= 1ULL << i;
}
@ -98,10 +98,10 @@ CpuSet::operator std::string ()
bool first = true;
for (size_t i = 0; i < num_cpus; i++) {
if (isset(i)) {
if (isSet(i)) {
size_t run = 0;
for (size_t j = i + 1; j < num_cpus; j++) {
if (!isset(j))
if (!isSet(j))
break;
run++;

View file

@ -88,8 +88,8 @@ Test(utils, cpuset)
cr_assert_eq(cset3, cset4);
cr_assert_eq(cset3.count(), 5);
cr_assert(cset3.isset(3));
cr_assert_not(cset3.isset(6));
cr_assert(cset3.isSet(3));
cr_assert_not(cset3.isSet(6));
cr_assert(cset3[3]);
cr_assert_not(cset3[6]);