
我想使用 python 建立一個與 ubuntu 中的 gnome-system-monitor 非常相似的系統監視器。
我已經使用了 GUI 的快速應用程序,現在我想顯示系統監視器所示的 cpu 歷史記錄,我想知道在哪裡可以獲取系統監視器的源代碼以及如何在我的應用程式中使用它。
答案1
可以透過開啟終端機並輸入以下命令來取得系統監視器的原始碼:
apt-get source gnome-system-monitor
不幸的是它是用 C 編寫的。
答案2
CPUMeter screenlet 是一個很好的參考。不過,您必須處理保存資料的問題。
sudo apt-get install screenlets-pack-all
在我的系統上它位於這裡:
/usr/share/screenlets/screenlets-pack-all/CPUMeter/CPUMeterScreenlet.py
12.04 測試