ComposantsComponents

ComposantsComponents › Logs & ErreursLogs & Errors

tChronometerStart

tChronometerStart

Logs & ErreursLogs & Errors

Note l'heure à laquelle il s'exécute. Un tChronometerStop placé plus loin calcule et affiche le temps écoulé depuis ce départ. Il sert à mesurer une étape précise d'un job : un sous-job, une suite de sous-jobs, le corps d'une boucle.Records the time at which it runs. A tChronometerStop placed further on computes and displays the time elapsed since this start. It is used to time a precise step of a job: a subjob, a series of subjobs, the body of a loop.

EntréeInput

Aucun flux. Un déclencheur, ou rien : il peut commencer le job.No flow. A trigger, or nothing: it can start the job.

SortieOutput

Aucun flux : ni Main ni Iterate. L'heure est dans une variable globale.No flow: neither Main nor Iterate. The time is in a global variable.

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

Mesurer une étapeTime a step

OnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStop_1

Le départ est noté avant l'étape, l'arrêt l'affiche après. Dans le tChronometerStop, choisissez Depuis un tChronometerStart et ce composant dans la liste.The start is recorded before the step, the stop displays it after. In the tChronometerStop, choose Since a tChronometerStart and this component in the list.

Mesurer un fluxTime a flow

OnSubjobOkrow1 (Main)OnSubjobOktChronometerStart_1tFixedFlowInput_1tLogRow_1tChronometerStop_1

Le composant n'accepte aucun lien de flux : il se place avant le sous-job à mesurer, et le tChronometerStop après, par des déclencheurs.The component accepts no flow link: it goes before the subjob to time, and the tChronometerStop after, through triggers.

  1. Déposez le tChronometerStart depuis la famille Logs & Erreurs de la palette. Il n'a rien à régler.Drop the tChronometerStart from the Logs & Errors family of the palette. It has nothing to set.
  2. Reliez-le par un déclencheur (On Subjob Ok le plus souvent) à ce qui doit être mesuré.Connect it with a trigger (most often On Subjob Ok) to what must be timed.
  3. Après le traitement, placez un tChronometerStop qui pointe sur ce départ.After the processing, place a tChronometerStop that points to this start.

Paramètres et variable globaleSettings and global variable

Aucun paramètreNo setting

L'onglet Composant est vide. Le fichier du composant (tChronometerStart_java.xml) déclare bien un paramètre CAPTION, mais il est masqué (SHOW="false") et le modèle ne le lit pas.The Component tab is empty. The component file (tChronometerStart_java.xml) does declare a CAPTION parameter, but it is hidden (SHOW="false") and the template does not read it.

Tout le composant tient en une ligne : il lit l'horloge de la machine (System.currentTimeMillis()) et range la valeur dans les variables du job.The whole component is one line: it reads the clock of the machine (System.currentTimeMillis()) and stores the value in the variables of the job.

Variable globaleGlobal variable

STARTTIME Long
Heure de début : l'instant où le composant s'est exécuté, en millisecondes depuis le 1er janvier 1970 (UTC). Disponible dès que le composant a tourné.Start Time: the instant the component ran, in milliseconds since January 1st, 1970 (UTC). Available as soon as the component has run.
((Long) globalMap.get("tChronometerStart_1_STARTTIME"))
// as a date
new java.util.Date((Long) globalMap.get("tChronometerStart_1_STARTTIME"))

La même valeur est aussi rangée sous le nom du composant seul (globalMap.get("tChronometerStart_1")) : c'est celle que lit le tChronometerStop.The same value is also stored under the name of the component alone (globalMap.get("tChronometerStart_1")): this is the one the tChronometerStop reads.

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.

Une pause d'une secondeA one-second pause

OnSubjobOkOnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStop_1tJava_1

tSleep : 1 seconde. tChronometerStop : Depuis un tChronometerStart, tChronometerStart_1. Le tJava affiche les variables :tSleep: 1 second. tChronometerStop: Since a tChronometerStart, tChronometerStart_1. The tJava prints the variables:

System.out.println("STARTTIME = " + globalMap.get("tChronometerStart_1_STARTTIME"));
System.out.println("STOPTIME  = " + globalMap.get("tChronometerStop_1_STOPTIME"));
System.out.println("DURATION  = " + globalMap.get("tChronometerStop_1_DURATION"));
[ tChronometerStop_1 ]    1006 milliseconds
STARTTIME = 1795008630214
STOPTIME  = 1795008631220
DURATION  = 1006

