1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/vars/durationMeasure.groovy
Marcus Holl b7468a7ae4 Step name is not a string literal anymore
Having the step name always the same like the file name, which is in turn the class name is
redundant.
2018-11-29 09:54:05 +01:00

26 lines
591 B
Groovy

import static com.sap.piper.Prerequisites.checkScript
import groovy.transform.Field
@Field STEP_NAME = getClass().getName()
def call(Map parameters = [:], body) {
def script = checkScript(this, parameters)
def measurementName = parameters.get('measurementName', 'test_duration')
//start measurement
def start = System.currentTimeMillis()
body()
//record measurement
def duration = System.currentTimeMillis() - start
if (script != null)
script.commonPipelineEnvironment.setPipelineMeasurement(measurementName, duration)
return duration
}