Compare commits

..

No commits in common. "master" and "v0.9.23" have entirely different histories.

8 changed files with 24 additions and 71 deletions

View File

@ -27,12 +27,11 @@ assignees: aristocratos
- Bashtop version: - Bashtop version:
- (Linux) Linux distribution and version: - (Linux) Linux distribution and version:
- (Linux) Data collection type (/proc or psutil): - (Linux) Data collection type (/proc or psutil):
- Psutil version: `python3 -c "import psutil; print(psutil.version_info)"` (version 5.7.0 or above is required):
- (OSX/FreeBSD) Os release version: - (OSX/FreeBSD) Os release version:
- Terminal used: - Terminal used:
- Font used: - Font used:
- Bash version, `bash --version` (version 4.4 or above is required): - Bash version, "bash --version" (version 4.4 or above is required):
- Locales: output of `locale -v` - Locales: output of "locale -v"
**Additional context** **Additional context**

View File

@ -1,14 +1,5 @@
# Changelog # Changelog
## v0.9.25
* Fixed: Crash when using "/proc" data collection and filesystem type is 9p, by @bolapara
## v0.9.24
* Fixed: Psutil script crash on OSX
* Fixed: Error handling for malformed osx-cpu-temp output
## v0.9.23 ## v0.9.23
* Fixed: kill/terminate/interrupt process not working in OsX and FreeBSD * Fixed: kill/terminate/interrupt process not working in OsX and FreeBSD

View File

