Dataset Viewer
Auto-converted to Parquet Duplicate
proj_name
stringclasses
70 values
relative_path
stringlengths
33
332
class_name
stringlengths
1
74
func_name
stringlengths
1
119
len_input
int64
24
2.03k
len_output
int64
1
2k
total
int64
29
2.05k
func_body
stringlengths
0
7.68k
masked_class
stringlengths
52
8.68k
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/compilation/AbstractCompilationVisitable.java
AbstractCompilationVisitable
handleOther
58
39
97
if (!ignoreTags.contains(tag.getName())) { CompilationUtil.unhandledTag(this, tag); }
class AbstractCompilationVisitable implements ICompilationVisitable { protected Set<String> ignoreTags = new HashSet<>(); protected void handleOther(Tag tag) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/compilation/codecache/CodeCacheWalkerResult.java
CodeCacheWalkerResult
getEvents
352
83
435
Collections.sort(events, new Comparator<CodeCacheEvent>() { @Override public int compare(CodeCacheEvent o1, CodeCacheEvent o2) { return Long.compare(o1.getStamp(), o2.getStamp()); } }); return events;
class CodeCacheWalkerResult { private List<CodeCacheEvent> events; private long lowestAddress; private long highestAddress; public CodeCacheWalkerResult() { events = new ArrayList<>(); } public void reset() { events.clear(); lowestAddress = 0; highestAddress = 0; } public void addEvent(CodeCacheE...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/histo/CompileTimeHistoWalker.java
CompileTimeHistoWalker
visit
89
60
149
for (Compilation compilation : mm.getCompilations()) { if (!compilation.isC2N()) { histo.addValue(compilation.getCompilationDuration()); } }
class CompileTimeHistoWalker extends AbstractHistoVisitable { public CompileTimeHistoWalker(IReadOnlyJITDataModel model, long resolution) // TODO filter by compile level? { super(model, resolution); } @Override public void visit(IMetaMember mm) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/histo/Histo.java
Histo
addValue
578
190
768
long value = inValue; synchronized (values) { values.add(value); } if (resolution > 1) { value = (value / resolution) * resolution; } int newCount = 0; if (bucketMap.containsKey(value)) { newCount = bucketMap.get(value) + 1; } else { newCount = 1; } bucketMap.put(val...
class Histo { private Map<Long, Integer> bucketMap = new HashMap<>(); // lots of writes, not COWAL private List<Long> values = new ArrayList<>(); private long lastTime = 0; private int maxCount = 0; private long resolution = 1; public Histo() { } public Histo(long resolution) { this.resolution = resol...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/histo/InlineSizeHistoVisitable.java
InlineSizeHistoVisitable
processParseTag
570
570
1,140
String currentMethod = null; String holder = null; String attrInlineBytes = null; for (Tag child : parseTag.getChildren()) { String tagName = child.getName(); Map<String, String> attrs = child.getAttributes(); switch (tagName) { case TAG_METHOD: { currentMethod = attrs.get(ATTR_NAME);...
class InlineSizeHistoVisitable extends AbstractHistoVisitable { private static final Logger logger = LoggerFactory.getLogger(InlineSizeHistoVisitable.class); private Set<String> inlinedCounted = new HashSet<>(); public InlineSizeHistoVisitable(IReadOnlyJITDataModel model, long resolution) { super(model, resolut...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/histo/NativeSizeHistoWalker.java
NativeSizeHistoWalker
visit
80
69
149
for (Compilation compilation : mm.getCompilations()) { long nativeSize = compilation.getNativeSize(); if (nativeSize != 0) { histo.addValue(nativeSize); } }
class NativeSizeHistoWalker extends AbstractHistoVisitable { public NativeSizeHistoWalker(IReadOnlyJITDataModel model, long resolution) { super(model, resolution); } @Override public void visit(IMetaMember mm) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/hotthrow/HotThrowResult.java
HotThrowResult
hashCode
428
111
539
final int prime = 31; int result = 1; result = prime * result + bci; result = prime * result + ((exceptionType == null) ? 0 : exceptionType.hashCode()); result = prime * result + ((member == null) ? 0 : member.hashCode()); result = prime * result + (preallocated ? 1231 : 1237); return result;
class HotThrowResult { private IMetaMember member; private int bci; private String exceptionType; private boolean preallocated; public HotThrowResult(IMetaMember member, int bci, String exceptionType, boolean preallocated) { super(); this.member = member; this.bci = bci; this.exceptionType = exceptionTy...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/inline/HeadlessInlineVisitor.java
HeadlessInlineVisitor
printFailedList
1,597
102
1,699
for (Map.Entry<String, Map<String, InlineFailureInfo>> entry : failures.entrySet()) { out.println("=== " + entry.getKey() + " ==="); Map<String, InlineFailureInfo> members = entry.getValue(); for (InlineFailureInfo inlineFailureInfo : members.values()) { ...
class HeadlessInlineVisitor implements ITreeVisitable { private static final Logger logger = LoggerFactory.getLogger(HeadlessInlineVisitor.class); private final Map<String, Map<String, InlineFailureInfo>> failures = new HashMap<>(); private final IReadOnlyJITDataModel model; public HeadlessInlineVisit...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/intrinsic/IntrinsicFinder.java
IntrinsicFinder
visitTag
494
581
1,075
String currentMethod = null; String holder = null; List<Tag> allChildren = parseTag.getChildren(); for (Tag child : allChildren) { String tagName = child.getName(); Map<String, String> attrs = child.getAttributes(); switch (tagName) { case TAG_METHOD: { currentMethod = attrs.get(ATTR...
class IntrinsicFinder extends AbstractCompilationVisitable { private Map<String, String> result; private static final Logger logger = LoggerFactory.getLogger(IntrinsicFinder.class); public IntrinsicFinder() { ignoreTags.add(TAG_BC); ignoreTags.add(TAG_KLASS); ignoreTags.add(TAG_TYPE); ignoreTags.add(TAG_U...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/allocationcount/AllocationCountOperation.java
AllocationCountOperation
processInstructions
182
250
432
List<BytecodeInstruction> instructions = memberBytecode.getInstructions(); for (BytecodeInstruction instruction : instructions) { Opcode opcode = instruction.getOpcode(); switch (opcode) { case NEWARRAY: { List<IBytecodeParam> params = instruction.getParameters(); String type = params...
class AllocationCountOperation implements IJarScanOperation { private InstructionAllocCountMap opcodeAllocCountMap; private int limitPerAllocOpcode; public AllocationCountOperation(int limit) { opcodeAllocCountMap = new InstructionAllocCountMap(); this.limitPerAllocOpcode = limit; } @Override public Strin...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/allocationcount/InstructionAllocCountMap.java
InstructionAllocCountMap
toString
167
103
270
StringBuilder builder = new StringBuilder(); for (Map.Entry<Opcode, AllocCountMap> entry : opcodeMap.entrySet()) { Opcode opcode = entry.getKey(); AllocCountMap typeCountMap = entry.getValue(); builder.append(typeCountMap.toString(opcode, limitPerInvoke)); } return builder.toString();
class InstructionAllocCountMap { private Map<Opcode, AllocCountMap> opcodeMap = new EnumMap<>(Opcode.class); public void count(Opcode opcode, String allocatedType) { AllocCountMap typeCountMap = opcodeMap.get(opcode); if (typeCountMap == null) { typeCountMap = new AllocCountMap(); opcodeMap.put(opcode,...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/freqinlinesize/FreqInlineSizeOperation.java
FreqInlineSizeOperation
getReport
304
564
868
List<Map.Entry<MemberSignatureParts, Integer>> sortedList = new ArrayList<>(countMap.entrySet()); Collections.sort(sortedList, new Comparator<Map.Entry<MemberSignatureParts, Integer>>() { @Override public int compare(Map.Entry<MemberSignatureParts, Integer> o1, Map.Entry<MemberSignatureParts, Integer> o2)...
class FreqInlineSizeOperation implements IJarScanOperation { private int freqInlineSize; private Map<MemberSignatureParts, Integer> countMap = new HashMap<>(); public FreqInlineSizeOperation(int freqInlineSize) { this.freqInlineSize = freqInlineSize; } @Override public String getReport() {<FILL_FUNCTION_BO...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/instructioncount/InstructionCountOperation.java
InstructionCountOperation
getReport
276
277
553
StringBuilder builder = new StringBuilder(); List<Map.Entry<Opcode, Integer>> sortedList = new ArrayList<>(opcodeCountMap.entrySet()); Collections.sort(sortedList, new Comparator<Map.Entry<Opcode, Integer>>() { @Override public int compare(Map.Entry<Opcode, Integer> o1, Map.Entry<Opcode, Integer> o2)...
class InstructionCountOperation implements IJarScanOperation { private Map<Opcode, Integer> opcodeCountMap; private int limit; public InstructionCountOperation(int limit) { opcodeCountMap = new EnumMap<>(Opcode.class); this.limit = limit; } @Override public String getReport() {<FILL_FUNCTION_BODY>} pri...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/invokecount/InvokeCountOperation.java
InvokeCountOperation
processInstructions
250
150
400
List<BytecodeInstruction> instructions = memberBytecode.getInstructions(); for (BytecodeInstruction instruction : instructions) { Opcode opcode = instruction.getOpcode(); switch (opcode) { case INVOKEDYNAMIC: case INVOKEINTERFACE: case INVOKESPECIAL: case INVOKESTATIC: case INVOKEVIRTUA...
class InvokeCountOperation implements IJarScanOperation { private InvokeMethodCountMap opcodeInvokeCountMap; private int limitPerInvoke; public InvokeCountOperation(int limitPerInvoke) { opcodeInvokeCountMap = new InvokeMethodCountMap(); this.limitPerInvoke = limitPerInvoke; } @Override public String ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/methodsizehisto/MethodSizeHistoOperation.java
MethodSizeHistoOperation
getReport
316
225
541
List<Map.Entry<Integer, Integer>> sortedList = new ArrayList<>(methodSizeMap.entrySet()); Collections.sort(sortedList, new Comparator<Map.Entry<Integer, Integer>>() { @Override public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) { return o2.getValue().compareTo(o1.get...
class MethodSizeHistoOperation implements IJarScanOperation { private Map<Integer, Integer> methodSizeMap = new HashMap<>(); public MethodSizeHistoOperation() { } @Override public String getReport() {<FILL_FUNCTION_BODY>} @Override public void processInstructions(String className, MemberBytecode memberBytec...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/nextinstruction/NextInstructionCount.java
NextInstructionCount
getCount
102
8
110
return count;
class NextInstructionCount { private Opcode opcode; private int count; public NextInstructionCount(Opcode opcode, int count) { this.opcode = opcode; this.count = count; } public Opcode getOpcode() { return opcode; } public int getCount() {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/jarscan/nextinstruction/NextInstructionCountList.java
NextInstructionCountList
getList
82
84
166
Collections.sort(list, new Comparator<NextInstructionCount>() { @Override public int compare(NextInstructionCount o1, NextInstructionCount o2) { return Integer.compare(o2.getCount(), o1.getCount()); } }); return list;
class NextInstructionCountList { private List<NextInstructionCount> list = new ArrayList<>(); public List<NextInstructionCount> getList() {<FILL_FUNCTION_BODY>} public void add(NextInstructionCount nextBytecode) { list.add(nextBytecode); } }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/loader/ResourceLoader.java
ResourceLoader
getSourceForClassName
939
282
1,221
List<String> searchLocations = new ArrayList<>(sourceLocations); if (searchLocations.isEmpty()) { File jdkSrcZip = FileUtil.getJDKSourceZip(); if (jdkSrcZip != null) { searchLocations.add(jdkSrcZip.toPath().toString()); } } int dollarPos = fqName.indexOf(C_DOLLAR); if (dollarPos != -1) ...
class ResourceLoader { private static final Logger logger = LoggerFactory.getLogger(ResourceLoader.class); private ResourceLoader() { } public static String getSourceForClassName(String moduleName, String fqName, List<String> sourceLocations) {<FILL_FUNCTION_BODY>} public static String getSourceForFilename(St...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/logger/NullLogListener.java
NullLogListener
handleLogEntry
60
4
64
class NullLogListener implements ILogListener { @Override public void handleLogEntry(String entry) {<FILL_FUNCTION_BODY>} @Override public void handleErrorEntry(String entry) { } }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/logger/StdLogListener.java
StdLogListener
handleErrorEntry
71
15
86
System.err.println(entry);
class StdLogListener implements ILogListener { @Override public void handleLogEntry(String entry) { System.out.println(entry); } @Override public void handleErrorEntry(String entry) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/MetaClass.java
MetaClass
getFullyQualifiedName
1,714
77
1,791
StringBuilder builder = new StringBuilder(); if (classPackage != null && classPackage.getName().length() > 0) { builder.append(classPackage.getName()).append(C_DOT); } builder.append(className); return builder.toString();
class MetaClass implements Comparable<MetaClass> { // private static final Logger logger = // LoggerFactory.getLogger(MetaClass.class); private String className; private MetaPackage classPackage; private boolean isInterface = false; private boolean missingDef = false; private List<IMetaMember> classMethods = ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/MetaMethod.java
MetaMethod
toString
299
106
405
String methodSigWithoutThrows = methodToString; int closingParentheses = methodSigWithoutThrows.indexOf(')'); if (closingParentheses != methodSigWithoutThrows.length() - 1) { methodSigWithoutThrows = methodSigWithoutThrows.substring(0, closingParentheses + 1); } ...
class MetaMethod extends AbstractMetaMember { private String methodToString; public MetaMethod(Method method, MetaClass methodClass) { super(method.getName()); this.methodToString = method.toString(); this.metaClass = methodClass; returnType = method.getReturnType(); ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/MetaPackage.java
MetaPackage
getChildPackages
850
57
907
MetaPackage[] asArray = childPackages.toArray(new MetaPackage[childPackages.size()]); Arrays.sort(asArray); return new ArrayList<>(Arrays.asList(asArray));
class MetaPackage implements Comparable<MetaPackage> { private String packageName; private List<MetaPackage> childPackages = new CopyOnWriteArrayList<>(); private List<MetaClass> packageClasses = new CopyOnWriteArrayList<>(); // support navigating back up the tree private MetaPackage parentPackage...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/PackageManager.java
PackageManager
buildPackage
401
332
733
if (DEBUG_LOGGING) { logger.debug("Building package {}", packageName); } String[] parts = packageName.split(S_ESCAPED_DOT); StringBuilder builder = new StringBuilder(); MetaPackage mp = null; MetaPackage parent = null; int depth = 0; for (String part : parts) { if (builder.length() > 0...
class PackageManager { private static final Logger logger = LoggerFactory.getLogger(PackageManager.class); // class name -> MetaClass private Map<String, MetaClass> metaClasses; // package name -> MetaPackage private Map<String, MetaPackage> metaPackages; private List<MetaPackage> roots; public PackageManage...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/ParseDictionary.java
ParseDictionary
toString
516
251
767
StringBuilder builder = new StringBuilder(); builder.append("Types:n"); for (Map.Entry<String, Tag> entry : typeMap.entrySet()) { builder.append(entry.getKey()).append("t=>t").append(entry.getValue().toString().trim()).append(S_NEWLINE); } builder.append("Klasses:n"); for (Map.Entry<String, Tag> e...
class ParseDictionary implements IParseDictionary { private Map<String, Tag> typeMap = new HashMap<>(); private Map<String, Tag> klassMap = new HashMap<>(); private Map<String, Tag> methodMap = new HashMap<>(); private String parseMethod; private Map<String, BCIOpcodeMap> methodBCIOpcodeMap = new HashMap<>(); ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AbstractAssemblyParser.java
AbstractAssemblyParser
parseAssembly
198
1,421
1,619
final AssemblyLabels labels = new AssemblyLabels(); String[] lines = assemblyString.split(S_NEWLINE); StringBuilder headerBuilder = new StringBuilder(); AssemblyBlock currentBlock = new AssemblyBlock(); AssemblyInstruction lastInstruction = null; String lastLine = null; AssemblyMethod method = new ...
class AbstractAssemblyParser implements IAssemblyParser { protected static final Logger logger = LoggerFactory.getLogger(AbstractAssemblyParser.class); protected Architecture architecture; public AbstractAssemblyParser(Architecture architecture) { this.architecture = architecture; } public Architecture getAr...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AssemblyBlock.java
AssemblyBlock
addInstruction
314
14
328
instructions.add(instr);
class AssemblyBlock { private String title; private List<AssemblyInstruction> instructions = new ArrayList<>(); public AssemblyBlock() { } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public void addInstruction(AssemblyInstruction instr) {<FI...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AssemblyMethod.java
AssemblyMethod
toString
490
159
649
StringBuilder builder = new StringBuilder(); int maxAnnoWidth = getMaxAnnotationWidth(); if (header != null) { String[] headerLines = header.split(S_NEWLINE); for (String headerLine : headerLines) { builder.append(StringUtil.repeat(C_SPACE, maxAnnoWidth)); builder.append(headerLine).append(...
class AssemblyMethod { private String header; private List<AssemblyBlock> blocks = new ArrayList<>(); private String nativeAddress; private String entryAddress; private String assemblyMethodSignature; private Architecture architecture; private static final Logger logger = LoggerFactory.getLogger(AssemblyMe...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AssemblyUtil.java
AssemblyUtil
getParserForArchitecture
252
189
441
IAssemblyParser parser = null; if (architecture != null) { switch (architecture) { case ARM_32: case ARM_64: parser = new AssemblyParserARM(architecture); break; case X86_32: case X86_64: parser = new AssemblyParserX86(architecture); break; default: break; } } if...
class AssemblyUtil { private static final Logger logger = LoggerFactory.getLogger(AssemblyUtil.class); private AssemblyUtil() { } public static long getValueFromAddress(final String address) { long addressValue = 0; if (address != null) { String trimmedAddress = address.trim(); if (trimmedAddress....
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/BCParamConstant.java
BCParamConstant
toString
117
17
134
return S_HASH + Integer.toString(value);
class BCParamConstant implements IBytecodeParam { private int value; public BCParamConstant(String inConstant) { // remove leading # for constant pool param String constant = inConstant.substring(1); value = Integer.parseInt(constant); } @Override public String toString() {<FILL_FUNCTION_BODY>} @O...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/BCParamString.java
BCParamString
toString
85
8
93
return value;
class BCParamString implements IBytecodeParam { private String value; public BCParamString(String value) { this.value = value; } @Override public String toString() {<FILL_FUNCTION_BODY>} @Override public String getValue() { return value; } }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/BytecodeAnnotationList.java
BytecodeAnnotationList
getEntries
532
12
544
return annotationMap.entrySet();
class BytecodeAnnotationList { private static final Logger logger = LoggerFactory.getLogger(BytecodeAnnotationList.class); private Map<Integer, List<LineAnnotation>> annotationMap = new TreeMap<>(); public void addAnnotation(int bci, LineAnnotation annotation) { if (DEBUG_LOGGING_BYTECODE) { logger.debug("...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/BytecodeAnnotations.java
BytecodeAnnotations
addAnnotation
145
78
223
BytecodeAnnotationList memberList = memberAnnotationMap.get(member); if (memberList == null) { memberList = new BytecodeAnnotationList(); memberAnnotationMap.put(member, memberList); } memberList.addAnnotation(bci, annotation);
class BytecodeAnnotations { private Map<IMetaMember, BytecodeAnnotationList> memberAnnotationMap = new HashMap<>(); public void addAnnotation(IMetaMember member, int bci, LineAnnotation annotation) {<FILL_FUNCTION_BODY>} public BytecodeAnnotationList getAnnotationList(IMetaMember member) { return memberAnnota...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/LineAnnotation.java
LineAnnotation
equals
340
183
523
if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LineAnnotation other = (LineAnnotation) obj; if (annotation == null) { if (other.annotation != null) return false; } else if (!annotation.equals(other.annotation)) return fals...
class LineAnnotation { private String annotation; private BCAnnotationType type; private Object metaData; public LineAnnotation(String annotation, BCAnnotationType type) { this(annotation, type, null); } public LineAnnotation(String annotation, BCAnnotationType type, Object metaData) { this.annotation = a...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/LineTableEntry.java
LineTableEntry
toString
343
64
407
StringBuilder builder = new StringBuilder(); builder.append(sourceOffset).append(C_SPACE).append(C_COLON).append(C_SPACE); builder.append(bytecodeOffset); return builder.toString();
class LineTableEntry { private int sourceOffset; private int bytecodeOffset; public LineTableEntry(int sourceOffset, int bytecodeOffset) { this.sourceOffset = sourceOffset; this.bytecodeOffset = bytecodeOffset; } public int getSourceOffset() { return sourceOffset; } public int getBytecodeOffset() { ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/UncommonTrap.java
UncommonTrap
parse
321
158
479
UncommonTrap trap = null; Map<String, String> tagAttributes = tag.getAttributes(); String bci = tagAttributes.get(ATTR_BCI); String reason = tagAttributes.get(ATTR_REASON); String action = tagAttributes.get(ATTR_ACTION); String comment = tagAttributes.get(ATTR_COMMENT); if (bci != null) { int b...
class UncommonTrap { private int bci; private String reason; private String action; private String comment; public int getBCI() { return bci; } public String getReason() { return reason; } public String getAction() { return action; } public String getComment() { return comment; } public Un...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/parser/j9/J9Line.java
J9Line
toString
1,431
271
1,702
StringBuilder builder = new StringBuilder(); builder.append("J9Line [getTemperature()="); builder.append(getTemperature()); builder.append(", getSignature()="); builder.append(getSignature()); builder.append(", getRangeStart()="); builder.append(getRangeStart()); builder.append(", getRangeEnd()="); b...
class J9Line { public static final String TEMPERATURE_COLD = "cold"; public static final String TEMPERATURE_WARM = "warm"; public static final String TEMPERATURE_PROFILED_VERY_HOT = "profiled very-hot"; private String temperature; private String signature; private String rangeStart; private String rangeEnd; p...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/parser/j9/J9LogParser.java
J9LogParser
parseLogFile
529
276
805
for (NumberedLine numberedLine : splitLog.getCompilationLines()) { processLineNumber = numberedLine.getLineNumber(); J9Line j9Line = J9Util.parseLine(numberedLine.getLine()); if (DEBUG_LOGGING) { logger.debug("J9 log line parsedn{}", j9Line); } Tag tagQueued = j9Line.toTagQueued(compileID,...
class J9LogParser extends AbstractLogParser { private int compileID = 1; private long timestampMillis = 0; public J9LogParser(IJITListener jitListener) { super(jitListener); } @Override protected void parseLogFile() {<FILL_FUNCTION_BODY>} @Override protected void handleTag(Tag tag) { String tagName = ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/process/AbstractProcess.java
AbstractProcess
runCommands
644
401
1,045
StringBuilder cmdBuilder = new StringBuilder(); for (String part : commands) { cmdBuilder.append(part).append(C_SPACE); } logger.info("Process: {}", cmdBuilder.toString()); if (logListener != null) { logListener.handleLogEntry("Running: " + cmdBuilder.toString()); } int result = -1; try ...
class AbstractProcess implements IExternalProcess { protected static final Logger logger = LoggerFactory.getLogger(RuntimeJava.class); private Path stdErr; private Path stdOut; public AbstractProcess() { try { stdErr = Files.createTempFile("stream", ".err"); stdOut = Files.createTempFile("stream", ".ou...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/process/compiler/CompilerJRuby.java
CompilerJRuby
compile
280
246
526
List<String> commands = new ArrayList<>(); String outputDirPath = outputDir.getAbsolutePath().toString(); Set<String> uniqueCPSet = new HashSet<>(classpathEntries); uniqueCPSet.add(outputDirPath); commands.add(compilerPath.toString()); // List<String> compileOptions = Arrays.asList(new String[] { "-g",...
class CompilerJRuby extends AbstractProcess implements ICompiler { // TODO this is broken. Not sure if possible with ProcessBuilder // http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html private Path compilerPath; private final String COMPILER_NAME = "jrubyc" + (isWindows() ? ".bat" : S_EMPTY); p...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/process/runtime/RuntimeJavaScript.java
RuntimeJavaScript
execute
271
177
448
List<String> commands = new ArrayList<>(); commands.add(runtimePath.toString()); // TODO support optimistic typing shortcuts commands.add("-ot=false"); for (String vmOption : vmOptions) { commands.add(vmOption.replace("-XX:", "-J-XX:")); } if (classpathEntries.size() > 0) { commands.add(...
class RuntimeJavaScript extends AbstractProcess implements IRuntime { private Path runtimePath; private final String RUNTIME_NAME = "jjs"; public RuntimeJavaScript(String languageHomeDir) throws FileNotFoundException { super(); runtimePath = Paths.get(languageHomeDir, "bin", RUNTIME_NAME); if (!runtimePat...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/process/runtime/RuntimeKotlin.java
RuntimeKotlin
execute
380
157
537
List<String> commands = new ArrayList<>(); commands.add(runtimePath.toString()); if (vmOptions.size() > 0) { commands.addAll(vmOptions); } if (classpathEntries.size() > 0) { commands.add("-cp"); commands.add(makeClassPath(classpathEntries)); } commands.add("-jar"); commands.add(pathToR...
class RuntimeKotlin extends AbstractProcess implements IRuntime { private Path runtimePath; //TODO how did this used to work? private final Path pathToRuntimeJar = Paths.get(CompilerKotlin.KOTLIN_EXECUTABLE_JAR); private final String RUNTIME_NAME = "java" + getExecutableSuffix(); public RuntimeKotlin(String lan...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/report/Report.java
Report
equals
625
286
911
if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Report other = (Report) obj; if (bci != other.bci) return false; if (caller == null) { if (other.caller != null) return false; } else if (!caller.equals(other.caller)) re...
class Report { private final IMetaMember caller; private final int compilationIndex; private final int bci; private final String text; private final ReportType type; private final int score; private Object metaData; public Report(IMetaMember caller, int compilationIndex, int bci, String text, ReportType type...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/toplist/HotThrowTopListVisitable.java
HotThrowTopListVisitable
postProcess
315
56
371
for (Map.Entry<String, Integer> entry : hotThrowMap.entrySet()) { topList.add(new StringTopListScore(entry.getKey(), entry.getValue().longValue())); }
class HotThrowTopListVisitable extends AbstractTopListVisitable { private final Map<String, Integer> hotThrowMap; public HotThrowTopListVisitable(IReadOnlyJITDataModel model, boolean sortHighToLow) { super(model, sortHighToLow); hotThrowMap = new HashMap<>(); } @Override public void visit(IMetaMember metaMe...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/toplist/InliningFailReasonTopListVisitable.java
InliningFailReasonTopListVisitable
postProcess
845
56
901
for (Map.Entry<String, Integer> entry : reasonCountMap.entrySet()) { topList.add(new StringTopListScore(entry.getKey(), entry.getValue().longValue())); }
class InliningFailReasonTopListVisitable extends AbstractTopListVisitable { private final Map<String, Integer> reasonCountMap; public InliningFailReasonTopListVisitable(IReadOnlyJITDataModel model, boolean sortHighToLow) { super(model, sortHighToLow); reasonCountMap = new HashMap<>(); ignoreTags.add(TAG_BC...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/treevisitor/TreeVisitor.java
TreeVisitor
walkTree
201
63
264
visitable.reset(); List<MetaPackage> roots = model.getPackageManager().getRootPackages(); for (MetaPackage mp : roots) { walkPackage(mp, visitable); }
class TreeVisitor { private TreeVisitor() { } public static void walkTree(IReadOnlyJITDataModel model, ITreeVisitable visitable) {<FILL_FUNCTION_BODY>} private static void walkPackage(MetaPackage mp, ITreeVisitable visitable) { List<MetaPackage> childPackages = mp.getChildPackages(); for (MetaPackage chil...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/util/ClassUtil.java
ClassUtil
initialise
434
81
515
if (DEBUG_LOGGING_CLASSPATH) { for (URL url : urls) { logger.debug("Adding classpath to DisposableURLClassLoader {}", url); } } disposableClassLoader = new DisposableURLClassLoader(urls);
class ClassUtil { private static DisposableURLClassLoader disposableClassLoader = new DisposableURLClassLoader(new ArrayList<URL>()); private static final Logger logger = LoggerFactory.getLogger(ClassUtil.class); public static void main(String[] args) throws ClassNotFoundException { ClassUtil.loadClassWithoutIn...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/util/DisassemblyUtil.java
DisassemblyUtil
getDisassemblerFilename
982
216
1,198
OperatingSystem os = OSUtil.getOperatingSystem(); String archName = System.getProperty("os.arch"); if ("x86_64".equals(archName)) { archName = "amd64"; } String binaryName = "hsdis-" + archName; if (os != null) { switch (os) { case WIN: binaryName += ".dll"; break; case MAC:...
class DisassemblyUtil { private static final Logger logger = LoggerFactory.getLogger(DisassemblyUtil.class); private DisassemblyUtil() { } public static boolean isDisassemblerAvailable() { boolean found = downloadedDisassemblerPresent(); Path binaryPath = getDisassemblerFilePath(); if (binaryPath != nul...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/util/TimerUtil.java
TimerUtil
timerStart
173
117
290
long now = System.currentTimeMillis(); timestampMap.put(key, now); long delta = now - lastNow; if (lastNow != 0) { System.out.println(now + " (+" + delta + ") starting " + key); } else { System.out.println(now + " starting " + key); } lastNow = now;
class TimerUtil { private static Map<String, Long> timestampMap = new HashMap<>(); private static long lastNow = 0; public static void timerStart(String key) {<FILL_FUNCTION_BODY>} public static void timerEnd(String key) { if (timestampMap.containsKey(key)) { long start = timestampMap.get(key); long...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/EscapeTestManyFields.java
Wrapper2
run
403
237
640
String result; int matchYes = 0; int matchNo = 0; for (int i = 0; i < 100_000_000; i++) { int v1 = 0xABCD; int v2 = 0; if (random.nextBoolean()) { v2 = 0xABCD; } final Wrapper1 wrapper1 =...
class Wrapper2 { private int v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20; public Wrapper2(int value) { v1=value; v2=v1+1; v3=v2+1; v4=v3+1; v5=v4+1; v6=v5+1; v7=v6+1; v8=v7+1; v9=v8+1; v10=v9+1; v11=v10+1; ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/EscapeTestString.java
Wrapper2
run
88
240
328
String result; int matchYes = 0; int matchNo = 0; for (int i = 0; i < 100_000_000; i++) { String v1 = "0xABCD"; String v2 = "0"; if (random.nextBoolean()) { v2 = "0xABCD"; } final Wrapper...
class Wrapper2 { private String value; public Wrapper2(String value) { this.value = value; } public String getValue() { return this.value; } } private java.util.Random random = new java.util.Random(); public String run() {<FILL_FUNCTION_BODY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/InlineSmallCode.java
Point
sumOfSquares
131
127
258
long sum = 0; for (int i = 0; i < limit; i++) { Point p = new Point(i, i); // if logPoint has been compiled to native code that is larger than InlineSmallCode // then it won't be inlined and Point p will escape this method // and not...
class Point { private int x, y; public Point(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public int getY() { return y; } } public InlineSmallCode() { System.out.println(sumOfSquares(200_000)); } private long sumOfSquares(int...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/LockCoarsen.java
LockCoarsen
main
173
11
184
new LockCoarsen();
class LockCoarsen { public LockCoarsen() { java.util.Random random = new java.util.Random(); long sum = 0; Object lock = new Object(); for (int i = 0; i < 1_000_000; i++) { synchronized(lock) { sum += random.nextLong(); ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/OSRTest.java
OSRTest
main
239
10
249
new OSRTest();
class OSRTest { public OSRTest() { long sum = 0; java.util.Random r = new java.util.Random(); for (int i = 0; i < 100_000; i++) { sum += r.nextInt(); } for (int i = 0; i < 100_000; i++) { sum -= r.nextInt(); } for (int i = 0; i < 100_000; i++) { sum *= r...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/PolymorphismTest.java
Quarter
deposit
34
11
45
moneyBox += 25;
class Quarter implements Coin { public void deposit() {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/StringBufferLockElision.java
StringBufferLockElision
main
203
12
215
new StringBufferLockElision();
class StringBufferLockElision { public StringBufferLockElision() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < 500_000; i++) { String joined = concatPieces("a", "b", "c"); buffer.append(joined); } System.out.println(buffer.toSt...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/UpperCase.java
UpperCase
doUpper
327
107
434
StringBuilder builder = new StringBuilder(); int len = source.length(); for (int i = 0; i < len; i++) { char c = source.charAt(i); if (c >= 'a' && c <= 'z') { c -= 32; } builder.append(c); } return builder.toString();
class UpperCase { public String upper; public UpperCase() { int iterations = 10_000_000; String source = "Lorem ipsum dolor sit amet, sensibus partiendo eam at."; long start = System.currentTimeMillis(); convertString(source, iterations); System.out.println(upper); System.out.println(System.currentTim...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestAssemblyLabels.java
TestAssemblyLabels
testFormatAddressJumpLocal2
1,468
412
1,880
labels.newInstruction(new AssemblyInstruction("", 99, Collections.emptyList(), "blah", Collections.emptyList(), "", labels)); labels.newInstruction( new AssemblyInstruction("anno", 65534, asList("mod"), "jne", asList("0x0000000000000100"), "", labels)); labels.newInstruction( new AssemblyInstruction("anno"...
class TestAssemblyLabels { private AssemblyLabels labels = new AssemblyLabels(); private final StringBuilder sb = new StringBuilder(); @Test public void testFormatEmpty() { final AssemblyInstruction localJump = new AssemblyInstruction(null, 65535, null, "jne", asList("0x000000000000ffff"), null, labels); ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestCompositeObjectEquality.java
TestCompositeObjectEquality
testBytecodeInstructionNotEqualComment
922
140
1,062
BytecodeInstruction instruction1 = new BytecodeInstruction(); instruction1.setOpcode(Opcode.ALOAD_0); instruction1.setOffset(10); instruction1.setComment("foo"); BytecodeInstruction instruction2 = new BytecodeInstruction(); instruction2.setOpcode(Opcode.ALOAD_0); instruction2.setOffset(10); instructio...
class TestCompositeObjectEquality { @Test public void testLineTableEqual() { LineTable table1 = new LineTable(null); LineTable table2 = new LineTable(null); table1.add(new LineTableEntry(1, 2)); table1.add(new LineTableEntry(3, 4)); table2.add(new LineTableEntry(1, 2)); table2.add(new LineTableEntry(3...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestExecutionUtil.java
TestExecutionUtil
testExecuteDemo
33
291
324
List<String> cp = new ArrayList<>(); String userDir = System.getProperty("user.dir"); //path for maven build Path path = FileSystems.getDefault().getPath(userDir, "target", "test-classes"); if (Files.exists(path)) { cp.add(path.toString()); } List<String> options = new ArrayList<>(); options.a...
class TestExecutionUtil { @Test public void testExecuteDemo() {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestInnerClassRelationship.java
TestInnerClassRelationship
testInnerClassNameFinder
306
308
614
String line1 = "public #13= #6 of #10; //Cow=class PolymorphismTest$Cow of class PolymorphismTest"; String line2 = "public #15= #4 of #10; //Cat=class PolymorphismTest$Cat of class PolymorphismTest"; String line3 = "public #16= #2 of #10; //Dog=class PolymorphismTest$Dog of class PolymorphismTest"; String line...
class TestInnerClassRelationship { @Test public void testInnerClassRelationshipParse() { String line1 = "#10= #8 of #32; //Inner1=class TestInner$Inner1 of class TestInner"; String line2 = "#12= #6 of #8; //Inner2=class TestInner$Inner1$Inner2 of class TestInner$Inner1"; String line3 = "As if by magic, the sho...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestJ9Parser.java
TestJ9Parser
testParseLineWithComplexTemperature
1,043
544
1,587
String line = "+ (profiled very-hot) java/util/ComparableTimSort.mergeLo(IIII)V @ 00007F0AAA62BBA0-00007F0AAA633020 OrdinaryMethod 16.40% T Q_SZ=0 Q_SZI=0 QW=100 j9m=000000000204A130 bcsz=656 compThread=0 CpuLoad=100%(50%avg) JvmCpu=100%"; J9Line j9Line = J9Util.parseLine(line); assertEquals(J9Line.TEMPERATURE...
class TestJ9Parser { @Test public void testParseLine() throws Exception { String line = "+ (cold) java/lang/Double.longBitsToDouble(J)D @ 00007F0AAA60003C-00007F0AAA60005E OrdinaryMethod Q_SZ=0 Q_SZI=0 QW=1 j9m=0000000001E31FE0 bcsz=3 JNI compThread=0 CpuLoad=8%(4%avg) JvmCpu=0%"; J9Line j9Line = J9Util.parseLi...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestJITWatchConfig.java
TestJITWatchConfig
testEmptyConfigSaveReload
1,688
319
2,007
JITWatchConfig config = new JITWatchConfig(new File(testConfigFilename)); String foo = "foo"; List<String> sourcesList = new ArrayList<>(); sourcesList.add(foo); config.setSourceLocations(sourcesList); config.marshalConfigToProperties(); config.savePropertiesToFile(); config = new JITWatchConfig(...
class TestJITWatchConfig { private String testConfigFilename; @Before public void setUp() throws IOException { testConfigFilename = File.createTempFile("test", ".properties").getAbsolutePath(); } @After public void tearDown() { if (testConfigFilename != null) { File configFile = new File(testConfigF...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestMemberBytecode.java
TestMemberBytecode
testMultipleBackBranches
342
757
1,099
String[] lines = new String[] { "0: iconst_0", "1: istore_1", "2: iload_1", "3: bipush 100", "5: if_icmpge 21", "8: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;", "11: iload_1", "12: invokevirtual #3 // Method java/i...
class TestMemberBytecode { @Test public void testSingleBackBranch() { String[] lines = new String[] { "0: iconst_0", "1: istore_1", "2: iload_1", "3: bipush 100", "5: if_icmpge 30", "8: iload_1", "9: iconst_2", "10: irem", "11: ifne 17", "14: goto ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestPackageManager.java
TestPackageManager
givenUnknownPackageNameIsUsedWithPackageManager_WhenPackageIsBuilt_ThenEmptyMetaPackage
373
82
455
// Given MetaPackage expectedPackage = new MetaPackage(S_EMPTY); // When PackageManager packageManager = new PackageManager(); MetaPackage actualPackage = packageManager.buildPackage(S_EMPTY); // Then assertThat(actualPackage, is(equalTo(expectedPackage))); ...
class TestPackageManager { /* Scenario: No valid package name is passed Given an unknown or empty package name is passed to the PackageManager When the package is built Then an empty meta package is returned */ /* Deadcode detected via this test { ...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestStringUtil.java
TestStringUtil
testFormatTimestamp
591
319
910
assertEquals("00:00:00", StringUtil.formatTimestamp(0, false)); assertEquals("00:00:00.000", StringUtil.formatTimestamp(0, true)); assertEquals("00:00:04", StringUtil.formatTimestamp(4000, false)); assertEquals("00:00:04.567", StringUtil.formatTimestamp(4567, true)); assertEquals("00:01:00", StringUtil.forma...
class TestStringUtil { @Test public void testFormatTimestamp() {<FILL_FUNCTION_BODY>} @Test public void testGetLineAttributes() { Map<String, Map<String, String>> expected = new HashMap<>(); String line1 = "foo='1' bar='2' baz='3'"; Map<String, String> map1 = new HashMap<>(); map1.put("foo", "1"); ma...
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/UnitTestLogParser.java
UnitTestLogParser
setTagTaskDone
281
18
299
super.handleTaskDone(tagTaskDone, member);
class UnitTestLogParser extends AbstractLogParser { public UnitTestLogParser(IJITListener jitListener) { super(jitListener); currentCompilerThread = new CompilerThread("1234", "TestCompilerThread"); } @Override protected void parseLogFile() { } @Override protected void splitLogFile(Reader logFileReader)...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/Branchless.java
Branchless
xEqualsYReturnAElseB
547
62
609
int tmp = ((x - y) - 1) >> 31; int mask = (((x - y) >> 31) ^ tmp) & tmp; return (a & mask) | (b & (~mask));
class Branchless { public Branchless() { int result1a = 0; int result1b = 0; int result2a = 0; int result2b = 0; for (int i = 0; i < 1_000_000; i++) { result1a = xEqualsYReturnAElseB(i, i, 98, 99); result1b = xEqualsYReturnAElseBVa...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/DeoptTest.java
DeoptTest
checkZero
285
34
319
if (value > 0) { greater(); } else { less(); }
class DeoptTest { private long greater = 0; private long less = 0; private long direction = -1; private static final long MAX = 1_000_000; private static final long MIN = -MAX; public DeoptTest() { long current = MAX; long endTime = System.currentTimeMillis() + 20_000; // 2...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/DoesItVectorise.java
DoesItVectorise
incrementArray
172
44
216
int length = array.length; for (int i = 0; i < length; i++) { array[i] += constant; }
class DoesItVectorise { public DoesItVectorise() { int[] array = new int[1024]; for (int i = 0; i < 1_000_000; i++) { incrementArray(array, 1); } for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } } ...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/ElisionTest.java
ElisionTest
main
163
10
173
new ElisionTest();
class ElisionTest { public ElisionTest() { Vector<Long> vector = new Vector<>(); for (long i = 0; i < 100_000; i++) { vector.add(i); // add is synchronized } long sum = 0; for (int i = 0; i < vector.size(); i++) { sum += vector.g...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/IntrinsicTest.java
IntrinsicTest
main
241
19
260
new IntrinsicTest(100_000);
class IntrinsicTest { public IntrinsicTest(int iterations) { long dstSum = 0; int[] src = new int[] { 1, 2, 3, 4, 5 }; int[] dst = new int[src.length]; for (int i = 0; i < iterations; i++) { // x86 has intrinsic for System.arrayCopy System.arrayco...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/LoopUnroll.java
LoopUnroll
constantStride1Long
1,128
63
1,191
long sum = 0; for (long l = 0; l < MAX; l++) { // cast because array index can't be longer than int sum += data[(int) l]; } return sum;
class LoopUnroll { private static final int MAX = 1_000_000; private long[] data = new long[MAX]; public LoopUnroll() { createData(); long total = 0; total += constantStride1Int(); total += constantStride2Int(); total += constantStride4Int(); total += constantStride8Int(); total += constantStride1...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/SafePointTest.java
SafePointTest
incCounter
285
14
299
anotherCounter += 0xBEEF;
class SafePointTest { // Safepoints should appear at: // (1) back branch of uncounted loops // (2) entry to non-inlined method // (3) exit of non-inlined method private long count = 0; private long anotherCounter = 0; private long endTime = System.currentTimeMillis() + 5_000; public...
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/StringBufferLockElision.java
StringBufferLockElision
concatPieces
169
46
215
StringBuffer buffer = new StringBuffer(); buffer.append(one); buffer.append(two); buffer.append(three); return buffer.toString();
class StringBufferLockElision { public StringBufferLockElision() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < 500_000; i++) { String joined = concatPieces("a", "b", "c"); buffer.append(joined); } System.out.println(buffer.toSt...
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/jarscan/visualiser/HistoPlotter.java
HistoPlotter
updateObservable
1,669
276
1,945
chart.getData().clear(); ObservableList<XYChart.Data<Number, Number>> observableValues = FXCollections.observableArrayList(); for (XYChart.Data<Number, Number> value : values) { if (value.getXValue().intValue() <= limit) { observableValues.add(value); } } XYChart.Series<Number, Number> seri...
class HistoPlotter extends Application { private List<XYChart.Data<Number, Number>> values = new ArrayList<>(); private Scene scene; private ScatterChart<Number, Number> chart; private int limit = -1; private static final String PARAM_SCREENSHOT = "screenshot"; private static final String PARAM_LIMIT = "limi...
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/launch/LaunchUI.java
LaunchUI
main
42
14
56
new JITWatchUI(args);
class LaunchUI { private LaunchUI() { } public static void main(String[] args) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/filechooser/FileChooserListSrcZip.java
FileChooserListSrcZip
handle
196
111
307
File srcZipFile = FileUtil.getJDKSourceZip(); if (srcZipFile != null) { try { String srcZipPath = srcZipFile.getCanonicalPath(); addPathToList(srcZipPath); } catch (IOException ioe) { logger.error("", ioe); } }
class FileChooserListSrcZip extends FileChooserList { private static final Logger logger = LoggerFactory.getLogger(FileChooserList.class); public FileChooserListSrcZip(Stage stage, String title, List<String> items) { super(stage, title, items); Button btnAddSrcZip = UserInterfaceUtil.createButton("CONFIG_AD...
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/graphing/CodeCacheStage.java
CodeCacheStage
redraw
538
841
1,379
super.baseRedraw(); labelLeft = true; List<CodeCacheEvent> codeCacheEvents = mainUI.getJITDataModel().getCodeCacheEvents(); Collections.sort(codeCacheEvents, new Comparator<CodeCacheEvent>() { @Override public int compare(CodeCacheEvent e1, CodeCacheEvent e2) { return Long.compare(e1.getStamp...
class CodeCacheStage extends AbstractGraphStage { private boolean labelLeft = true; public CodeCacheStage(JITWatchUI parent) { super(parent, JITWatchUI.WINDOW_WIDTH, JITWatchUI.WINDOW_HEIGHT, true); StackPane root = new StackPane(); Scene scene = UserInterfaceUtil.getScene(root, width, height); canvas.wid...
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/graphing/HistoStage.java
HistoStage
redraw
675
624
1,299
super.baseRedraw(); if (histo == null) { return; } List<Map.Entry<Long, Integer>> result = histo.getSortedData(); if (result.size() > 0) { minX = 0; maxX = histo.getLastTime(); minY = 0; maxY...
class HistoStage extends AbstractGraphStage { private Histo histo; private IHistoVisitable histoVisitable; public HistoStage(final JITWatchUI parent) { super(parent, JITWatchUI.WINDOW_WIDTH, JITWatchUI.WINDOW_HEIGHT, false); IReadOnlyJITDataModel model = parent.getJITDataModel...
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/main/CompilationTableBuilder.java
CompilationTableBuilder
buildTableMemberAttributes
63
607
670
TableView<CompilationTableRow> tv = new TableView<>(); TableColumn<CompilationTableRow, String> columnQueued = UserInterfaceUtil.createTableColumn("CT_QUEUED"); columnQueued.setCellValueFactory(new PropertyValueFactory<>("stampQueued")); columnQueued.prefWidthProperty().bind(tv.widthProperty().multiply(0.15)...
class CompilationTableBuilder { private CompilationTableBuilder() { } public static TableView<CompilationTableRow> buildTableMemberAttributes(ObservableList<CompilationTableRow> rows) {<FILL_FUNCTION_BODY>} }
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/main/CompilationTableRow.java
CompilationTableRow
getCompiler
562
94
656
String result = compilation.getCompiler(); if (result == null) { result = "NA"; Task task = compilation.getTagTask(); if (task != null && CompilationUtil.isStaleTask(task)) { result = "Stale task"; } } return result;
class CompilationTableRow { private final Compilation compilation; public CompilationTableRow(Compilation compilation) { this.compilation = compilation; } public int getIndex() { return compilation.getIndex(); } public String getStampQueued() { return getTimestampOrNA(compilation.getStampTaskQueued())...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
15