[Demonstration 1]

[Buggy Method]
ErrorCode start() {
    ErrorCode taskErr = ErrorCode.ERR_NONE;
    if ((m_Active == false) && (m_TotalRuntimeMs == 0)) {
        /* Capture a starting timestamp */
        m_StartTimestampMs = SystemClock.elapsedRealtime();
        /* Mark this iteration as active, and also mark the corresponding task as active as well */
        m_Active = true;
        m_Task.setAsActive();
    } else {
        /* Task is already active */
        taskErr = ErrorCode.ERR_TASK_ALREADY_STARTED;
    }
    return (taskErr);
}

[Buggy Hunk]
if( ( m_Active == false ) && ( m_TotalRuntimeMs == 0 ) )

[Patch]
if( ( m_Active == false ) && ( m_IterationRuntimeMs == 0 ) )

[Demonstration 2]

[Buggy Method]
public static ReaderNodeNodePlugin getDefault() {
    return plugin;
}

[Buggy Hunk]
public static ReaderNodeNodePlugin getDefault() {

[Patch]
public static ReaderNodePlugin getDefault() {

[Demonstration 3]

[Buggy Method]
@SuppressWarnings("unchecked")
public static String getHeavyHitters(int num) {
    int len = _cpInstTime.size();
    if (num <= 0 || len <= 0)
        return "-";
    // get top k via sort
    Entry<String, Long>[] tmp = _cpInstTime.entrySet().toArray(new Entry[len]);
    Arrays.sort(tmp, new Comparator<Entry<String, Long>>() {

        public int compare(Entry<String, Long> e1, Entry<String, Long> e2) {
            return e1.getValue().compareTo(e2.getValue());
        }
    });
    final String numCol = "#";
    final String instCol = "Instruction";
    final String timeSCol = "Time(s)";
    final String countCol = "Count";
    final String gpuCol = "Misc Timers";
    StringBuilder sb = new StringBuilder();
    int numHittersToDisplay = Math.min(num, len);
    int maxNumLen = String.valueOf(numHittersToDisplay).length();
    int maxInstLen = instCol.length();
    int maxTimeSLen = timeSCol.length();
    int maxCountLen = countCol.length();
    DecimalFormat sFormat = new DecimalFormat("#,##0.000");
    for (int i = 0; i < numHittersToDisplay; i++) {
        Entry<String, Long> hh = tmp[len - 1 - i];
        String instruction = hh.getKey();
        Long timeNs = hh.getValue();
        double timeS = (double) timeNs / 1000000000.0;
        maxInstLen = Math.max(maxInstLen, instruction.length());
        String timeSString = sFormat.format(timeS);
        maxTimeSLen = Math.max(maxTimeSLen, timeSString.length());
        maxCountLen = Math.max(maxCountLen, String.valueOf(_cpInstCounts.get(instruction)).length());
    }
    sb.append(String.format(" %" + maxNumLen + "s  %-" + maxInstLen + "s  %" + maxTimeSLen + "s  %" + maxCountLen + "s", numCol, instCol, timeSCol, countCol));
    if (GPUStatistics.DISPLAY_STATISTICS) {
        sb.append("  ");
        sb.append(gpuCol);
    }
    sb.append("\n");
    for (int i = 0; i < numHittersToDisplay; i++) {
        String instruction = tmp[len - 1 - i].getKey();
        Long timeNs = tmp[len - 1 - i].getValue();
        double timeS = (double) timeNs / 1000000000.0;
        String timeSString = sFormat.format(timeS);
        Long count = _cpInstCounts.get(instruction);
        sb.append(String.format(" %" + maxNumLen + "d  %-" + maxInstLen + "s  %" + maxTimeSLen + "s  %" + maxCountLen + "d", (i + 1), instruction, timeSString, count));
        // Add the miscellaneous timer info
        if (GPUStatistics.DISPLAY_STATISTICS || DMLScript.FINEGRAINED_STATISTICS) {
            sb.append("  ");
            sb.append(GPUStatistics.getStringForCPMiscTimesPerInstruction(instruction));
        }
        sb.append("\n");
    }
    return sb.toString();
}

[Buggy Hunk]
if (GPUStatistics.DISPLAY_STATISTICS) {

[Patch]
if (GPUStatistics.DISPLAY_STATISTICS || DMLScript.FINEGRAINED_STATISTICS) {