Replaced $*\s with tabs

This commit is contained in:
0xJoeMama 2022-05-20 23:54:07 +03:00
parent e70dbc1bce
commit c0f6084159
No known key found for this signature in database
GPG key ID: 6E0A65853073294E

View file

@ -5,7 +5,7 @@
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
@ -1259,19 +1259,19 @@ namespace Proc {
int filter_found = 0; int filter_found = 0;
detail_container detailed; detail_container detailed;
uint64_t kthreadd_pid{}; uint64_t kthreadd_pid{};
static void filter_kernel(const bool& should_filter) { static void filter_kernel(const bool& should_filter) {
if (!should_filter) { if (!should_filter) {
return; return;
} }
// Filter out kernel processes // Filter out kernel processes
auto keraser = rng::remove_if(current_procs, [](const proc_info& curr) { auto keraser = rng::remove_if(current_procs, [](const proc_info& curr) {
return curr.pid == kthreadd_pid || curr.ppid == kthreadd_pid; return curr.pid == kthreadd_pid || curr.ppid == kthreadd_pid;
}); });
current_procs.erase(keraser.begin(), keraser.end()); current_procs.erase(keraser.begin(), keraser.end());
} }
//* Generate process tree list //* Generate process tree list
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<std::reference_wrapper<proc_info>>& out_procs, int cur_depth, const bool collapsed, const string& filter, bool found=false, const bool no_update=false, const bool should_filter=false) { void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<std::reference_wrapper<proc_info>>& out_procs, int cur_depth, const bool collapsed, const string& filter, bool found=false, const bool no_update=false, const bool should_filter=false) {
@ -1439,7 +1439,7 @@ namespace Proc {
const auto& reverse = Config::getB("proc_reversed"); const auto& reverse = Config::getB("proc_reversed");
const auto& filter = Config::getS("proc_filter"); const auto& filter = Config::getS("proc_filter");
const auto& per_core = Config::getB("proc_per_core"); const auto& per_core = Config::getB("proc_per_core");
const auto& should_filter_kernel = Config::getB("proc_filter_kernel"); const auto& should_filter_kernel = Config::getB("proc_filter_kernel");
const auto& tree = Config::getB("proc_tree"); const auto& tree = Config::getB("proc_tree");
const auto& show_detailed = Config::getB("show_detailed"); const auto& show_detailed = Config::getB("show_detailed");
const size_t detailed_pid = Config::getI("detailed_pid"); const size_t detailed_pid = Config::getI("detailed_pid");
@ -1505,7 +1505,7 @@ namespace Proc {
vector<size_t> found; vector<size_t> found;
for (const auto& d: fs::directory_iterator(Shared::procPath)) { for (const auto& d: fs::directory_iterator(Shared::procPath)) {
if (Runner::stopping) if (Runner::stopping)
return current_procs; return current_procs;
if (pread.is_open()) pread.close(); if (pread.is_open()) pread.close();
const string pid_str = d.path().filename(); const string pid_str = d.path().filename();
@ -1530,9 +1530,9 @@ namespace Proc {
pread.open(d.path() / "comm"); pread.open(d.path() / "comm");
if (not pread.good()) continue; if (not pread.good()) continue;
getline(pread, new_proc.name); getline(pread, new_proc.name);
if (new_proc.name == "kthreadd") { if (new_proc.name == "kthreadd") {
kthreadd_pid = new_proc.pid; kthreadd_pid = new_proc.pid;
} }
pread.close(); pread.close();
//? Check for whitespace characters in name and set offset to get correct fields from stat file //? Check for whitespace characters in name and set offset to get correct fields from stat file
new_proc.name_offset = rng::count(new_proc.name, ' '); new_proc.name_offset = rng::count(new_proc.name, ' ');
@ -1690,7 +1690,7 @@ namespace Proc {
old_cputimes = cputimes; old_cputimes = cputimes;
} }
filter_kernel(should_filter_kernel); // Filter here to make sorting faster. filter_kernel(should_filter_kernel); // Filter here to make sorting faster.
//* ---------------------------------------------Collection done----------------------------------------------- //* ---------------------------------------------Collection done-----------------------------------------------
//* Sort processes //* Sort processes