@ -6,8 +6,6 @@
* Is it a requested change or feature? * Is it a requested change or feature?
* If not, open a feature request to get feedback before making a pull request. * If not, open a feature request to get feedback before making a pull request.
* If it's a fix for a unreported bug, make a bug report and link the pull request.
* Split up multiple unrelated changes in multiple pull requests. * Split up multiple unrelated changes in multiple pull requests.
* [Shellcheck](https://github.com/koalaman/shellcheck) your work. Current shellsheck exceptions at the beginning of [bashtop](bashtop). * [Shellcheck](https://github.com/koalaman/shellcheck) your work. Current shellsheck exceptions at the beginning of [bashtop](bashtop).

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
echo -e "[\033[1;33m removing packet from the system \033[0m]" echo -e "[\033[1;33m removing packet from the system \033[0m]"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -12,24 +12,13 @@
[![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos) [![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos)
[![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos) [![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos)
### C++ Version
##### 18 September 2021
![btop++](https://raw.githubusercontent.com/aristocratos/btop/main/Img/logo.png)
The C++ version of bashtop - btop++ is available.
Get it at https://github.com/aristocratos/btop
#
## Index ## Index
* [Documents](#documents) * [Documents](#documents)
* [Description](#description) * [Description](#description)
* [Features](#features) * [Features](#features)
* [Themes](#themes) * [Themes](#themes)
* [Upcoming](#upcoming) (Python port)
* [Support and funding](#support-and-funding) * [Support and funding](#support-and-funding)
* [Prerequisites](#prerequisites) * [Prerequisites](#prerequisites)
* [Dependencies](#dependencies) * [Dependencies](#dependencies)
@ -39,7 +28,6 @@ Get it at https://github.com/aristocratos/btop
* [TODO](#todo) * [TODO](#todo)
* [License](#license) * [License](#license)
## Documents ## Documents
#### [CHANGELOG.md](CHANGELOG.md) #### [CHANGELOG.md](CHANGELOG.md)
@ -77,6 +65,13 @@ User created themes should be placed in `$HOME/.config/bashtop/user_themes` to b
Let me know if you want to contribute with new themes. Let me know if you want to contribute with new themes.
## Upcoming
#### Python port: bpytop
Currently working full time on this during my vacation :)
I'm aiming to have a first release by end of July.
## Support and funding ## Support and funding
Bug fixes and updates might be slow during normal workdays since I work full time as an industrial worker and don't have much time or energy left during the week. Bug fixes and updates might be slow during normal workdays since I work full time as an industrial worker and don't have much time or energy left during the week.
@ -208,7 +203,9 @@ brew install osx-cpu-temp
>Install with pkg and pip >Install with pkg and pip
``` bash ``` bash
sudo pkg install coreutils gsed git py37-psutil sudo pkg install coreutils gsed python3 git
sudo python3 -m ensurepip
sudo pip3 install psutil
``` ```
#### Manual installation Linux, OSX and FreeBSD #### Manual installation Linux, OSX and FreeBSD
@ -227,16 +224,6 @@ sudo make install
sudo make uninstall sudo make uninstall
``` ```
#### FreeBSD package
Available in [FreeBSD ports](https://www.freshports.org/sysutils/bashtop/)
Install pre-built pacakge
``` bash
sudo pkg install bashtop
```
#### Arch based #### Arch based
Available in the AUR as [bashtop-git](https://aur.archlinux.org/packages/bashtop-git/) Available in the AUR as [bashtop-git](https://aur.archlinux.org/packages/bashtop-git/)
@ -263,16 +250,6 @@ Or use quick installation:
sudo ./build --remove sudo ./build --remove
``` ```
#### Guix based
Available in [official Guix repository](https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/admin.scm) since 6bbd0fd2
>Installation
``` bash
guix install bashtop
```
#### Ubuntu based #### Ubuntu based
Available in [official Ubuntu repository](https://launchpad.net/ubuntu/+source/bashtop) since Ubuntu 20.10 Available in [official Ubuntu repository](https://launchpad.net/ubuntu/+source/bashtop) since Ubuntu 20.10

21
bashtop
View File

@ -93,7 +93,7 @@ banner=(
"██╔══██╗██╔══██║╚════██║██╔══██║ ██║ ██║ ██║██╔═══╝ " "██╔══██╗██╔══██║╚════██║██╔══██║ ██║ ██║ ██║██╔═══╝ "
"██████╔╝██║ ██║███████║██║ ██║ ██║ ╚██████╔╝██║ " "██████╔╝██║ ██║███████║██║ ██║ ██║ ╚██████╔╝██║ "
"╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ") "╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ")
declare version="0.9.25" declare version="0.9.23"
#* Get latest version of BashTOP from https://github.com/aristocratos/bashtop #* Get latest version of BashTOP from https://github.com/aristocratos/bashtop
@ -2129,10 +2129,8 @@ collect_cpu_temps() { #? Collect cpu temperatures
#* Get CPU package temp for Rapberry Pi cpus and for OSX #* Get CPU package temp for Rapberry Pi cpus and for OSX
elif [[ $sensor_comm != "sensors" && -n ${misc_var} ]]; then elif [[ $sensor_comm != "sensors" && -n ${misc_var} ]]; then
cpu[temp_0]="${misc_var#temp=}" cpu[temp_0]="${misc_var#temp=}"
cpu[temp_unit]="°${cpu[temp_0]:(-1)}"; cpu[temp_0]=${cpu[temp_0]%%.*}; if [[ ${cpu[temp_0]::1} == "+" ]]; then cpu[temp_0]=${cpu[temp_0]#+}; fi cpu[temp_unit]="°${cpu[temp_0]:(-1)}"; cpu[temp_0]=${cpu[temp_0]%.*}; if [[ ${cpu[temp_0]::1} == "+" ]]; then cpu[temp_0]=${cpu[temp_0]#+}; fi
if [[ -z ${cpu[temp_high]} ]]; then cpu[temp_high]="75"; cpu[temp_crit]=$((cpu[temp_high]+10))
cpu[temp_high]="75"; cpu[temp_crit]=$((cpu[temp_high]+10))
fi
#* Copy cpu temp to cores #* Copy cpu temp to cores
for((i=1;i<=threads;i++)); do for((i=1;i<=threads;i++)); do
@ -2235,7 +2233,7 @@ collect_mem() { #? Collect memory information from "/proc/meminfo"
if ! py_command -a df_array "get_disks(exclude='squashfs'${filtering})"; then psutil_disk_fail=1; psutil_on="false"; fi if ! py_command -a df_array "get_disks(exclude='squashfs'${filtering})"; then psutil_disk_fail=1; psutil_on="false"; fi
fi fi
if [[ $psutil_on == false ]]; then if [[ $psutil_on == false ]]; then
readarray -t df_array < <(${df} -x squashfs -x tmpfs -x devtmpfs -x overlay -x 9p 2>/dev/null || true) readarray -t df_array < <(${df} -x squashfs -x tmpfs -x devtmpfs -x overlay 2>/dev/null || true)
fi fi
for df_line in "${df_array[@]:1}"; do for df_line in "${df_array[@]:1}"; do
line_array=(${df_line}) line_array=(${df_line})
@ -5064,14 +5062,11 @@ def get_proc(sorting='cpu lazy', tree=False, prog_len=0, arg_len=0, search='', r
print(f"{'Pid:':>7} {'Program:':<{prog_len}}", f"{'Arguments:':<{arg_len-4}}" if arg_len else '', f"{'Threads:' if arg_len else ' Tr:'} {'User:':<9}Mem%{'Cpu%':>11}", sep='') print(f"{'Pid:':>7} {'Program:':<{prog_len}}", f"{'Arguments:':<{arg_len-4}}" if arg_len else '', f"{'Threads:' if arg_len else ' Tr:'} {'User:':<9}Mem%{'Cpu%':>11}", sep='')
for p in sorted(psutil.process_iter(['pid', 'name', 'cmdline', 'num_threads', 'username', 'memory_percent', 'cpu_percent', 'cpu_times', 'create_time'], err), key=lambda p: eval(sort_cmd), reverse=reverse): for p in sorted(psutil.process_iter(['pid', 'name', 'cmdline', 'num_threads', 'username', 'memory_percent', 'cpu_percent', 'cpu_times', 'create_time'], err), key=lambda p: eval(sort_cmd), reverse=reverse):
if p.info['name'] == 'idle' or p.info['name'] == err or p.info['pid'] == err: if p.info['name'] == 'idle':
continue continue
if p.info['cmdline'] == err: if p.info['cpu_times'] == err:
p.info['cmdline'] = ""
if p.info['username'] == err:
p.info['username'] = "?"
if p.info['num_threads'] == err:
p.info['num_threads'] = 0 p.info['num_threads'] = 0
p.info['cmdline'] = ''
if search: if search:
found = False found = False
for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]: for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]:
@ -5128,8 +5123,6 @@ def proc_tree(width: int, sorting: str = 'cpu lazy', reverse: bool = True, max_l
if getinfo and cont: if getinfo and cont:
if getinfo['cpu_times'] == err: if getinfo['cpu_times'] == err:
getinfo['num_threads'] = 0 getinfo['num_threads'] = 0
if p.info['username'] == err:
p.info['username'] = "?"
cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count()) cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count())
print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ', print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ',
f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+", f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+",

View File

@ -226,14 +226,11 @@ def get_proc(sorting='cpu lazy', tree=False, prog_len=0, arg_len=0, search='', r
print(f"{'Pid:':>7} {'Program:':<{prog_len}}", f"{'Arguments:':<{arg_len-4}}" if arg_len else '', f"{'Threads:' if arg_len else ' Tr:'} {'User:':<9}Mem%{'Cpu%':>11}", sep='') print(f"{'Pid:':>7} {'Program:':<{prog_len}}", f"{'Arguments:':<{arg_len-4}}" if arg_len else '', f"{'Threads:' if arg_len else ' Tr:'} {'User:':<9}Mem%{'Cpu%':>11}", sep='')
for p in sorted(psutil.process_iter(['pid', 'name', 'cmdline', 'num_threads', 'username', 'memory_percent', 'cpu_percent', 'cpu_times', 'create_time'], err), key=lambda p: eval(sort_cmd), reverse=reverse): for p in sorted(psutil.process_iter(['pid', 'name', 'cmdline', 'num_threads', 'username', 'memory_percent', 'cpu_percent', 'cpu_times', 'create_time'], err), key=lambda p: eval(sort_cmd), reverse=reverse):
if p.info['name'] == 'idle' or p.info['name'] == err or p.info['pid'] == err: if p.info['name'] == 'idle':
continue continue
if p.info['cmdline'] == err: if p.info['cpu_times'] == err:
p.info['cmdline'] = ""
if p.info['username'] == err:
p.info['username'] = "?"
if p.info['num_threads'] == err:
p.info['num_threads'] = 0 p.info['num_threads'] = 0
p.info['cmdline'] = ''
if search: if search:
found = False found = False
for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]: for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]:
@ -290,8 +287,6 @@ def proc_tree(width: int, sorting: str = 'cpu lazy', reverse: bool = True, max_l
if getinfo and cont: if getinfo and cont:
if getinfo['cpu_times'] == err: if getinfo['cpu_times'] == err:
getinfo['num_threads'] = 0 getinfo['num_threads'] = 0
if p.info['username'] == err:
p.info['username'] = "?"
cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count()) cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count())
print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ', print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ',
f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+", f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+",