Skip to content

Commit

Permalink
Minor style/formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apangin committed Oct 10, 2024
1 parent e0885e3 commit 4208d5c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 1 addition & 3 deletions test/one/profiler/test/TestProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class TestProcess implements Closeable {
public static final String PROFOUT = "%pout";
public static final String PROFERR = "%perr";

public static final String PROFILER_LIB_NAME = "libasyncProfiler";

private static final Pattern filePattern = Pattern.compile("(%[a-z]+)(\\.[a-z]+)?");

private static final MethodHandle pid = getPidHandle();
Expand Down Expand Up @@ -94,7 +92,7 @@ public Os currentOs() {
}

public String profilerLibPath() {
return "build/lib/" + PROFILER_LIB_NAME + "." + currentOs.getLibExt();
return "build/lib/libasyncProfiler." + currentOs.getLibExt();
}

private List<String> buildCommandLine(Test test, Os currentOs) {
Expand Down
6 changes: 3 additions & 3 deletions test/test/alloc/AllocTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

public class AllocTests {
Expand Down Expand Up @@ -66,9 +66,9 @@ public void objectSamplerWtihDifferentAsprofs(TestProcess p) throws Exception {
Output out = p.profile("-e alloc -d 3 -o collapsed");
// _[k] suffix in collapsed output corresponds to jdk.ObjectAllocationOutsideTLAB, which means alloc tracer is being used
assert !out.contains("_\\[k\\]"); // we are using alloc tracer instead of object sampler, should definitely not happen on first profiling call
File asprofCopy = File.createTempFile(TestProcess.PROFILER_LIB_NAME, p.currentOs().getLibExt());
File asprofCopy = File.createTempFile(new File(p.profilerLibPath()).getName(), null);
asprofCopy.deleteOnExit();
Files.copy(Path.of(p.profilerLibPath()), asprofCopy.toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.copy(Paths.get(p.profilerLibPath()), asprofCopy.toPath(), StandardCopyOption.REPLACE_EXISTING);
Output outWithCopy = p.profile(String.format("--libpath %s -e alloc -d 3 -o collapsed", asprofCopy.getAbsolutePath()));
assert !outWithCopy.contains("_\\[k\\]"); // first instance of profiler has not properly relinquished the can_generate_sampled_object_alloc_events capability.
}
Expand Down
7 changes: 4 additions & 3 deletions test/test/lock/LockTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import one.profiler.test.TestProcess;

public class LockTests {

@Test(mainClass = DatagramTest.class, debugNonSafepoints = true) // Fails on Alpine
public void datagramSocketLock(TestProcess p) throws Exception {
Output out = p.profile("-e cpu -d 3 -o collapsed --cstack dwarf");
Expand All @@ -20,9 +21,9 @@ public void datagramSocketLock(TestProcess p) throws Exception {
assert out.samples("sun/nio/ch/DatagramChannelImpl.send") > 10;
}

@Test(mainClass = RaceToLock.class, inputs = { "0" }, output = true)
@Test(mainClass = RaceToLock.class, inputs = { "10000" }, output = true)
@Test(mainClass = RaceToLock.class, inputs = { "1000000" }, output = true)
@Test(mainClass = RaceToLock.class, inputs = "0", output = true)
@Test(mainClass = RaceToLock.class, inputs = "10000", output = true)
@Test(mainClass = RaceToLock.class, inputs = "1000000", output = true)
public void raceToLocks(TestProcess p) throws Exception {
int interval = Integer.parseInt(p.inputs()[0]);

Expand Down
3 changes: 0 additions & 3 deletions test/test/lock/RaceToLock.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.LockSupport;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class RaceToLock {

private final Lock sharedLock = new ReentrantLock(true);
private final Object sharedObj = new Object();
private long sharedWaitTime = 0;

private final Random random = new Random();
Expand Down

0 comments on commit 4208d5c

Please sign in to comment.