2018-09-21 16:55:31 +02:00
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
import groovy.transform.Field
|
|
|
|
|
2018-10-09 17:09:55 +02:00
|
|
|
@Field STEP_NAME = 'durationMeasure'
|
2018-09-21 16:55:31 +02:00
|
|
|
|
2018-01-24 10:55:38 +02:00
|
|
|
def call(Map parameters = [:], body) {
|
|
|
|
|
2018-09-21 16:55:31 +02:00
|
|
|
def script = checkScript(this, parameters)
|
|
|
|
|
2018-01-24 10:55:38 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|