Dans un article précédant on a utilisé timeNow() pour connaitre le temps d'exécution d'un code X++ (ici).
Dans cette article j'ai voulu partager avec vous une autre alternative en utilisant la fameuse méthode StopWatch() du Framwork .Net (2.0) a travers un code X++
on crée un JOB :
static void DJO_tempsExecution(Args _args)
{
int64 time;
int64 i,j;
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
;
stopWatch.Start();
//un simple teste.. une boucle qui consomme du temps pour rien :
for (i = 1 ; i <= 4000000; i++)
{
j=j+i;
}
stopWatch.Stop();
time = stopWatch.get_ElapsedMilliseconds();
info(strFmt("le temps total consommé est %1 milliseconde", time));
}
Après exécution le résultat sera :
et voila
Aucun commentaire:
Enregistrer un commentaire