From ab560ba51cde157788dcdfb5c97de66e32b98ce2 Mon Sep 17 00:00:00 2001 From: Jim DeFabia Date: Tue, 26 Sep 2023 16:18:17 -0400 Subject: [PATCH] HPCC-29907 Document TIME attribute Signed-off-by: Jim DeFabia --- .../ECLR_mods/BltInFunc-IMPORT.xml | 31 +++++++++----- .../ExtrSvcs-ExternalServicesImpl.xml | 15 +++++++ .../ECLR_mods/ExtrSvcs-SERVICEStructure.xml | 22 ++++++++-- .../ECLR_mods/SpecStruc-EMBED.xml | 41 +++++++++++++++---- 4 files changed, 89 insertions(+), 20 deletions(-) diff --git a/docs/EN_US/ECLLanguageReference/ECLR_mods/BltInFunc-IMPORT.xml b/docs/EN_US/ECLLanguageReference/ECLR_mods/BltInFunc-IMPORT.xml index af2ab7431a8..b69ce609dd9 100644 --- a/docs/EN_US/ECLLanguageReference/ECLR_mods/BltInFunc-IMPORT.xml +++ b/docs/EN_US/ECLLanguageReference/ECLR_mods/BltInFunc-IMPORT.xml @@ -6,10 +6,10 @@ resulttype funcname ( parameterlist ) := IMPORT( - IMPORT function - language, function ); + role="bold">) := IMPORT( language, function + [:TIME + [(label)] ]); @@ -55,6 +55,20 @@ A string constant containing the name of the function to include. + + + TIME + + Tracks timing of an external function call or embedded source + code and reports them back as metrics to the user. + + + + label + + Optional. A string constant containing the name to associate + with the timer. If omitted, the default is used. + @@ -72,12 +86,9 @@ Example: - IMPORT Python3 AS Python; -// This example illustrates scalar parameters and resuls -integer add1(integer val) := EMBED(Python) - val+1 -ENDEMBED; -add1(27); //returns 28 + IMPORT JAVA; +INTEGER jadd(INTEGER a, INTEGER b) := IMPORT(java, 'JavaCat.add:(II)I': TIME('MyTime')); +jadd (22,23); See Also: IMPORT, Internal use, only. Indicates the function is actually a method of the internal code context. + + + TIME + + Tracks timing of the external function call and reports + them back as metrics to the user. + + + + label + + Optional. A string constant containing the name to + associate with the timer. If omitted, the default is + used. + diff --git a/docs/EN_US/ECLLanguageReference/ECLR_mods/ExtrSvcs-SERVICEStructure.xml b/docs/EN_US/ECLLanguageReference/ECLR_mods/ExtrSvcs-SERVICEStructure.xml index 6bb841b8784..9e3a7cde238 100644 --- a/docs/EN_US/ECLLanguageReference/ECLR_mods/ExtrSvcs-SERVICEStructure.xml +++ b/docs/EN_US/ECLLanguageReference/ECLR_mods/ExtrSvcs-SERVICEStructure.xml @@ -8,7 +8,8 @@ servicename := SERVICE [ : defaultkeywords - ] + [,TIME[(label)]]] prototype : keywordlist; @@ -37,6 +38,20 @@ service. + + TIME + + Tracks timing of all function calls in the SERVICE + structure and reports them back as metrics to the user. + + + + label + + Optional. A string constant containing the name to + associate with the timer. If omitted, the default is used. + + prototype @@ -62,7 +77,7 @@ Example: - email := SERVICE + email := SERVICE :TIME('MyTime') simpleSend( STRING address, STRING template, STRING subject) : LIBRARY='ecl2cw', @@ -122,5 +137,6 @@ END; - See Also: External Service Implementation, CONST + See Also: External + Service Implementation, CONST diff --git a/docs/EN_US/ECLLanguageReference/ECLR_mods/SpecStruc-EMBED.xml b/docs/EN_US/ECLLanguageReference/ECLR_mods/SpecStruc-EMBED.xml index 5f9d3315f3b..d8cd2c06551 100644 --- a/docs/EN_US/ECLLanguageReference/ECLR_mods/SpecStruc-EMBED.xml +++ b/docs/EN_US/ECLLanguageReference/ECLR_mods/SpecStruc-EMBED.xml @@ -11,18 +11,24 @@ role="bold">) := EMBED( EMBED language ) + role="bold">[:TIME [(label)]] - code + code ENDEMBED ENDEMBED ; + + resulttype funcname ( parameterlist ) := EMBED( language, code - ); + [: TIME + [(label)]]); + + @@ -66,6 +72,20 @@ The source code to embed. + + + TIME + + Tracks timing of an external function call or embedded source + code and reports them back as metrics to the user. + + + + label + + Optional. A string constant containing the name to associate + with the timer. If omitted, the default is used. + @@ -104,21 +124,28 @@ ENDEMBED corruption and/or security issues, so great care and forethought are advised--consult with Technical Support before using. - Example: + Examples: //First form: a structure IMPORT Python3 AS Python; //make Python language available -INTEGER addone(INTEGER p) := EMBED(Python) +INTEGER addone(INTEGER p) := EMBED(Python :TIME('MyTime')) # Python code that returns one more than the value passed to it if p < 10: return p+1 else: return 0 ENDEMBED; +addone(3); +addone(11); + + + -//Second form: a function -INTEGER addtwo(INTEGER p) := EMBED(Python, 'p+2'); + //Second form: a function +IMPORT Python3 as Python; +INTEGER addtwo(INTEGER p) := EMBED(Python, 'p+2' : TIME('MyTime')); +addtwo(27); See Also: BEGINC++ Structure, IMPORT,