<commit_before>package us.malfeasant.admiral64.timing;

import javafx.animation.AnimationTimer;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;

/**
 *	generates the timing events that keep the machine running.  Minimum options should be single CPU cycle,  
 *	realtime, or uninhibited.  
 */
public class TimingGenerator extends AnimationTimer {
	RunMode mode = RunMode.STEP;
	long last;	// last frame time
	long elapsed;	// total time since arbitrary point
	long interval;	// current frame's duration
	long cyclesDone;	// total cycles run since arbitrary point
	long remainder;	// leftover time to run in next interval (only used for realtime)
	private final HBox buttons = new HBox();
	final Oscillator osc = Oscillator.NTSC;	// TODO: make this configurable
	final Powerline pow = Powerline.NA;	// TODO: same
	final GraphicsContext context;
	
	@Override
	public void handle(long now) {
		if (last > 0) {	// not first run
			interval = now - last;
			elapsed += interval;
			mode.timerFired(this);
			// TODO: Render worker thread results to screen
			// TODO: if realtime, compute # of cycles to request from worker thread
		}	// skip first run
		last = now;
	}
	
	public TimingGenerator(GraphicsContext gc) {
		for (RunMode m : RunMode.values()) {
			buttons.getChildren().add(m.makeButton(this));
		}
		buttons.setAlignment(Pos.CENTER);
		context = gc;
	}
	
	void runFor(int cycles) {
		// TODO: Send message to worker thread
		cyclesDone += cycles;
		Platform.runLater(() -> mode.workDone(this));	// simulate a response from worker thread
		
		context.setFill(Color.grayRgb(0xf4));
		context.fillRect(0, 0, 800, 600);
		context.setFill(Color.BLACK);
		context.fillText(String.format("%9d cycles\t%5.3f milliseconds\t%.9fMHz",
				cycles, interval / 1e6, cycles * 1e3 / interval), 20, 20);
		context.fillText(String.format("Long term: %d cycles\t%.3f seconds\t%.9fMHz",
				cyclesDone, elapsed / 1e9, cyclesDone * 1e3 / elapsed), 40, 40);
	}
	public HBox getButtons() {
		return buttons;
	}
}
<commit_msg>Added new variables, too busy to implement their functionality...<commit_after>package us.malfeasant.admiral64.timing;

import javafx.animation.AnimationTimer;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;

/**
 *	generates the timing events that keep the machine running.  Minimum options should be single CPU cycle,  
 *	realtime, or uninhibited.  
 */
public class TimingGenerator extends AnimationTimer {
	RunMode mode = RunMode.STEP;
	long last;	// last frame time
	long elapsed;	// total time since arbitrary point
	long interval;	// current frame's duration
	long cyclesDone;	// total cycles run since arbitrary point
	long remainder;	// leftover time to run in next interval (only used for realtime)
	long pwrCycles;	//	Total number of power cycles (used to tick CIAs' RTC)
	long pwrRemainder;	// remainder from above calculation
	
	private final HBox buttons = new HBox();
	final Oscillator osc = Oscillator.NTSC;	// TODO: make this configurable
	final Powerline pow = Powerline.NA;	// TODO: same
	final GraphicsContext context;
	
	@Override
	public void handle(long now) {
		if (last > 0) {	// not first run
			interval = now - last;
			elapsed += interval;
			mode.timerFired(this);
			// TODO: Render worker thread results to screen
			// TODO: if realtime, compute # of cycles to request from worker thread
		}	// skip first run
		last = now;
	}
	
	public TimingGenerator(GraphicsContext gc) {
		for (RunMode m : RunMode.values()) {
			buttons.getChildren().add(m.makeButton(this));
		}
		buttons.setAlignment(Pos.CENTER);
		context = gc;
	}
	
	void runFor(int cycles) {
		// TODO: Send message to worker thread
		cyclesDone += cycles;
		Platform.runLater(() -> mode.workDone(this));	// simulate a response from worker thread
		
		context.setFill(Color.grayRgb(0xf4));
		context.fillRect(0, 0, 800, 600);
		context.setFill(Color.BLACK);
		context.fillText(String.format("%9d cycles\t%5.3f milliseconds\t%.9fMHz",
				cycles, interval / 1e6, cycles * 1e3 / interval), 20, 20);
		context.fillText(String.format("Long term: %d cycles\t%.3f seconds\t%.9fMHz",
				cyclesDone, elapsed / 1e9, cyclesDone * 1e3 / elapsed), 40, 40);
		context.fillText(String.format("Powerline: %d cycles\t%.3f seconds\t%.9fHz",
				cyclesDone, elapsed / 1e9, cyclesDone * 1e3 / elapsed), 20, 60);
	}
	public HBox getButtons() {
		return buttons;
	}
}

{'fraction_non_alphanumeric': 0.11164205039096438, 'fraction_numerical': 0.01737619461337967, 'mean_word_length': 3.883351007423118, 'pattern_counts': {'":': 0, '<': 3, '<?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': '932923', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1444, 'n_words': 452}