Merge branch 'aristocratos:main' into battery-power-2

This commit is contained in:
vsey 2023-12-29 01:14:34 +01:00 committed by GitHub
commit fb6af5ddb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 22 deletions

View file

@ -1802,7 +1802,7 @@ namespace Proc {
p_counters[p.pid] = 0;
}
else if (p.cpu_p < 0.1 and ++p_counters[p.pid] >= 10) {
p_graphs.erase(p.pid);
if (p_graphs.contains(p.pid)) p_graphs.erase(p.pid);
p_counters.erase(p.pid);
}
else
@ -1930,22 +1930,18 @@ namespace Proc {
//? Clear out left over graphs from dead processes at a regular interval
if (not data_same and ++counter >= 100) {
counter = 0;
for (auto element = p_graphs.begin(); element != p_graphs.end();) {
if (rng::find(plist, element->first, &proc_info::pid) == plist.end()) {
element = p_graphs.erase(element);
p_counters.erase(element->first);
}
else
++element;
}
for (auto element = p_wide_cmd.begin(); element != p_wide_cmd.end();) {
if (rng::find(plist, element->first, &proc_info::pid) == plist.end()) {
element = p_wide_cmd.erase(element);
}
else
++element;
}
std::erase_if(p_graphs, [&](const auto& pair) {
return rng::find(plist, pair.first, &proc_info::pid) == plist.end();
});
std::erase_if(p_counters, [&](const auto& pair) {
return rng::find(plist, pair.first, &proc_info::pid) == plist.end();
});
std::erase_if(p_wide_cmd, [&](const auto& pair) {
return rng::find(plist, pair.first, &proc_info::pid) == plist.end();
});
}
if (selected == 0 and selected_pid != 0) {

View file

@ -995,12 +995,6 @@ namespace Gpu {
if (initialized) return false;
//? Dynamic loading & linking
nvml_dl_handle = dlopen("libnvidia-ml.so", RTLD_LAZY);
if (!nvml_dl_handle) {
Logger::info(std::string("Failed to load libnvidia-ml.so, NVIDIA GPUs will not be detected: ") + dlerror());
return false;
}
//? Try possible library names for libnvidia-ml.so
const array libNvAlts = {
"libnvidia-ml.so",