1 | package net.bmahe.genetics4j.gpu.opencl; | |
2 | ||
3 | import org.apache.commons.lang3.StringUtils; | |
4 | import org.apache.commons.lang3.Validate; | |
5 | import org.apache.logging.log4j.LogManager; | |
6 | import org.apache.logging.log4j.Logger; | |
7 | import org.jocl.CL; | |
8 | import org.jocl.cl_platform_id; | |
9 | ||
10 | import net.bmahe.genetics4j.gpu.opencl.model.Platform; | |
11 | import net.bmahe.genetics4j.gpu.opencl.model.PlatformProfile; | |
12 | ||
13 | public class PlatformReader { | |
14 | public static final Logger logger = LogManager.getLogger(PlatformReader.class); | |
15 | ||
16 | public static final String PROFILE_FULL_STR = "FULL_PROFILE"; | |
17 | public static final String PROFILE_EMBEDDED = "EMBEDDED_PROFILE"; | |
18 | ||
19 | public Platform read(final cl_platform_id platformId) { | |
20 | Validate.notNull(platformId); | |
21 | ||
22 |
1
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::builder → NO_COVERAGE |
final var platformBuilder = Platform.builder(); |
23 | ||
24 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::platformId with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::platformId → NO_COVERAGE |
platformBuilder.platformId(platformId); |
25 | ||
26 |
2
1. read : Substituted 2306 with 2307 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::getStringParameter → NO_COVERAGE |
final String platformName = PlatformUtils.getStringParameter(platformId, CL.CL_PLATFORM_NAME); |
27 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::name → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::name with receiver → NO_COVERAGE |
platformBuilder.name(platformName); |
28 | ||
29 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::getStringParameter → NO_COVERAGE 2. read : Substituted 2307 with 2308 → NO_COVERAGE |
final String platformVendor = PlatformUtils.getStringParameter(platformId, CL.CL_PLATFORM_VENDOR); |
30 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::vendor → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::vendor with receiver → NO_COVERAGE |
platformBuilder.vendor(platformVendor); |
31 | ||
32 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::getStringParameter → NO_COVERAGE 2. read : Substituted 2305 with 2306 → NO_COVERAGE |
final String platformVersion = PlatformUtils.getStringParameter(platformId, CL.CL_PLATFORM_VERSION); |
33 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::version → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::version with receiver → NO_COVERAGE |
platformBuilder.version(platformVersion); |
34 | ||
35 |
2
1. read : Substituted 2308 with 2309 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::getStringParameter → NO_COVERAGE |
final String platformExtensions = PlatformUtils.getStringParameter(platformId, CL.CL_PLATFORM_EXTENSIONS); |
36 |
4
1. read : removed conditional - replaced equality check with false → NO_COVERAGE 2. read : removed call to org/apache/commons/lang3/StringUtils::isNotBlank → NO_COVERAGE 3. read : removed conditional - replaced equality check with true → NO_COVERAGE 4. read : negated conditional → NO_COVERAGE |
if (StringUtils.isNotBlank(platformExtensions)) { |
37 |
1
1. read : removed call to java/lang/String::split → NO_COVERAGE |
final String[] platformExtensionsArr = platformExtensions.split(StringUtils.SPACE); |
38 |
4
1. read : removed conditional - replaced comparison check with false → NO_COVERAGE 2. read : removed conditional - replaced comparison check with true → NO_COVERAGE 3. read : negated conditional → NO_COVERAGE 4. read : changed conditional boundary → NO_COVERAGE |
if (platformExtensionsArr.length > 0) { |
39 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::addExtensions with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::addExtensions → NO_COVERAGE |
platformBuilder.addExtensions(platformExtensionsArr); |
40 | } | |
41 | } | |
42 | ||
43 |
2
1. read : Substituted 2304 with 2305 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::getStringParameter → NO_COVERAGE |
final String platformProfileStr = PlatformUtils.getStringParameter(platformId, CL.CL_PLATFORM_PROFILE); |
44 |
3
1. read : RemoveSwitch 1 (case value 1) → NO_COVERAGE 2. read : RemoveSwitch 0 (case value 0) → NO_COVERAGE 3. read : Changed switch default to be first case → NO_COVERAGE |
final var platformProfile = switch (platformProfileStr) { |
45 | case PROFILE_FULL_STR -> PlatformProfile.FULL_PROFILE; | |
46 | case PROFILE_EMBEDDED -> PlatformProfile.FULL_PROFILE; | |
47 |
1
1. read : removed call to java/lang/IllegalArgumentException::<init> → NO_COVERAGE |
default -> throw new IllegalArgumentException("Unexpected value: " + platformProfileStr); |
48 | }; | |
49 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::profile → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::profile with receiver → NO_COVERAGE |
platformBuilder.profile(platformProfile); |
50 | ||
51 |
1
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::numDevices → NO_COVERAGE |
final int numDevices = PlatformUtils.numDevices(platformId); |
52 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::numDevices → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::numDevices with receiver → NO_COVERAGE |
platformBuilder.numDevices(numDevices); |
53 | ||
54 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutablePlatform$Builder::build → NO_COVERAGE 2. read : replaced return value with null for net/bmahe/genetics4j/gpu/opencl/PlatformReader::read → NO_COVERAGE |
return platformBuilder.build(); |
55 | } | |
56 | } | |
Mutations | ||
22 |
1.1 |
|
24 |
1.1 2.2 |
|
26 |
1.1 2.2 |
|
27 |
1.1 2.2 |
|
29 |
1.1 2.2 |
|
30 |
1.1 2.2 |
|
32 |
1.1 2.2 |
|
33 |
1.1 2.2 |
|
35 |
1.1 2.2 |
|
36 |
1.1 2.2 3.3 4.4 |
|
37 |
1.1 |
|
38 |
1.1 2.2 3.3 4.4 |
|
39 |
1.1 2.2 |
|
43 |
1.1 2.2 |
|
44 |
1.1 2.2 3.3 |
|
47 |
1.1 |
|
49 |
1.1 2.2 |
|
51 |
1.1 |
|
52 |
1.1 2.2 |
|
54 |
1.1 2.2 |