Jump to content

[Réglé]info script Perl


Recommended Posts

Posted

Je me pose une petite question, comment peut-on voir si un script est lourd ou non? Genre, comment après exécution du script, voir le % du cpu, le poids en ram bref toutes les infos permettant de l'optimiser.

Je demande ça du fait qu'il y a parfois une panoplie de méthodes pour faire la même chose.

Merci beaucoup :)

Posted

Bonjour,

Pour l'occupation en Ram et le taux d'occupation du cpu

Peut etre en t'aidant de la commande top voir d'un logiciel annexe genre gkrellm mais là je ne sais pas coment recuperer l'info dans un fichier....

Tiens au courant

++

Posted

Déjà fait le man, juste après la réponse de gauret.

Voilà ce que j'obtiens par exemple:

saintshakajin@ubuntu:~ $ time mozilla-firefox

real    0m0.931s

user    0m0.166s

sys    0m0.110s

Or sur ma mandrake qui est sur un autre pc, là, j'ai le % et tout et tout

Posted

/usr/bin/time -v <commande>

ou

#apt-cache show memprof
Package: memprof
.../...
Description: Memory profiler and leak detector
Memprof is a tool for profiling memory usage and detecting memory
leaks. It can be used with existing binaries without need for
recompilation.

Posted

Quelqu'un peut m'expliquer ça :

[18:06][root@fermat]#which time
[18:06][root@fermat]#locate time | grep bin
/usr/bin/uptime
/usr/sbin/ntptime
/usr/sbin/vcstime
[18:07][root@fermat]#time which time

real    0m0.005s
user    0m0.003s
sys     0m0.002s
[18:07][root@fermat]#apt-get install time
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
 time
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/32.1kB of archives.
After unpacking 147kB of additional disk space will be used.
Selecting previously deselected package time.
(Reading database ... 20399 files and directories currently installed.)
Unpacking time (from .../archives/time_1.7-19_i386.deb) ...
Setting up time (1.7-19) ...

[18:07][root@fermat]#which time
/usr/bin/time
[18:07][root@fermat]#

En gros j'ai pas installé le package time, mais j'ai quand même la possibilité de faire un time, mais ça ne correspond à aucun binaire :transpi:

EDIT : maintenant que je l'ai installé, j'ai ça aussi :

theo@fermat:~$ time -V
bash: -V: command not found

real    0m0.001s
user    0m0.000s
sys     0m0.001s
theo@fermat:~$ /usr/bin/time -V
GNU time 1.7

:p

Posted

merci Sandeman, c'est pile-poil ce qu'il me fallait.

Edit:

tu as la même chose que moi, pour ça que j'avais reposté... et je comrpends toujours pas pourquoi quand on ne met pas le chemin complet ça foire

Posted

EDIT : maintenant que je l'ai installé, j'ai ça aussi :

theo@fermat:~$ time -V
bash: -V: command not found

real    0m0.001s
user    0m0.000s
sys     0m0.001s
theo@fermat:~$ /usr/bin/time -V
GNU time 1.7

:transpi:

j'ai effectivité été assez perturbé par ça aussi, mais :

quand tu lance "time -V", bash passe -V comme paramètre à la commande time, qui ne trouve pas

quand tu lance "/usr/bin/time -V" je pense que bash n'interfère pas ...

Posted

Ahhhh. Exact.

Je comprend un peu mieux maintenant.

C'est logique quand tu le dis :transpi:

Enfin d'après le man bash et le man time, j'ai l'impression que le time est beaucoup plus léger.

Mais c'est vrai que on ne lui demande pas grand chose non plus :roll:

:incline: Tuxxx pour la réponde :roll:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...