ComposantsComponents

ComposantsComponents › Logs & ErreursLogs & Errors

tChronometerStop

tChronometerStop

Logs & ErreursLogs & Errors

Calcule le temps écoulé depuis le début du job, ou depuis un tChronometerStart, l'affiche dans la console et le range dans une variable globale. Il sert à savoir combien de temps prend un job ou l'une de ses étapes.Computes the time elapsed since the beginning of the job, or since a tChronometerStart, displays it in the console and stores it in a global variable. It is used to know how long a job or one of its steps takes.

EntréeInput

Aucun flux. Un déclencheur, ou rien : il peut commencer un sous-job.No flow. A trigger, or nothing: it can start a subjob.

SortieOutput

Aucun flux. La durée est dans la console et dans les variables globales.No flow. The duration is in the console and in the global variables.

DéclencheursTriggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run ifOn Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Durée du jobDuration of the job

row1 (Main)OnSubjobOktFileInputDelimited_1…tChronometerStop_1

Réglage par défaut, Depuis le début : placé en fin de job, il affiche le temps écoulé depuis le lancement, sans tChronometerStart.Default setting, Since the beginning: placed at the end of the job, it displays the time elapsed since the start, without a tChronometerStart.

Durée d'une étapeDuration of a step

OnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStop_1

Depuis un tChronometerStart : le temps écoulé depuis le départ choisi dans la liste.Since a tChronometerStart: the time elapsed since the start chosen in the list.

  1. Déposez le tChronometerStop depuis la famille Logs & Erreurs et reliez-le par un déclencheur après ce qui est mesuré.Drop the tChronometerStop from the Logs & Errors family and connect it with a trigger after what is timed.
  2. Choisissez le point de départ : le début du job, ou un tChronometerStart.Choose the starting point: the beginning of the job, or a tChronometerStart.
  3. Écrivez une Légende pour reconnaître la ligne dans la console, ou lisez la durée dans la variable DURATION.Write a Caption to recognise the line in the console, or read the duration from the DURATION variable.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés propres.Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own.

