View previous topic :: View next topic |
Author |
Message |
kNemo Tux's lil' helper
Joined: 03 Jun 2004 Posts: 116
|
Posted: Fri Jul 02, 2004 7:42 pm Post subject: [Shell Script] Visualizzare Occupazione CPU ??? |
|
|
Qualcuno saprebbe fare uno script di Shell che visualizzi l'occupazione della CPU ???
io avevo pensato di fare una cosa di questo tipo
top | grep CPU(s)*,
ma non funziona...
Qualcuno a qualche idea ??? _________________ Powered by:
Gentoo Base System version 1.4.16 (Kernel 2.4.26-gentoo-r9)
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r1, 2.4.26-gentoo-r9)
ScreenShot
http://gendevel.altervista.org/home.php?s=oth&p=screensht
Last edited by kNemo on Fri Jul 02, 2004 7:48 pm; edited 1 time in total |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31292 Location: here
|
Posted: Fri Jul 02, 2004 7:47 pm Post subject: |
|
|
E prendere qualche programma tipo gdesklet o wmcpuload,... per vederla? _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
kNemo Tux's lil' helper
Joined: 03 Jun 2004 Posts: 116
|
Posted: Fri Jul 02, 2004 7:51 pm Post subject: |
|
|
no...
mi serve per la scuola... _________________ Powered by:
Gentoo Base System version 1.4.16 (Kernel 2.4.26-gentoo-r9)
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r1, 2.4.26-gentoo-r9)
ScreenShot
http://gendevel.altervista.org/home.php?s=oth&p=screensht |
|
Back to top |
|
|
kNemo Tux's lil' helper
Joined: 03 Jun 2004 Posts: 116
|
Posted: Fri Jul 02, 2004 8:10 pm Post subject: |
|
|
Mi andebbe bene anche uno script in Python... _________________ Powered by:
Gentoo Base System version 1.4.16 (Kernel 2.4.26-gentoo-r9)
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r1, 2.4.26-gentoo-r9)
ScreenShot
http://gendevel.altervista.org/home.php?s=oth&p=screensht |
|
Back to top |
|
|
ema Guru
Joined: 27 Aug 2003 Posts: 380
|
Posted: Sat Jul 03, 2004 4:30 pm Post subject: |
|
|
/geekmode on
io ho fatto assieme a un amico una cosa di sto tipo: lui ha fatto un programmino in C che prende l'uso della cpu dal sistema e lo redirige verso la porta parallela, con un valore tra 0 e 255... da li un d/a converter che ho fatto io fa visualizzare il carico di sistema su uno strumento a lancetta
vinceremo l'oscar dell'inutility? lol
/geekmode off |
|
Back to top |
|
|
FonderiaDigitale Veteran
Joined: 06 Nov 2003 Posts: 1710 Location: Rome, Italy
|
Posted: Sat Jul 03, 2004 5:16 pm Post subject: |
|
|
uno script shell per definizione e' qualcosa che da un output univoco e unico, mente la cpu SECERNE () un valore che e' molto incostante nel tempo...sei sicuro che cosi serva a qualcosa? _________________ Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica
|
|
Back to top |
|
|
Cazzantonio Bodhisattva
Joined: 20 Mar 2004 Posts: 4514 Location: Somewere around the world
|
Posted: Sat Jul 03, 2004 6:00 pm Post subject: |
|
|
A me
Code: | ale@casa01 ale $ top |grep Cpu
Cpu(s): 5.5% us, 3.3% sy, 0.9% ni, 88.2% id, 2.0% wa, 0.0% hi, 0.0% si
Cpu(s): 3.0% us, 0.7% sy, 0.0% ni, 96.3% id, 0.0% wa, 0.0% hi, 0.0% si
Cpu(s): 3.3% us, 1.0% sy, 0.0% ni, 95.4% id, 0.3% wa, 0.0% hi, 0.0% si
Cpu(s): 7.7% us, 1.7% sy, 0.0% ni, 90.3% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 7.0% us, 1.7% sy, 0.3% ni, 91.0% id, 0.0% wa, 0.0% hi, 0.0% si
Cpu(s): 26.8% us, 4.0% sy, 0.0% ni, 68.9% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 17.5% us, 2.3% sy, 0.3% ni, 79.5% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 17.1% us, 3.0% sy, 0.3% ni, 63.9% id, 15.4% wa, 0.3% hi, 0.0% si
..... continua
|
funziona perfettamente...
Forse semplicemente lo scrivevi tutto maiuscolo....
Code: | ale@casa01 ale $ top |grep CPU
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND |
e ti dava questo come output _________________ Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne |
|
Back to top |
|
|
Cazzantonio Bodhisattva
Joined: 20 Mar 2004 Posts: 4514 Location: Somewere around the world
|
Posted: Sat Jul 03, 2004 6:05 pm Post subject: |
|
|
Cazzantonio wrote: | A me
Code: | ale@casa01 ale $ top |grep Cpu
Cpu(s): 5.5% us, 3.3% sy, 0.9% ni, 88.2% id, 2.0% wa, 0.0% hi, 0.0% si
Cpu(s): 3.0% us, 0.7% sy, 0.0% ni, 96.3% id, 0.0% wa, 0.0% hi, 0.0% si
Cpu(s): 3.3% us, 1.0% sy, 0.0% ni, 95.4% id, 0.3% wa, 0.0% hi, 0.0% si
Cpu(s): 7.7% us, 1.7% sy, 0.0% ni, 90.3% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 7.0% us, 1.7% sy, 0.3% ni, 91.0% id, 0.0% wa, 0.0% hi, 0.0% si
Cpu(s): 26.8% us, 4.0% sy, 0.0% ni, 68.9% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 17.5% us, 2.3% sy, 0.3% ni, 79.5% id, 0.0% wa, 0.3% hi, 0.0% si
Cpu(s): 17.1% us, 3.0% sy, 0.3% ni, 63.9% id, 15.4% wa, 0.3% hi, 0.0% si
..... continua
|
funziona perfettamente...
Forse semplicemente lo scrivevi tutto maiuscolo....
Code: | ale@casa01 ale $ top |grep CPU
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND |
e ti dava questo come output |
P.S.
Comunque complimenti a ema per il bellissimo oggetto mi viene voglia di farlo anche a me _________________ Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne |
|
Back to top |
|
|
kNemo Tux's lil' helper
Joined: 03 Jun 2004 Posts: 116
|
Posted: Sat Jul 03, 2004 6:07 pm Post subject: |
|
|
A me' serve uno script Shell o Python per visualizzare l'occupazione della CPU...
Di piu' non so' dire...
PS: Con Cpu "minuscolo" funziona...
Grazie. _________________ Powered by:
Gentoo Base System version 1.4.16 (Kernel 2.4.26-gentoo-r9)
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r1, 2.4.26-gentoo-r9)
ScreenShot
http://gendevel.altervista.org/home.php?s=oth&p=screensht |
|
Back to top |
|
|
xchris Advocate
Joined: 10 Jul 2003 Posts: 2824
|
Posted: Sat Jul 03, 2004 6:23 pm Post subject: |
|
|
il modo migliore cmq per intercettarlo e' usare top in batch mode
Code: |
top -b -n 1 | grep Cpu
|
ciao _________________ while True:Gentoo() |
|
Back to top |
|
|
kNemo Tux's lil' helper
Joined: 03 Jun 2004 Posts: 116
|
Posted: Sat Jul 03, 2004 6:28 pm Post subject: |
|
|
top -b -n 1 | grep Cpu | cut -d ' ' -f -3 _________________ Powered by:
Gentoo Base System version 1.4.16 (Kernel 2.4.26-gentoo-r9)
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r1, 2.4.26-gentoo-r9)
ScreenShot
http://gendevel.altervista.org/home.php?s=oth&p=screensht |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31292 Location: here
|
Posted: Sat Jul 03, 2004 7:03 pm Post subject: |
|
|
Ecco lo script (si poteva fare meglio)
Code: | #!/bin/sh
while [ 1 ]; do
CPU=`top -b -n 2 -d 0.3 | grep Cpu | tail -n 1 | head -c 13 | tail -c 5`
clear
echo -n -e "\033[1;1H $CPU"
done
|
_________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
lucapost Veteran
Joined: 24 Nov 2005 Posts: 1419 Location: <ud|me|ts> - Italy
|
Posted: Sat Sep 22, 2007 12:49 pm Post subject: |
|
|
Si puo leggere da qualche parte in /proc/qualcosa l'utilizzo delle cpu?
mi serve per fare uno scriptino... _________________ LP |
|
Back to top |
|
|
cloc3 Advocate
Joined: 13 Jan 2004 Posts: 4808 Location: http://www.gentoo-users.org/user/cloc3/
|
Posted: Sat Sep 22, 2007 1:01 pm Post subject: |
|
|
lucapost wrote: | Si puo leggere da qualche parte in /proc/qualcosa l'utilizzo delle cpu?
mi serve per fare uno scriptino... |
vedi `man proc` per approfondimenti. _________________ vu vu vu
gentù
mi piaci tu |
|
Back to top |
|
|
lucapost Veteran
Joined: 24 Nov 2005 Posts: 1419 Location: <ud|me|ts> - Italy
|
Posted: Sat Sep 22, 2007 1:19 pm Post subject: |
|
|
ottimo! _________________ LP |
|
Back to top |
|
|
lavish Bodhisattva
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Sat Sep 22, 2007 3:25 pm Post subject: |
|
|
Spostato da Forum italiano (Italian) a Forum di discussione italiano.
@lucapost: lasciami indovinare... status di dwm? _________________ minimalblue.com | secgroup.github.io/ |
|
Back to top |
|
|
lucapost Veteran
Joined: 24 Nov 2005 Posts: 1419 Location: <ud|me|ts> - Italy
|
Posted: Sat Sep 22, 2007 5:50 pm Post subject: |
|
|
per provar a capire che valori devo considerare ho provato a leggere il man, ma ahimè non ci ho captio molto...
poi ho trovato questo: http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-rg-it-4/s1-proc-topfiles.html, ci ho capito ancora meno!
che rapporto devo considerare per vedere il carico percentuale su ogni cpu?
Quote: | @lucapost: lasciami indovinare... status di dwm?
|
_________________ LP |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|