Skip to content

Instantly share code, notes, and snippets.

@theskanthunt42
Created November 15, 2022 10:43
Show Gist options
  • Save theskanthunt42/9bb21626430d4b342be6675c6c3f3d2b to your computer and use it in GitHub Desktop.
Save theskanthunt42/9bb21626430d4b342be6675c6c3f3d2b to your computer and use it in GitHub Desktop.
Useless infomation monitor i wrote for mine Raspberry Pi 400, DON'T USE IT, i upload it just for a handy backup for my own use, and it just a waste of resources
import os
import time
import sys
def OSInfo():
carrier = dict()
carrier['up_since'] = os.popen("uptime -s").read().split("\n")[0]
carrier['uptime'] = os.popen("uptime -p").read().split("up ")[1].split("\n")[0]
carrier['hostname_v4'] = os.popen("hostname -I").read().split(" ")[0]
return carrier
def VideoCoreReadings():
carrier = dict()
carrier['vc_temp'] = os.popen("vcgencmd measure_temp").read().split("=")[1].split("\n")[0]
carrier['arm_clock'] = int(os.popen("vcgencmd measure_clock arm").read().split("=")[1].split("\n")[0]) / 1000000
carrier['core_clock'] = int(os.popen("vcgencmd measure_clock core").read().split("=")[1].split("\n")[0]) / 1000000
carrier['h264_clock'] = int(os.popen("vcgencmd measure_clock h264").read().split("=")[1].split("\n")[0]) / 1000000
carrier['core_volts'] = os.popen("vcgencmd measure_volts core").read().split("=")[1].split("\n")[0]
carrier['gpu_ram'] = os.popen("vcgencmd get_mem gpu").read().split("=")[1].split("\n")[0]
carrier['ring_osc_info'] = os.popen("vcgencmd read_ring_osc").read().split("=")[1]
return carrier
def LineUpdates(cur_time, up_since, uptime, v4, temp, arm_clk, vc_clock, volts, vram, osc):
summary = f"""
------------------General Infomations------------------
Current Time: {cur_time}
Power on Since: {up_since}
Power on For: {uptime}
IPv4 Address(if had): {v4}
RAM Allocated by GPU: {vram}
--------------------SoC Infomations--------------------
Current SoC Temperature: {temp}
SoC Package Voltage: {volts}
CPU Clock Speed: {arm_clk} MHz
VideoCore Clock Speed: {vc_clock} MHz
Ring Oscillator Readings: {osc}
"""
return summary
while True:
VCR = VideoCoreReadings()
OSI = OSInfo()
current_time = os.popen("date").read().split("\n")[0]
Finish_Line = LineUpdates(current_time, OSI['up_since'], OSI['uptime'], OSI['hostname_v4'], VCR['vc_temp'], VCR['arm_clock'], VCR['core_clock'], VCR['core_volts'], VCR['gpu_ram'], VCR['ring_osc_info'])
os.system("clear")
print(Finish_Line)
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment