Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1338 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  UNIX: comment importer dans 1 fichier le temps d'exec d'un code?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

UNIX: comment importer dans 1 fichier le temps d'exec d'un code?

n°726016
cassiopee3​1
Posté le 14-05-2004 à 13:59:30  profilanswer
 

c encore moi!!
 
j'aimerai stocker dans un fichier le temps d'execution de mon code a chaque que celui ci est lance. normalement, pour avoir le temps CPU, on tape la commande suivante:
 
$time ./monprogramme  
 
et le shell affiche les temps CPU.
 
Pour recuperer ces temps dans un fichier tempsCPU.dat, j'ai fait:
 
$time ./monprogramme > tempsCPU.dat
 
mais ca ne marche pas, il n'ecrit rien dans mon fichiuer.
Comment faire?
 
merci beaucoup  :jap:

mood
Publicité
Posté le 14-05-2004 à 13:59:30  profilanswer
 

n°726031
gfive
Posté le 14-05-2004 à 14:06:14  profilanswer
 

Help de Toulousain! :D
 
time -o fichier command
 
man time :  
 
NAME
     time - time command execution
 
SYNOPSIS
     time [-alp] [-o file] command
 
DESCRIPTION
     The time utility executes and times command by initiating a timer and
     passing the command to the shell.  After the command finishes, time
     writes to the standard error stream, (in seconds): the total time
     elapsed, the time used to execute the command process and the time con-
     sumed by system overhead.
 
     Available options:
 
     -a      If the -o flag is used, append to the specified file rather than
             overwriting it. Otherwise, this option has no effect.
 
     -l      The contents of the rusage structure are printed as well.
 
     -o file
             Write the output to file instead of stderr.  If file exists and
             the -a flag is not specified, the file will be overwritten.
 
     -p      Makes time output POSIX.2 compliant (each time is printed on its
             own line).
 
     Most shells (including csh(1))  have their own and syntactically differ-
     ent builtin version of time. The command described here is available as
     /usr/bin/time to users of those shells.
 
DIAGNOSTICS
     If command could be timed successfully, its exit status is returned. In
     case command terminated abnormally, a warning message is output to
     stderr.  If the command was found but could not be run, the exit status
     is 126.  If no command could be found at all, the exit status is 127.  If
     time encounters any other error, the exit status is between 1 and 125 in-
     cluded.
 
SEE ALSO
     csh(1),  getrusage(2),  wait(2)

n°726100
cassiopee3​1
Posté le 14-05-2004 à 14:37:29  profilanswer
 

le probleme, c que l'option -o n'est reconnu. quand je l'utilise, le shell dit qu'il ne trouve pas la commande -o .
Doit y avoir une astuce, non?
 
l'autre toulousaine :-D

n°726101
Moktar1er
No one replies...
Posté le 14-05-2004 à 14:38:01  profilanswer
 

quand tu tapes "man time" il te dit quoi?

n°726103
cassiopee3​1
Posté le 14-05-2004 à 14:39:23  profilanswer
 

il me dit que les options comme -o sont valable dans la version GNU de la commande time

n°726107
cassiopee3​1
Posté le 14-05-2004 à 14:41:01  profilanswer
 

je ne dois pas avoir acces aux options GNU alors?

n°726109
Moktar1er
No one replies...
Posté le 14-05-2004 à 14:41:56  profilanswer
 

ya pas de raisons [:spamafote]
quand tu tapes à la main dans le shell il dit quoi?
si tu fais par exemple:
time -o time.txt ls

n°726111
gfive
Posté le 14-05-2004 à 14:42:19  profilanswer
 

aEt si tu fait : /usr/bin/time -o machin commande, ça marche pas?

n°726114
gfive
Posté le 14-05-2004 à 14:43:07  profilanswer
 

En fait, j'ai relu le man :  
 
Most shells (including csh(1))  have their own and syntactically different builtin version of time. The command described here is available as /usr/bin/time to users of those shells.

n°726116
Moktar1er
No one replies...
Posté le 14-05-2004 à 14:43:38  profilanswer
 

mais quelle idée d'utiliser csh aussi :D

mood
Publicité
Posté le 14-05-2004 à 14:43:38  profilanswer
 

n°726121
cassiopee3​1
Posté le 14-05-2004 à 14:45:19  profilanswer
 

waouwwwww, ca marche gfive!!  
merci aussi a toi moktar!
merci merci merciiii

n°726127
cassiopee3​1
Posté le 14-05-2004 à 14:47:41  profilanswer
 

en fait j'utilise perl mais je voulais essayer sur d'autres trucs mais comme j'y connais rien.... :D  
 
merci encore les gars :bounce:

n°726128
gfive
Posté le 14-05-2004 à 14:47:57  profilanswer
 

;) De rien!
Ca sera une bière au Bar Basque! :D:D
Nan, spas vrai! :p

n°726129
gfive
Posté le 14-05-2004 à 14:48:28  profilanswer
 

Perl, c'est bien! Tu saurais pas par hasard, comment changer l'encodage d'une chaîne, avec Perl??? :)

n°726131
cassiopee3​1
Posté le 14-05-2004 à 14:51:04  profilanswer
 

:sweat:  
alors la je peux pas t'aider, j'ia decouvert Perl au  jourd'hui :D
 

n°726134
gfive
Posté le 14-05-2004 à 14:52:17  profilanswer
 

zut....enfin, si t'as besoin d'aide en perl, à part pour changer l'encodage, bien sûr, je commence à maitriser! :)

n°726159
cassiopee3​1
Posté le 14-05-2004 à 15:01:17  profilanswer
 

merci  :hello:

n°726179
rhumz
Posté le 14-05-2004 à 15:08:06  profilanswer
 

peut etre aussi que tu peut rediriger la sortie standart avec >>monfichier.txt  
(note : j'en ai aucune idee)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  UNIX: comment importer dans 1 fichier le temps d'exec d'un code?

 

Sujets relatifs
Lire les attributs d'archivage d'un fichierRecherche code pour trier
Recherche code pour trier[php] Upload fichier [Résolu]
[shell ou Perl] Parser un fichier et le modifierArborescence de fichier et checkbox
lister le dernier fichier d'un répertoirepb avec code
Raccourci fichier.....Valider un fichier xml avec une dtd
Plus de sujets relatifs à : UNIX: comment importer dans 1 fichier le temps d'exec d'un code?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR