Table of Contents
1. やりたいこと
- CPU, memory, diskの利用状況を逐次モニターできる環境にしたい
- process単位でのCPU, memory利用状況を確認できるようにしたい
- リソースの利用状況に合わせてprocess操作(
kill
コマンド)が可能なモニターが欲しい
実行環境
実行環境
項目 | |
---|---|
マシン | HP ENVY TE01-0xxx |
OS | ubuntu 20.04 LTS Focal Fossa |
CPU | Intel Core i7-9700 CPU 3.00 GHz |
RAM | 32.0 GB |
GPU | NVIDIA GeForce RTX 2060 SUPER |
1
2
3
4
5
6
% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
2. リソースモニターとしてのBPYTOP
Features
- Terminal Appの一種
- レイアウトの操作がキーボードでもマウスで実行可能
- processのソートがcpu usage, memory usage, pidなどでsort可能
- processの検索が
f + <search word>
で実行可能(キャンセルしたい場合はesc
) - process単位の詳細情報(tree情報, プログラムファイルetc)が確認可能
- process単位のkill, Terminate, Interrupt操作がマウスで実行可能
- network usage情報が確認可能
欠点
- CPU usageの時系列line plotが確認可能だが, x軸のtickが存在しない
Remarks
- GitHub repositoryはpoetryでパッケージ管理されている
3. Installation
PyPiは本人がメンテしているけれども, メンテしなくなった時ちょっと怖いので Manual installation を今回は実施
Dependencies
- Python3
- git
- psutil(python module)
Install
1
2
3
git clone https://github.com/aristocratos/bpytop.git
cd bpytop
sudo make install
Uninstall
1
2
cd bpytop
sudo make uninstall
4. Terminatorでの表示設定
完成図
設定
- Terminatorを起動する
Preference > Layout
で画面分割レイアウトを設定- 上記で設定したLayoutの
Custom command
にsource ~/.zshrc && bpytop
と設定 - (任意) Ubuntuの
Startup Application Preference
でterminator -l <Layout name>
と設定
Appendix: ネットワークインターフェース
BPYTOPではネットワーク使用情報が確認できますが, どのネットワークインターフェース名がなにを表しているか理解する事が必要です.
ネットワークインターフェースの命名規則
種別 | 説明 | 例 |
---|---|---|
en |
イーサネット(有線LAN) | enp2s0 |
wl |
無線LAN | wlp3s0 |
ww |
無線WAN |
デバイス | 説明 |
---|---|
オンボードデバイス | o<インデックス>インデックス> |
ホットプラグデバイス | s<スロット>スロット> |
PCIデバイス | p<バス>s<スロット>スロット>バス> |
ネットワークインターフェースの一覧の確認は, 次のコマンドで可能です
1
2
% ls /sys/class/net
enp2s0@ lo@ wlp3s0@
Appendix: シェルスクリプトの&&
の意味
基本ルール
1
2
3
% command1; command2 #command1が成功/異常終了にかかわらず, 終了後command2を実行
% command1 && command2 #command1が成功したらcommand2を実行
% command1 || command2 #command1が異常終了したらcommand2を実行
三項演算
1
2
3
4
5
6
7
8
9
10
11
12
13
% true && true || echo "Command Failed"
% true && false || echo "Command Failed"
Command Failed
% false && true || echo "Command Failed"
Command Failed
% false && false || echo "Command Failed"
Command Failed
% true || echo "foo" && echo "boo"
boo
% false || echo "foo" && echo "boo"
foo
boo
References
BPYTOP
&& in a shell command
統計
Python
math
Linux
Ubuntu 20.04 LTS
Shell
English
git
Ubuntu 22.04 LTS
方法論
統計検定
競技プログラミング
フーリエ解析
前処理
SQL
coding
将棋
Data visualization
Network
statistical inference
VSCode
apt
システム管理
Coffee
Docker
Econometrics
GitHub Pages
cloud
数値計算
素数
Book
Font
Metrics
Poetry
architecture
aws
shell
ssh
systemctl
テンプレート
データ構造
ポワソン分布
会計分析
文字コード
環境構築
論文
App
Bayesian
Dynamic Programming
Keyboard
Processing
R
Steam
filesystem
regex
(注意:GitHub Accountが必要となります)