Simplify benchmark keys

This commit is contained in:
Clément Fournier
2020-05-21 11:03:59 +02:00
parent cae73a8ac2
commit 634a349678
3 changed files with 10 additions and 11 deletions

View File

@ -13,6 +13,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.sourceforge.pmd.benchmark.TimeTracker;
import net.sourceforge.pmd.benchmark.TimedOperation;
import net.sourceforge.pmd.benchmark.TimedOperationCategory;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.rule.internal.RuleApplicator;
@ -128,7 +131,10 @@ public class RuleSets {
this.ruleApplicator = prepareApplicator();
}
ruleApplicator.index(acuList);
try (TimedOperation to = TimeTracker.startOperation(TimedOperationCategory.RULE_AST_INDEXATION)) {
ruleApplicator.index(acuList);
}
for (RuleSet ruleSet : ruleSets) {
if (ruleSet.applies(ctx.getSourceCodeFile())) {
ruleApplicator.apply(ruleSet.getRules(), ctx);

View File

@ -9,7 +9,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Collections;
import java.util.List;
import net.sourceforge.pmd.benchmark.TimeTracker;
import net.sourceforge.pmd.benchmark.TimedOperation;
@ -163,10 +162,7 @@ public class SourceCodeProcessor {
dependencyHelper.runLanguageSpecificStages(ruleSets, languageVersion, rootNode);
List<Node> acus = Collections.singletonList(rootNode);
try (TimedOperation to = TimeTracker.startOperation(TimedOperationCategory.RULE_APP)) {
ruleSets.apply(acus, ctx);
}
ruleSets.apply(Collections.singletonList(rootNode), ctx);
}

View File

@ -16,17 +16,14 @@ import org.apache.commons.lang3.StringUtils;
* @author Juan Martín Sotuyo Dodero
*/
public enum TimedOperationCategory {
/** Single rule execution. */
/** Rule execution proper. */
RULE,
RULECHAIN_RULE,
/** Aggregate category for all rule application. */
RULE_APP,
COLLECT_FILES,
LOAD_RULES,
PARSER,
/** Subdivided into one label for each stage. */
LANGUAGE_SPECIFIC_PROCESSING,
RULECHAIN_AST_INDEXATION,
RULE_AST_INDEXATION,
REPORTING,
FILE_PROCESSING,
UNACCOUNTED;