Skip to content

Instantly share code, notes, and snippets.

@mitallast
Created September 10, 2017 11:25
Show Gist options
  • Save mitallast/3436c27bdbcd4e00dc816a7449f77366 to your computer and use it in GitHub Desktop.
Save mitallast/3436c27bdbcd4e00dc816a7449f77366 to your computer and use it in GitHub Desktop.
package org.mitallast.queue;
public class ProcessTest {
public static void main(String... args) throws Exception {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
Process vipsthumbnail = Runtime.getRuntime()
.exec("vipsthumbnail", new String[]{"cats.jpg", "-o", "cats.resized.vips.jpg", "--size", "x100"});
vipsthumbnail.waitFor();
}
long end = System.currentTimeMillis();
printQps("vips", 1000, start, end);
}
private static void printQps(String metric, long total, long start, long end) {
long qps = (long) (total / (double) (end - start) * 1000.);
System.out.println(metric + ": " + total + " at " + (end - start) + "ms");
System.out.println(metric + ": " + qps + " qps");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment