Macã§Screenã®ã¹ãã¼ã¿ã¹ã©ã¤ã³(hardstatus)ã«CPU使ç¨ç&温度ã¨ã¡ã¢ãªä½¿ç¨çã表示ããã
前回ã®ç¶ãã§ããçµå±ã®æã³ãã³ãã©ã¤ã³ããå種æ å ±ã表示ããããã¨ãã§ããã°backtickã使ã£ã¦ã¹ãã¼ã¿ã¹ã©ã¤ã³ã«æ å ±ã表示ã§ãã¾ãã
CPU使ç¨ç
åè
ã» cpu usage
host_processor_info()é¢æ°ã使ããã¨ã§ãã¼ãããã®User,System,Idle,Niceã®CPUããã¯æ°ãåå¾ã§ãã¾ããã¨ãããã¨ã§ããåä½æéã«ããã¦ã( User+System+Niceã®å¢å å) / ( å
¨ããã¯æ°ã®å¢å å )*100 ãæ±ããã°CPU使ç¨çãæ±ããããâ¦ã¨æãã¾ããã½ã¼ã¹ã¿ã訳ãããªãã®ã§ã¯ã£ããè¨ãã¾ãããtopãçè«çã«ã¯ãããã¦æ±ãã¦ããããã§ããã¨ããã¨ã§ä¸è¨ã®ãµã¤ãã«è¼ã£ã¦ããã³ã¼ããåèã«ãã¦ä½ã£ãã®ãããã§ãã
ã¾ã.cpu.oldããååèµ·åæã®ããã¯æ°ã®æ
å ±ãåå¾ãã¾ããããããç¾å¨ã®CPUããã¯æ°ãåå¾ãã¦ããããã®å·®ããCPU使ç¨çã表示ãã¾ããããã1ç§ããã«å®è¡ãããããã«ããã° CPU使ç¨çãã§ã¾ãã
ã¡ã¢ãªä½¿ç¨ç
åè
ã»Macのシステムコール - Christopher-727の日記
ã»http://yasu2.prosou.nu/blog/2006/04/macos-x.html
Macã®ã¡ã¢ãªã¯ç´ç²ã«ä½¿ç¨ä¸oré使ç¨ä¸ã¨åãããã訳ã§ã¯ãªããWired,Acgtive,Inavtive,Freeã®4ã¤ã«åãããã¾ããããã«é¢ãã¦ã¯このページãåãããããã¨æãã¾ããã¾ãããããã訳ãªãã§ããã¨ããããWiredã¨Activeãå©ç¨ãã¦ããå²åãã¡ã¢ãªä½¿ç¨çã¨ãã¦è¡¨ç¤ºãããã¨ã«ãã¾ãããä¸è¨2ã¤ã®ãµã¤ããåèã«ãã¦ä½ã£ãã®ãããã§ãã
CPU温度
åè
ã»Temperature in Terminal | MacRumors Forums
ã»Temperature Monitor: Description
CPU温度ã®åå¾æ¹æ³ãè¦ã¤ããã®ãä¸çªè¦å´ãã¾ãããæ¤ç´¢ãã¦ãppcãªãè¦ã¤ããã¾ããIntelã®ããªããªãè¦ã¤ããããXRGã¨ãããªã¼ãã³ã½ã¼ã¹ã®ãªã½ã¼ã¹ã¢ãã¿ããé å¼µã£ã¦ãã®æ¹æ³ãè¦ã¤ãããã¨ãã¾ããããããªãæ«æãå°ã£ã¦ãã¾ããããæçµçã«ä¸è¨ã®Temperature Monitorã«ã³ãã³ãã©ã¤ã³ãã使ããtempmonitorãåèããã¦ãããã¨ãåããã¾ãããTemperature Monitorããã¦ã³ãã¼ãããã¨,TemperatureMonitor.app/Contents/MacOS/ ã« tempmonitor ãããã¾ããã¨ãããã¨ã§ãããbacktickã§å®æçã«å®è¡ãããã°OKâ¦ã¨ããããã¨ããã§ãããä¸ã¤åé¡ãããã¾ããããã¯ãå®è¡ã«1ç§ç¨ããã£ã¦ãã¾ããã¨ã§ã(ä½ãã¦ããã§ããããã)ãbacktickã¯ããã¯ã°ã©ã¦ã³ãã§åä½ãã訳ã§ã¯ãªãããã§ãbacktickã§ããã°ã©ã ãå®è¡ãã¦ããã¨ãscreenã¯å
¥åãåãã¤ããªããªã£ã¦ãã¾ãã¾ããããã§ã¯ä½æ¥ãã§ããªãã®ã§ã次ã®ãããªããã°ã©ã ãä½ã£ã¦ã¿ã¾ããã
ã¾ããããããããªãã·ã§ã«ã¹ã¯ãªããã§ååã§ãããã
#!/bin/sh awk '{print $1}' /Users/mfumi/.screen/.temp /Users/mfumi/.screen/tempmonitor > .temp &
.tempã¨ãããã¡ã¤ã«ããååã®æ¸©åº¦æ å ±ãèªã¿ããã§è¡¨ç¤ºããã®ãã¨ã«ããã¯ã°ã©ã¦ã³ãã§tmpmonitorãå®è¡ãã¦ãã¾ãããªã¢ã«ã¿ã¤ã ã®æ¸©åº¦ã§ã¯ãªãã§ããå®ç¨ã«ã¯ååã ã¨æãã¾ãã
----------------------------------------------------------------------------------------------
ã¨ãããã¨ã§.以ä¸ã®ã½ã¼ã¹ãã³ã³ãã¤ã«ãã¦é©å½ãªå ´æ(èªåã®å ´åã¯~/.screen)ã«ç½®ãã¾ãã.screenrcã¯ãããªæãã§ãã
hardstatus alwayslastline "%{= db} %-w%{=b dr}%n %t%{-}%+w %= [Mem:%0`%%] [CPU:%1`%% %2`C] [%3`] %y/%m/%d %c " backtick 0 10 10 $HOME/.screen/memory backtick 1 1 1 $HOME/.screen/cpu backtick 2 5 5 $HOME/.screen/temperature backtick 3 10 10 $HOME/.screen/battery.sh
å®éã®ã¨ããå¤ã®æ£ç¢ºãã¯åããã¾ããããä»ã®ãªã½ã¼ã¹ã¢ãã¿ã¨æ¯ã¹ã¦ã¿ã¦å¤§ããéã£ãå¤ã¯åºã¦ããªãã®ã§å¤§ä¸å¤«ã ã¨æãã¾ãã
(ã¨ããã§ãhardstatusã§asciiæå以å¤ã表示ããããã¨ããã¨ãã°ããã ããªãâ¦(ver4.00.03)ãä»ã¯ä¿®æ£ãããã¿ãã?)