Skip to content

Commit dba7559

Browse files
author
EvgeniiMunin
committed
check inference time
1 parent d92b48c commit dba7559

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/GreenbidsRealTimeDataProcessedAuctionRequestHook.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class GreenbidsRealTimeDataProcessedAuctionRequestHook implements Process
3838
private static final String CODE = "greenbids-real-time-data-processed-auction-request-hook";
3939
private static final String ACTIVITY = "isKeptInAuction";
4040
private static final String SUCCESS_STATUS = "success";
41-
//private static final List<Pattern> PHONE_PATTERNS =
42-
// createPatterns("Phone", "iPhone", "Android.*Mobile", "Mobile.*Android");
43-
//private static final List<Pattern> TABLET_PATTERNS =
44-
// createPatterns("tablet", "iPad", "Windows NT.*touch", "touch.*Windows NT", "Android");
45-
4641

4742
private final ObjectMapper mapper;
4843

@@ -98,13 +93,20 @@ public Future<InvocationResult<AuctionRequestPayload>> call(
9893
System.out.println();
9994
}
10095

96+
// measure inf time
97+
long startTime = System.nanoTime();
98+
10199
OrtSession.Result results;
102100
try {
103101
results = modelRunner.runModel(throttlingInferenceRow);
104102
} catch (OrtException e) {
105103
throw new RuntimeException(e);
106104
}
107105

106+
long endTime = System.nanoTime();
107+
long duration = (endTime - startTime); // in nanoseconds
108+
System.out.println("Inference time: " + duration / 1000000.0 + " ms");
109+
108110
StreamSupport.stream(results.spliterator(), false)
109111
.filter(onnxItem -> Objects.equals(onnxItem.getKey(), "probabilities"))
110112
.forEach(onnxItem -> {

0 commit comments

Comments
 (0)