DURATION est bien l'écart entre les deux heures : 1795008631220 − 1795008630214 = 1006.DURATION is indeed the gap between the two times: 1795008631220 − 1795008630214 = 1006.

Deux départs dans un jobTwo starts in a job

OnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOkOnSubjobOktChronometerStart_1tSleep_1tChronometerStart_2tSleep_2tChronometerStop_1tChronometerStop_2tChronometerStop_3

Tous les liens sont des On Subjob Ok. tSleep_1 : 1 s, tSleep_2 : 2 s. tChronometerStop_1 mesure depuis tChronometerStart_2, tChronometerStop_2 depuis tChronometerStart_1, tChronometerStop_3 Depuis le début ; chacun a sa Légende.All links are On Subjob Ok. tSleep_1: 1 s, tSleep_2: 2 s. tChronometerStop_1 measures since tChronometerStart_2, tChronometerStop_2 since tChronometerStart_1, tChronometerStop_3 Since the beginning; each one has its Caption.

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

Chaque départ garde sa propre heure : plusieurs mesures peuvent se chevaucher.Each start keeps its own time: several measures can overlap.

Autour d'un fluxAround a flow

OnSubjobOkrow1 (Main)OnSubjobOktChronometerStart_1tFixedFlowInput_1tLogRow_1tChronometerStop_1

Cinq lignes affichées en tableau ; Légende du tChronometerStop : "Rows displayed in".Five rows displayed as a table; Caption of the tChronometerStop: "Rows displayed in".

.--+------.
|tLogRow_1|
|=-+-----=|
|id|city  |
|=-+-----=|
|1 |Paris |
|2 |Lyon  |
|3 |Lille |
|4 |Nantes|
|5 |Brest |
'--+------'

[ tChronometerStop_1 ]  Rows displayed in  4 milliseconds

Dans une boucleIn a loop

OnSubjobOkIterateOnComponentOktChronometerStart_1tLoop_1tSleep_1tChronometerStop_1

tLoop de 1 à 3, pause d'une seconde. Le départ est hors de la boucle : chaque arrêt mesure depuis ce même départ.tLoop from 1 to 3, one-second pause. The start is outside the loop: each stop measures since that same start.

[ tChronometerStop_1 ]  Iteration 1:  1004 milliseconds
[ tChronometerStop_1 ]  Iteration 2:  2005 milliseconds
[ tChronometerStop_1 ]  Iteration 3:  3005 milliseconds

Les durées se cumulent. Pour la durée de chaque itération, placez le départ dans la boucle, avant le traitement.The durations add up. For the duration of each iteration, place the start inside the loop, before the processing.

PiègesPitfalls

Pas dans un fluxNot in a flow

Le composant refuse les liens Main et Iterate, en entrée comme en sortie. Il ne compte pas les lignes et ne peut pas se glisser entre deux composants d'un flux : il encadre un sous-job entier.The component refuses Main and Iterate links, as input and as output. It does not count rows and cannot be slipped between two components of a flow: it frames a whole subjob.

Un départ jamais exécutéA start that never ran

Si le tChronometerStop pointe sur un départ qui n'a pas tourné (branche non suivie, Run if faux), l'heure est absente et le tChronometerStop arrête le job sur une NullPointerException : voir sa page.If the tChronometerStop points to a start that did not run (branch not followed, false Run if), the time is missing and the tChronometerStop stops the job with a NullPointerException: see its page.

Exécuté deux foisRun twice

Chaque exécution du composant remplace l'heure précédente. Dans une boucle, le départ est donc remis à zéro à chaque itération.Each run of the component replaces the previous time. In a loop, the start is therefore reset at every iteration.

L'horloge de la machineThe clock of the machine

La mesure vient de l'heure du système, à la milliseconde. Un changement d'heure pendant le job (synchronisation, réglage manuel) fausse la durée.The measure comes from the system time, to the millisecond. A clock change during the job (synchronisation, manual setting) distorts the duration.

ConseilsTips

Inutile pour le job entierNot needed for the whole job

Pour la durée depuis le lancement du job, le tChronometerStop suffit, réglé sur Depuis le début : aucun départ à poser.For the duration since the job started, the tChronometerStop is enough, set to Since the beginning: no start to place.

Garder la duréeKeep the duration

La durée affichée est aussi dans la variable DURATION du tChronometerStop : un tFixedFlowInput ou un tJava peut l'écrire dans un fichier ou une table de suivi.The displayed duration is also in the DURATION variable of the tChronometerStop: a tFixedFlowInput or a tJava can write it to a file or a tracking table.

Voir aussiSee also