Skip to content

Commit

Permalink
[Wisp] fix LoadClassInnerWispGuard and WispControlGroupCpuTest
Browse files Browse the repository at this point in the history
Summary:
- Pre-load switch table class in TimeOut::doAction
- Add warmup for WispControlGroupCpuTest

Test Plan: jtreg jdk/test/com/alibaba/wisp{,2}

Reviewed-by: zhengxiaolinX, joeylee.lz

Issue: dragonwell-project/dragonwell8#279
  • Loading branch information
yuleil committed Dec 13, 2021
1 parent a167d3b commit 2ca2ecd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/linux/classes/com/alibaba/wisp/engine/WispEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void run() {
new ConcurrentSkipListMap<>().keySet().iterator();
WispCarrier carrier = WispCarrier.current();
carrier.addTimer(System.nanoTime() + Integer.MAX_VALUE, TimeOut.Action.JDK_UNPARK);
WispCarrier.current().current.timeOut.doAction();
carrier.cancelTimer();
carrier.createResumeEntry(new WispTask(carrier, null, false, false));
// preload classes used by by constraintInResourceContainer method.
Expand Down
9 changes: 5 additions & 4 deletions test/com/alibaba/wisp2/WispControlGroupCpuTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static void main(String[] args) throws Exception {
createMethod0.setAccessible(true);
createMethod1.setAccessible(true);

taskFactory(10_000_000).call(); // warmup
Callable<Long> task0 = taskFactory(2_000_000);
Callable<Long> task1 = taskFactory(2_000_000);
Callable<Long> task2 = taskFactory(2_000_000);
Expand All @@ -65,9 +66,9 @@ public static void main(String[] args) throws Exception {
Long duration1 = future1.get();
Long duration2 = future2.get();
Long duration3 = future3.get();
double ratio = (double) duration1.longValue() / duration0.longValue();
assertLT(Math.abs(ratio - 0.5), 0.1, "deviation is out of reasonable scope");
ratio = (double) duration3.longValue() / duration2.longValue();
assertLT(Math.abs(ratio - 0.5), 0.1, "deviation is out of reasonable scope");
double ratio = (double) duration1 / duration0;
assertLT(Math.abs(ratio - 0.5), 0.1, "deviation is out of reasonable scope " + ratio);
ratio = (double) duration3 / duration2;
assertLT(Math.abs(ratio - 0.5), 0.1, "deviation is out of reasonable scope " + ratio);
}
}

0 comments on commit 2ca2ecd

Please sign in to comment.