btop/src/btop_shared.cpp

208 lines
8.3 KiB
C++
Raw Normal View History

/* Copyright 2021 Aristocratos (jakob@qvantnet.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
indent = tab
tab-size = 4
*/
#include <ranges>
#include <regex>
#include <string>
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
#include "btop_config.hpp"
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
#include "btop_shared.hpp"
#include "btop_tools.hpp"
namespace rng = std::ranges;
using namespace Tools;
#ifdef GPU_SUPPORT
namespace Gpu {
vector<string> gpu_names;
vector<int> gpu_b_height_offsets;
std::unordered_map<string, deque<long long>> shared_gpu_percent = {
{"gpu-average", {}},
{"gpu-vram-total", {}},
{"gpu-pwr-total", {}},
};
long long gpu_pwr_total_max;
}
#endif
namespace Proc {
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting, bool reverse, bool tree) {
if (reverse) {
switch (v_index(sort_vector, sorting)) {
case 0: rng::stable_sort(proc_vec, rng::less{}, &proc_info::pid); break;
case 1: rng::stable_sort(proc_vec, rng::less{}, &proc_info::name); break;
case 2: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cmd); break;
case 3: rng::stable_sort(proc_vec, rng::less{}, &proc_info::threads); break;
case 4: rng::stable_sort(proc_vec, rng::less{}, &proc_info::user); break;
case 5: rng::stable_sort(proc_vec, rng::less{}, &proc_info::mem); break;
case 6: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cpu_p); break;
case 7: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cpu_c); break;
}
}
else {
switch (v_index(sort_vector, sorting)) {
case 0: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::pid); break;
case 1: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::name); break;
case 2: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cmd); break;
case 3: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::threads); break;
case 4: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::user); break;
case 5: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::mem); break;
case 6: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cpu_p); break;
case 7: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cpu_c); break;
}
}
//* When sorting with "cpu lazy" push processes over threshold cpu usage to the front regardless of cumulative usage
if (not tree and not reverse and sorting == "cpu lazy") {
double max = 10.0, target = 30.0;
for (size_t i = 0, x = 0, offset = 0; i < proc_vec.size(); i++) {
if (i <= 5 and proc_vec.at(i).cpu_p > max)
max = proc_vec.at(i).cpu_p;
else if (i == 6)
target = (max > 30.0) ? max : 10.0;
if (i == offset and proc_vec.at(i).cpu_p > 30.0)
offset++;
else if (proc_vec.at(i).cpu_p > target) {
rotate(proc_vec.begin() + offset, proc_vec.begin() + i, proc_vec.begin() + i + 1);
if (++x > 10) break;
}
}
}
}
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
void tree_sort(vector<tree_proc>& proc_vec, const string& sorting, bool reverse, int& c_index, const int index_max, bool collapsed) {
if (proc_vec.size() > 1) {
if (reverse) {
switch (v_index(sort_vector, sorting)) {
case 3: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().threads < b.entry.get().threads; }); break;
case 5: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().mem < b.entry.get().mem; }); break;
case 6: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_p < b.entry.get().cpu_p; }); break;
case 7: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_c < b.entry.get().cpu_c; }); break;
}
}
else {
switch (v_index(sort_vector, sorting)) {
case 3: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().threads > b.entry.get().threads; }); break;
case 5: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().mem > b.entry.get().mem; }); break;
case 6: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_p > b.entry.get().cpu_p; }); break;
case 7: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_c > b.entry.get().cpu_c; }); break;
}
}
}
for (auto& r : proc_vec) {
r.entry.get().tree_index = (collapsed or r.entry.get().filtered ? index_max : c_index++);
if (not r.children.empty()) {
tree_sort(r.children, sorting, reverse, c_index, (collapsed or r.entry.get().collapsed or r.entry.get().tree_index == (size_t)index_max));
}
}
}
bool matches_filter(const proc_info& proc, const std::string& filter) {
if (filter.starts_with("!")) {
if (filter.size() == 1) {
return true;
}
std::regex regex{filter.substr(1), std::regex::extended};
return std::regex_search(std::to_string(proc.pid), regex) ||
std::regex_search(proc.name, regex) || std::regex_match(proc.cmd, regex) ||
std::regex_search(proc.user, regex);
} else {
return s_contains(std::to_string(proc.pid), filter) ||
s_contains_ic(proc.name, filter) || s_contains_ic(proc.cmd, filter) ||
s_contains_ic(proc.user, filter);
}
}
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<tree_proc>& out_procs,
int cur_depth, bool collapsed, const string& filter, bool found, bool no_update, bool should_filter) {
auto cur_pos = out_procs.size();
bool filtering = false;
//? If filtering, include children of matching processes
if (not found and (should_filter or not filter.empty())) {
if (!matches_filter(cur_proc, filter)) {
filtering = true;
cur_proc.filtered = true;
filter_found++;
}
else {
found = true;
cur_depth = 0;
}
}
else if (cur_proc.filtered) cur_proc.filtered = false;
cur_proc.depth = cur_depth;
//? Set tree index position for process if not filtered out or currently in a collapsed sub-tree
out_procs.push_back({ cur_proc, {} });
if (not collapsed and not filtering) {
cur_proc.tree_index = out_procs.size() - 1;
//? Try to find name of the binary file and append to program name if not the same
if (cur_proc.short_cmd.empty() and not cur_proc.cmd.empty()) {
std::string_view cmd_view = cur_proc.cmd;
cmd_view = cmd_view.substr((size_t)0, std::min(cmd_view.find(' '), cmd_view.size()));
cmd_view = cmd_view.substr(std::min(cmd_view.find_last_of('/') + 1, cmd_view.size()));
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
cur_proc.short_cmd = string{cmd_view};
}
}
else {
cur_proc.tree_index = in_procs.size();
}
//? Recursive iteration over all children
for (auto& p : rng::equal_range(in_procs, cur_proc.pid, rng::less{}, &proc_info::ppid)) {
if (collapsed and not filtering) {
cur_proc.filtered = true;
}
_tree_gen(p, in_procs, out_procs.back().children, cur_depth + 1, (collapsed or cur_proc.collapsed), filter, found, no_update, should_filter);
if (not no_update and not filtering and (collapsed or cur_proc.collapsed)) {
//auto& parent = cur_proc;
cur_proc.cpu_p += p.cpu_p;
cur_proc.cpu_c += p.cpu_c;
cur_proc.mem += p.mem;
cur_proc.threads += p.threads;
filter_found++;
p.filtered = true;
}
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
else if (Config::getB("proc_aggregate")) {
cur_proc.cpu_p += p.cpu_p;
cur_proc.cpu_c += p.cpu_c;
cur_proc.mem += p.mem;
cur_proc.threads += p.threads;
}
}
if (collapsed or filtering) {
return;
}
//? Add tree terminator symbol if it's the last child in a sub-tree
if (out_procs.back().children.size() > 0 and out_procs.back().children.back().entry.get().prefix.size() >= 8 and not out_procs.back().children.back().entry.get().prefix.ends_with("]─"))
out_procs.back().children.back().entry.get().prefix.replace(out_procs.back().children.back().entry.get().prefix.size() - 8, 8, " └─ ");
//? Add collapse/expand symbols if process have any children
out_procs.at(cur_pos).entry.get().prefix = ""s * cur_depth + (out_procs.at(cur_pos).children.size() > 0 ? (cur_proc.collapsed ? "[+]─" : "[-]─") : " ├─ ");
}
2022-10-02 20:52:27 +02:00
}