From 6fd087f90ad06fb634ac1343f6a4b7d4ce548d40 Mon Sep 17 00:00:00 2001 From: CoreRasurae <luis.p.mendes@gmail.com> Date: Sat, 21 Apr 2018 21:03:23 +0100 Subject: [PATCH] Fix and Update: Fix issue #62 and provide new API for kernel profiling under multithreading (refs #62) - minor code quality fixes 2 --- .../java/com/aparapi/runtime/ProfileReportNewAPITest.java | 5 ++--- .../java/com/aparapi/runtime/ProfileReportUnitTest.java | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/aparapi/runtime/ProfileReportNewAPITest.java b/src/test/java/com/aparapi/runtime/ProfileReportNewAPITest.java index cf8f7cf3..35dabade 100644 --- a/src/test/java/com/aparapi/runtime/ProfileReportNewAPITest.java +++ b/src/test/java/com/aparapi/runtime/ProfileReportNewAPITest.java @@ -225,7 +225,6 @@ public class ProfileReportNewAPITest { } private class ThreadResults { - private long startOfExecution; private long runTime; private long threadId; private int kernelCalls; @@ -248,7 +247,7 @@ public class ProfileReportNewAPITest { int id = atomicResultId.getAndIncrement(); results[id].threadId = Thread.currentThread().getId(); observer.addAcceptedThreadId(results[id].threadId); - results[id].startOfExecution = System.currentTimeMillis(); + long startOfExecution = System.currentTimeMillis(); results[id].kernelCalls = 0; for (int i = 0; i < runs; i++) { results[id].outputArray = Arrays.copyOf(inputArray, inputArray.length); @@ -256,7 +255,7 @@ public class ProfileReportNewAPITest { k.execute(Range.create(device, size, size)); results[id].kernelCalls++; } - results[id].runTime = System.currentTimeMillis() - results[id].startOfExecution; + results[id].runTime = System.currentTimeMillis() - startOfExecution; results[id].accumulatedExecutionTime = k.getAccumulatedExecutionTimeCurrentThread(device); } })); diff --git a/src/test/java/com/aparapi/runtime/ProfileReportUnitTest.java b/src/test/java/com/aparapi/runtime/ProfileReportUnitTest.java index f63c0fac..8e9a297f 100644 --- a/src/test/java/com/aparapi/runtime/ProfileReportUnitTest.java +++ b/src/test/java/com/aparapi/runtime/ProfileReportUnitTest.java @@ -15,7 +15,11 @@ */ package com.aparapi.runtime; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.lang.ref.WeakReference; import java.util.Arrays; @@ -27,7 +31,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; -import org.junit.runners.model.TestTimedOutException; import com.aparapi.IProfileReportObserver; import com.aparapi.Kernel; -- GitLab