private static void testCpus(int cpuCount, char[] ram) {
    DCPU[] cpus = new DCPU[cpuCount];
    for (int i = 0; i < cpuCount; i++) {
      cpus[i] = new DCPU();
      for (int j = 0; j < 65536; j++) {
        cpus[i].ram[j] = ram[j];
      }
    }

    long ops = 0L;
    int hz = khz * 1000;
    int cyclesPerFrame = hz / 60;

    long nsPerFrame = 16666666L;
    long nextTime = System.nanoTime();

    double tick = 0;
    double total = 0;

    long startTime = System.currentTimeMillis();
    while (!stop) {
      long a = System.nanoTime();
      while (System.nanoTime() < nextTime) {
        try {
          Thread.sleep(1L);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
      long b = System.nanoTime();
      for (int j = 0; j < cpuCount; j++) {
        while (cpus[j].cycles < cyclesPerFrame) {
          cpus[j].tick();
        }
        cpus[j].tickHardware();
        cpus[j].cycles -= cyclesPerFrame;
      }
      long c = System.nanoTime();
      ops += cyclesPerFrame;
      nextTime += nsPerFrame;

      tick += (c - b) / 1000000000.0;
      total += (c - a) / 1000000000.0;
    }

    long passedTime = System.currentTimeMillis() - startTime;
    System.out.println(cpuCount + " DCPU at " + ops / passedTime + " khz, " + tick * 100.0 / total + "% cpu use");
  }