|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
39 | 39 | import java.util.ArrayList;
|
40 | 40 | import java.util.List;
|
41 | 41 |
|
| 42 | +import static compiler.lib.ir_framework.TestFramework.PRINT_RULE_MATCHING_TIME; |
| 43 | + |
42 | 44 | /**
|
43 | 45 | * This class represents a {@link Test @Test} annotated method that has an associated non-empty list of applicable
|
44 | 46 | * {@link IR @IR} rules.
|
@@ -83,6 +85,20 @@ public String name() {
|
83 | 85 | */
|
84 | 86 | @Override
|
85 | 87 | public MatchResult match() {
|
86 |
| - return new IRMethodMatchResult(method, matcher.match()); |
| 88 | + if (!PRINT_RULE_MATCHING_TIME) { |
| 89 | + return new IRMethodMatchResult(method, matcher.match()); |
| 90 | + } |
| 91 | + |
| 92 | + List<MatchResult> match; |
| 93 | + for (int i = 0; i < 10; i++) { // warm up |
| 94 | + match = matcher.match(); |
| 95 | + } |
| 96 | + |
| 97 | + long startTime = System.nanoTime(); |
| 98 | + match = matcher.match(); |
| 99 | + long endTime = System.nanoTime(); |
| 100 | + long duration = (endTime - startTime); |
| 101 | + System.out.println("Verifying IR rules for " + name() + ": " + duration + " ns = " + (duration / 1000000) + " ms"); |
| 102 | + return new IRMethodMatchResult(method, match); |
87 | 103 | }
|
88 | 104 | }
|
0 commit comments