ParamètreSettingDéfautDefaultVisibleShownDescription
Depuis le débutSince the beginningSINCE_BEGINNINGOuiYesToujoursAlwaysMesure depuis le début de l'exécution du job : l'instant, noté par le job lui-même, juste avant son premier sous-job. Le démarrage de Java n'est pas compté. Groupe Options Depuis ; exclusif avec le choix suivant.Measures since the beginning of the run of the job: the instant, recorded by the job itself, just before its first subjob. The start of Java is not counted. Since options group; exclusive with the next choice.
Depuis un tChronometerStartSince a tChronometerStartSINCE_STARTERNonNoToujoursAlwaysMesure depuis l'heure notée par un tChronometerStart.Measures since the time recorded by a tChronometerStart.
(liste sans libellé)(list without a label)STARTER——Depuis un tChronometerStart choisiSince a tChronometerStart chosenLe tChronometerStart de référence, parmi ceux du job. Il doit s'être exécuté avant (voir Pièges).The reference tChronometerStart, among those of the job. It must have run before (see Pitfalls).
Afficher la durée dans la consoleDisplay duration in consoleDISPLAYOuiYesToujoursAlwaysÉcrit une ligne dans la console. Décochée, rien n'est affiché ; les variables globales sont quand même remplies.Writes a line to the console. Unticked, nothing is displayed; the global variables are still filled.
Afficher le nom des composantsDisplay component nameDISPLAY_COMPONENT_NAMEOuiYesAfficher la durée dans la console cochéeDisplay duration in console tickedCommence la ligne par le nom du composant entre crochets : [ tChronometerStop_1 ].Starts the line with the name of the component in brackets: [ tChronometerStop_1 ].
LégendeCaptionCAPTION""""Afficher la durée dans la console cochéeDisplay duration in console tickedTexte écrit avant la durée, expression Java : "Load:", ou un texte calculé avec des variables. Ne le laissez pas vide : gardez au moins "".Text written before the duration, Java expression: "Load:", or a text computed from variables. Do not leave it empty: keep at least "".
Afficher la durée au format lisible par l'humainDisplay human readable durationDISPLAY_READABLE_DURATIONNonNoAfficher la durée dans la console cochéeDisplay duration in console tickedAjoute la durée en secondes entières avant la légende : 1seconds. La durée en millisecondes reste affichée.Adds the duration in whole seconds before the caption: 1seconds. The duration in milliseconds is still displayed.

La ligne affichéeThe displayed line

Dans l'ordre : le nom du composant, la durée lisible, la légende, puis la durée en millisecondes. Le code généré, toutes options cochées :In order: the name of the component, the readable duration, the caption, then the duration in milliseconds. The generated code, all options ticked:

System.out.print("[ tChronometerStop_1 ]  ");
System.out.print("   " + timetChronometerStop_1/1000 + "seconds   ");
System.out.println("Pause of one second:" + "  " + timetChronometerStop_1
    + " milliseconds");

Les espaces sont fixés par le modèle. Si le job a ses journaux log4j activés, les mêmes informations sont aussi écrites dans le journal, au niveau INFO (lu dans le modèle, non exécuté pour cette page).The spaces are fixed by the template. If the job has its log4j logs enabled, the same information is also written to the log, at INFO level (read in the template, not run for this page).

Variables globalesGlobal variables

STOPTIME Long
Heure de déclenchement : l'instant où le composant s'est exécuté, en millisecondes depuis le 1er janvier 1970 (UTC).Triggered time: the instant the component ran, in milliseconds since January 1st, 1970 (UTC).
DURATION Long
Durée totale mesurée, en millisecondes.Total duration measured, in milliseconds.
((Long) globalMap.get("tChronometerStop_1_DURATION"))
// Run if: more than one minute
((Long) globalMap.get("tChronometerStop_1_DURATION")) > 60000L

Disponibles dès que le composant a tourné, que la durée soit affichée ou non.Available as soon as the component has run, whether the duration is displayed or not.

ExemplesExamples

Sorties copiées telles quelles depuis une exécution des jobs (Java 21, Windows). Les durées, les dates et les identifiants d'exécution changent à chaque lancement : vous n'obtiendrez pas les mêmes valeurs.Outputs copied as is from a run of the jobs (Java 21, Windows). Durations, dates and run identifiers change at every run: you will not get the same values.

Sauf mention contraire, le job est celui-ci ; le tSleep attend une seconde et le tJava affiche les trois variables globales (STARTTIME du départ, STOPTIME et DURATION de l'arrêt).Unless stated otherwise, the job is this one; the tSleep waits one second and the tJava prints the three global variables (STARTTIME of the start, STOPTIME and DURATION of the stop).

OnSubjobOkOnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStop_1tJava_1

Réglages par défautDefault settings

Depuis le début, nom du composant affiché, légende "".Since the beginning, component name displayed, caption "".

[ tChronometerStop_1 ]    1008 milliseconds
STARTTIME = 1795008626446
STOPTIME  = 1795008627454
DURATION  = 1008

Ici le job ne fait rien avant le tChronometerStart : la durée depuis le début est celle de la pause.Here the job does nothing before the tChronometerStart: the duration since the beginning is that of the pause.

Légende et durée lisibleCaption and readable duration

Depuis un tChronometerStart ; Légende : "Pause of one second:" ; durée au format lisible cochée.Since a tChronometerStart; Caption: "Pause of one second:"; human readable duration ticked.

[ tChronometerStop_1 ]     1seconds   Pause of one second:  1011 milliseconds
STARTTIME = 1795008633960
STOPTIME  = 1795008634971
DURATION  = 1011

Sans le nom du composantWithout the component name

Afficher le nom des composants décochée ; Légende : "Elapsed:".Display component name unticked; Caption: "Elapsed:".

Elapsed:  1001 milliseconds
STARTTIME = 1795008637718
STOPTIME  = 1795008638719
DURATION  = 1001

Sans affichageWithout display

Afficher la durée dans la console décochée : seules les lignes du tJava paraissent.Display duration in console unticked: only the lines of the tJava appear.

STARTTIME = 1795008641579
STOPTIME  = 1795008642587
DURATION  = 1008

Trois mesures dans un jobThree measures in a job

OnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStart_2tSleep_2tChronometerStop_1tChronometerStop_2tChronometerStop_3

Liens On Subjob Ok ; pauses de 1 s puis 2 s. tChronometerStop_1 depuis tChronometerStart_2, tChronometerStop_2 depuis tChronometerStart_1, tChronometerStop_3 Depuis le début.On Subjob Ok links; pauses of 1 s then 2 s. tChronometerStop_1 since tChronometerStart_2, tChronometerStop_2 since tChronometerStart_1, tChronometerStop_3 Since the beginning.

[ tChronometerStop_1 ]  Step 2:  2001 milliseconds
[ tChronometerStop_2 ]  Steps 1 and 2:  3013 milliseconds
[ tChronometerStop_3 ]  Whole job:  3013 milliseconds

Dans une boucleIn a loop

OnSubjobOkIterateOnComponentOktChronometerStart_1tLoop_1tSleep_1tChronometerStop_1

tLoop de 1 à 3. Légende calculée :tLoop from 1 to 3. Computed Caption:

"Iteration " + ((Integer) globalMap.get("tLoop_1_CURRENT_VALUE")) + ":"
[ tChronometerStop_1 ]  Iteration 1:  1004 milliseconds
[ tChronometerStop_1 ]  Iteration 2:  2005 milliseconds
[ tChronometerStop_1 ]  Iteration 3:  3005 milliseconds

Le composant s'exécute à chaque itération et mesure toujours depuis le même départ : les durées se cumulent.The component runs at every iteration and always measures since the same start: the durations add up.

PiègesPitfalls

Aucun départ choisi, ou départ non exécutéNo start chosen, or start that did not run

Depuis un tChronometerStart coché, liste laissée vide (trace abrégée) :Since a tChronometerStart ticked, list left empty (shortened trace):

Exception in component tChronometerStop_1 (JOB_DocLC_Chrono_F_starter_vide)
java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.Map.get(Object)" is null
	at demo.job_doclc_chrono_f_starter_vide_0_1.JOB_DocLC_Chrono_F_starter_vide.tChronometerStop_1Process(JOB_DocLC_Chrono_F_starter_vide.java:808)
	…

Le job s'arrête avec le code 1. L'heure du départ est lue dans les variables du job : elle manque aussi quand le tChronometerStart choisi ne s'est pas encore exécuté, ou a été supprimé du job.The job stops with code 1. The time of the start is read from the variables of the job: it is also missing when the chosen tChronometerStart has not run yet, or was deleted from the job.

Légende videEmpty caption

Champ Légende entièrement effacé, guillemets compris. Message de compilation :Caption field entirely erased, quotes included. Compilation message:

JOB_DocLC_Chrono_G_legende_vide.java:812: error: bad operand type String for unary operator '+'
	  	System.out.println( + "  " + timetChronometerStop_1 + " milliseconds");
	  	                    ^
1 error

La légende est recopiée telle quelle dans le code. Pour ne rien écrire, laissez "".The caption is copied as is into the code. To write nothing, leave "".

« Lisible » : des secondes entières"Readable": whole seconds

Le format lisible est la durée divisée par 1000, sans décimale ni conversion en minutes, collée au mot seconds. Un départ et un arrêt qui se suivent, format lisible coché :The readable format is the duration divided by 1000, with no decimals and no conversion to minutes, stuck to the word seconds. A start and a stop one after the other, readable format ticked:

[ tChronometerStop_1 ]     0seconds     0 milliseconds

Le début du job, pas celui de JavaThe beginning of the job, not of Java

Depuis le début part de l'instant où le job commence son premier sous-job. Un tChronometerStop seul dans un job, suivi d'un tJava qui affiche DURATION :Since the beginning starts from the instant the job begins its first subjob. A tChronometerStop alone in a job, followed by a tJava that prints DURATION:

[ tChronometerStop_1 ]    0 milliseconds
DURATION = 0

Le temps de démarrage de la machine virtuelle Java n'est pas dans la mesure.The start-up time of the Java virtual machine is not in the measure.

Il n'arrête rienIt stops nothing

Malgré son nom, le composant ne clôt pas la mesure : le départ garde son heure. Plusieurs tChronometerStop peuvent mesurer depuis le même départ, et le même tChronometerStop peut tourner plusieurs fois.Despite its name, the component does not close the measure: the start keeps its time. Several tChronometerStop can measure since the same start, and the same tChronometerStop can run several times.

Pas dans un fluxNot in a flow

Aucun lien Main ni Iterate, en entrée comme en sortie : il se relie par des déclencheurs. Après un flux, utilisez On Subjob Ok ou On Component Ok.No Main or Iterate link, as input or as output: it is connected with triggers. After a flow, use On Subjob Ok or On Component Ok.

ConseilsTips

Une légende par mesureOne caption per measure

Avec plusieurs mesures, la légende dit ce qui est mesuré ; le nom du composant, lui, ne dit rien à qui lit la console. Terminez-la par :, le modèle ajoute deux espaces avant la durée.With several measures, the caption says what is timed; the name of the component says nothing to whoever reads the console. End it with :, the template adds two spaces before the duration.

Alerter sur une duréeAlert on a duration

Un Run if sur DURATION peut mener à un tWarn ou un tDie quand une étape dépasse le temps attendu.A Run if on DURATION can lead to a tWarn or a tDie when a step exceeds the expected time.

Suivre toutes les duréesTrack all durations

Pour la durée de chaque composant sans poser de chronomètres, cochez leur case tStatCatcher Statistics et lisez-les avec un tStatCatcher.For the duration of each component without placing chronometers, tick their tStatCatcher Statistics box and read them with a tStatCatcher.

Sans consoleWithout a console

Sur un serveur, décochez l'affichage et écrivez DURATION là où elle sera lue : fichier, table, message.On a server, untick the display and write DURATION where it will be read: file, table, message.

Voir aussiSee also