<commit_before>package org.lilyproject.testclientfw;

import org.apache.commons.logging.LogFactory;

/**
 * Class to measure elapsed time in milliseconds (but measured at nanosecond precision).
 * One thread can only do one time-measurement at a time (it makes use of threadlocal state).
 */
public class Stopwatch {
    private static final ThreadLocal<StopwatchData> dataTL = new ThreadLocal<StopwatchData>() {
        @Override
        protected StopwatchData initialValue() {
            return new StopwatchData();
        }
    };

    public static void start() {
        StopwatchData data = dataTL.get();

        if (data.started) {
            LogFactory.getLog(Stopwatch.class).error("Stopwatch.start() called but it was already started.");
        }

        data.startedAt = System.nanoTime();
        data.started = true;
    }

    public static double stop() {
        StopwatchData data = dataTL.get();

        if (!data.started) {
            LogFactory.getLog(Stopwatch.class).error("Stopwatch.stop() called but it was not started.");
        }

        double duration = (System.nanoTime() - ((double)data.startedAt)) / 1e6;
        data.started = false;
        return duration;
    }

    private static class StopwatchData {
        long startedAt;
        boolean started;
    }
}<commit_msg>Stopwatch: adding an extra double cast just to be sure.<commit_after>package org.lilyproject.testclientfw;

import org.apache.commons.logging.LogFactory;

/**
 * Class to measure elapsed time in milliseconds (but measured at nanosecond precision).
 * One thread can only do one time-measurement at a time (it makes use of threadlocal state).
 */
public class Stopwatch {
    private static final ThreadLocal<StopwatchData> dataTL = new ThreadLocal<StopwatchData>() {
        @Override
        protected StopwatchData initialValue() {
            return new StopwatchData();
        }
    };

    public static void start() {
        StopwatchData data = dataTL.get();

        if (data.started) {
            LogFactory.getLog(Stopwatch.class).error("Stopwatch.start() called but it was already started.");
        }

        data.startedAt = System.nanoTime();
        data.started = true;
    }

    public static double stop() {
        StopwatchData data = dataTL.get();

        if (!data.started) {
            LogFactory.getLog(Stopwatch.class).error("Stopwatch.stop() called but it was not started.");
        }

        double duration = (((double)System.nanoTime()) - ((double)data.startedAt)) / 1e6;
        data.started = false;
        return duration;
    }

    private static class StopwatchData {
        long startedAt;
        boolean started;
    }
}
{'fraction_non_alphanumeric': 0.10119047619047619, 'fraction_numerical': 0.001488095238095238, 'mean_word_length': 2.5710491367861885, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4672952', 'n_tokens_mistral': 740, 'n_tokens_neox': 704, 'n_words': 213}