<commit_before>package org.netmelody.panto;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Parallel;

public final class StripedJUnitTask extends Task {
    private RecordingJUnitTask embeddedJUnitTask;
    private int stripeCount = -1;

    public void setStripeCount(int stripeCount) {
        if (stripeCount <= 0) {
            throw new BuildException("There must be at least one stripe");
        }
        this.stripeCount = stripeCount;
    }

    public RecordingJUnitTask createJUnit() {
        try {
            embeddedJUnitTask = new RecordingJUnitTask(getProject());
            return embeddedJUnitTask;
        }
        catch (Exception e) {
            throw new BuildException(e);
        }
    }
    
    @Override
    public void execute() throws BuildException {
        final Parallel parallelTask = (Parallel) getProject().createTask("parallel");
        parallelTask.init();
        parallelTask.setThreadsPerProcessor(1);
        
        if (stripeCount <= 0) {
            stripeCount = Runtime.getRuntime().availableProcessors() * 2;
        }
        for (int i = 0; i < stripeCount; i++) {
            parallelTask.addTask(embeddedJUnitTask.spawnTaskForStripe(i + 1, stripeCount));
        }
        
        parallelTask.perform();
    }
}<commit_msg>better default stripiness<commit_after>package org.netmelody.panto;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Parallel;

public final class StripedJUnitTask extends Task {
    private RecordingJUnitTask embeddedJUnitTask;
    private int stripeCount = -1;

    public void setStripeCount(int stripeCount) {
        if (stripeCount <= 0) {
            throw new BuildException("There must be at least one stripe");
        }
        this.stripeCount = stripeCount;
    }

    public RecordingJUnitTask createJUnit() {
        try {
            embeddedJUnitTask = new RecordingJUnitTask(getProject());
            return embeddedJUnitTask;
        }
        catch (Exception e) {
            throw new BuildException(e);
        }
    }
    
    @Override
    public void execute() throws BuildException {
        final Parallel parallelTask = (Parallel) getProject().createTask("parallel");
        parallelTask.init();
        parallelTask.setThreadsPerProcessor(1);
        
        if (stripeCount <= 0) {
            stripeCount = Runtime.getRuntime().availableProcessors();
        }
        for (int i = 0; i < stripeCount; i++) {
            parallelTask.addTask(embeddedJUnitTask.spawnTaskForStripe(i + 1, stripeCount));
        }
        
        parallelTask.perform();
    }
}
{'fraction_non_alphanumeric': 0.09395725865880619, 'fraction_numerical': 0.004789977892409728, 'mean_word_length': 2.4585987261146496, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5649791', 'n_tokens_mistral': 777, 'n_tokens_neox': 749, 'n_words': 169}