Skip to content

Commit 4f670a1

Browse files
committed
/sys/devices/cpu_atom/cpus may be "\n" in virtual machine.
It seems that virtual machine also prefers to use p-core. If you don't use cpu nums more than p-core nums, `/sys/devices/cpu_atom/cpus` also exists but its content is '\n'.
1 parent bbe8772 commit 4f670a1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/CPUs.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ static bool hybrid_cpu_arch_parse_cpus(const filesystem::path& dir,
3030
while (!s.empty() && s[s.size() - 1] == '\n') {
3131
s.resize(s.size() - 1);
3232
}
33+
if (s.empty()) {
34+
LOG(info) << "File " << dir.string() << "/cpus is empty after trimming.";
35+
return false;
36+
}
3337
size_t dash = s.find('-');
3438
if (dash == string::npos) {
3539
size_t end;

0 commit comments

Comments
 (0)