void writeCsv(PrintStream ps) {
    if (ps == null)
      return;
    final String sep = ";";

    ps.print("onPaint.duration" + sep);
    for (Event e: onPaint)
      ps.printf("%.1f%s", e.durationNs()/(float)1000000, sep);
    ps.println();

    ps.print("onPaint.pixelsKb" + sep);
    for (Event e: onPaint)
      ps.printf("%.1f%s", e.data*4/(float)1024, sep);
    ps.println();

    ps.print("paintFrame.duration" + sep);
    for (Event e: paintFrame)
      ps.printf("%.1f%s", e.durationNs()/(float)1000000, sep);
    ps.println();

    ps.print("paintFrame.fps" + sep);
    for (Event e: paintFrame)
      ps.print(String.valueOf(e.data) + sep);
    ps.println();
  }
void writeCsv(PrintStream ps)