Codebase list bashtop / 9f8df6b
New upstream version 0.9.25 Dylan Aïssi 3 years ago
5 changed file(s) with 52 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
2626 - Bashtop version:
2727 - (Linux) Linux distribution and version:
2828 - (Linux) Data collection type (/proc or psutil):
29 - Psutil version: `python3 -c "import psutil; print(psutil.version_info)"` (version 5.7.0 or above is required):
2930 - (OSX/FreeBSD) Os release version:
3031 - Terminal used:
3132 - Font used:
32 - Bash version, "bash --version" (version 4.4 or above is required):
33 - Locales: output of "locale -v"
33 - Bash version, `bash --version` (version 4.4 or above is required):
34 - Locales: output of `locale -v`
3435
3536 **Additional context**
3637
00 # Changelog
1
2 ## v0.9.25
3
4 * Fixed: Crash when using "/proc" data collection and filesystem type is 9p, by @bolapara
5
6 ## v0.9.24
7
8 * Fixed: Psutil script crash on OSX
9 * Fixed: Error handling for malformed osx-cpu-temp output
10
11 ## v0.9.23
12
13 * Fixed: kill/terminate/interrupt process not working in OsX and FreeBSD
114
215 ## v0.9.22
316
1919 * [Themes](#themes)
2020 * [Upcoming](#upcoming) (Python port)
2121 * [Support and funding](#support-and-funding)
22 * [Compatibility](#compatibility) (OSX and FreeBSD Support)
22 * [Prerequisites](#prerequisites)
2323 * [Dependencies](#dependencies)
2424 * [Screenshots](#screenshots)
2525 * [Installation](#installation)
6666
6767 ## Upcoming
6868
69 ~~Currently rewriting to use python3 [psutil](https://github.com/giampaolo/psutil) for data collection instead of linux specific tools.
70 This will add python 3 and psutil as dependencies, but will make bashtop cross platform compatible.~~
71
72 ~~This will be integrated in to main version when done and add the possibility to switch between psutil and linux tools for users running linux.~~
73
74 Bashtop is now Mac OS X and FreeBSD compatible!
75
7669 #### Python port: bpytop
7770
7871 Currently working full time on this during my vacation :)
9386
9487 Any support is greatly appreciated!
9588
96 ## Compatibility
97
98 Should work on most modern linux distributions, on Mac OS X and on FreeBSD.
99
100 Will not display correctly on the standard terminal on OSX!
89 ## Prerequisites
90
91 #### Mac Os X
92
93 Will not display correctly in the standard terminal!
10194 Recommended alternative [iTerm2](https://www.iterm2.com/)
10295
103 Will also need to be run as superuser on OSX to display stats for processes not owned by user.
104
105 The disk io stats on OSX and FreeBSD shows iostats for all disks at the top instead of per disk.
96 Will also need to be run as superuser to display stats for processes not owned by user.
97
98 #### Linux, Mac Os X and FreeBSD
10699
107100 For correct display, a terminal with support for:
108101
109 * 24-bit truecolor
110 * Wide characters
102 * 24-bit truecolor ([See list of terminals with truecolor support](https://gist.github.com/XVilka/8346728))
103 * Wide characters (Are sometimes problematic in web-based terminals)
111104
112105 Also needs a UTF8 locale and a font that covers:
113106
383376 - [ ] Add gpu temp and usage. (If feasible)
384377 - [x] Add io stats for disks.
385378 - [ ] Add cpu and mem stats for docker containers. (If feasible)
386 - [ ] Change process list to line scroll instead of page change.
387 - [ ] Add option for custom color gradient in process list in theme settings.
379 - [x] Change process list to line scroll instead of page change.
388380 - [ ] Add optional window for tailing log files.
389381 - [ ] Add options for resizing all boxes.
390382 - [ ] Add command line argument parsing.
9292 "██╔══██╗██╔══██║╚════██║██╔══██║ ██║ ██║ ██║██╔═══╝ "
9393 "██████╔╝██║ ██║███████║██║ ██║ ██║ ╚██████╔╝██║ "
9494 "╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ")
95 declare version="0.9.22"
95 declare version="0.9.25"
9696
9797 #* Get latest version of BashTOP from https://github.com/aristocratos/bashtop
9898
21282128 #* Get CPU package temp for Rapberry Pi cpus and for OSX
21292129 elif [[ $sensor_comm != "sensors" && -n ${misc_var} ]]; then
21302130 cpu[temp_0]="${misc_var#temp=}"
2131 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
2132 cpu[temp_high]="75"; cpu[temp_crit]=$((cpu[temp_high]+10))
2131 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
2132 if [[ -z ${cpu[temp_high]} ]]; then
2133 cpu[temp_high]="75"; cpu[temp_crit]=$((cpu[temp_high]+10))
2134 fi
21332135
21342136 #* Copy cpu temp to cores
21352137 for((i=1;i<=threads;i++)); do
22322234 if ! py_command -a df_array "get_disks(exclude='squashfs'${filtering})"; then psutil_disk_fail=1; psutil_on="false"; fi
22332235 fi
22342236 if [[ $psutil_on == false ]]; then
2235 readarray -t df_array < <(${df} -x squashfs -x tmpfs -x devtmpfs -x overlay 2>/dev/null || true)
2237 readarray -t df_array < <(${df} -x squashfs -x tmpfs -x devtmpfs -x overlay -x 9p 2>/dev/null || true)
22362238 fi
22372239 for df_line in "${df_array[@]:1}"; do
22382240 line_array=(${df_line})
42314233 local kill_op="$1" kill_pid="$2" killer_out killer_box col line program keypress selected selected_int=0 sig confirmed=0 option killer_pause status msg
42324234 local -a options=("yes" "no")
42334235
4234 if ! program="$(ps -o comm --no-header -p ${kill_pid})"; then return; fi
4236 if ! program="$(ps -o comm -p ${kill_pid})"; then return
4237 else program="$(tail -n1 <<<"$program")"; fi
42354238
42364239 case $kill_op in
42374240 t|T) kill_op="terminate"; sig="SIGTERM" ;;
50605063 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='')
50615064
50625065 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):
5063 if p.info['name'] == 'idle':
5066 if p.info['name'] == 'idle' or p.info['name'] == err or p.info['pid'] == err:
50645067 continue
5065 if p.info['cpu_times'] == err:
5068 if p.info['cmdline'] == err:
5069 p.info['cmdline'] = ""
5070 if p.info['username'] == err:
5071 p.info['username'] = "?"
5072 if p.info['num_threads'] == err:
50665073 p.info['num_threads'] = 0
5067 p.info['cmdline'] = ''
50685074 if search:
50695075 found = False
50705076 for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]:
51215127 if getinfo and cont:
51225128 if getinfo['cpu_times'] == err:
51235129 getinfo['num_threads'] = 0
5130 if p.info['username'] == err:
5131 p.info['username'] = "?"
51245132 cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count())
51255133 print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ',
51265134 f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+",
225225 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='')
226226
227227 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):
228 if p.info['name'] == 'idle':
228 if p.info['name'] == 'idle' or p.info['name'] == err or p.info['pid'] == err:
229229 continue
230 if p.info['cpu_times'] == err:
230 if p.info['cmdline'] == err:
231 p.info['cmdline'] = ""
232 if p.info['username'] == err:
233 p.info['username'] = "?"
234 if p.info['num_threads'] == err:
231235 p.info['num_threads'] = 0
232 p.info['cmdline'] = ''
233236 if search:
234237 found = False
235238 for value in [ p.info['name'], ' '.join(p.info['cmdline']), str(p.info['pid']), p.info['username'] ]:
286289 if getinfo and cont:
287290 if getinfo['cpu_times'] == err:
288291 getinfo['num_threads'] = 0
292 if p.info['username'] == err:
293 p.info['username'] = "?"
289294 cpu = getinfo['cpu_percent'] if proc_per_cpu else (getinfo['cpu_percent'] / psutil.cpu_count())
290295 print(f"{getinfo['num_threads']:>4} " if getinfo['num_threads'] < 1000 else '999> ',
291296 f"{getinfo['username']:<9.9}" if len(getinfo['username']) < 10 else f"{getinfo['username'][:8]:<8}+",