Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Rate-counter/Java/rate-counter-1.java
Normal file
19
Task/Rate-counter/Java/rate-counter-1.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import java.util.function.Consumer;
|
||||
|
||||
public class RateCounter {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (double d : benchmark(10, x -> System.out.print(""), 10))
|
||||
System.out.println(d);
|
||||
}
|
||||
|
||||
static double[] benchmark(int n, Consumer<Integer> f, int arg) {
|
||||
double[] timings = new double[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
long time = System.nanoTime();
|
||||
f.accept(arg);
|
||||
timings[i] = System.nanoTime() - time;
|
||||
}
|
||||
return timings;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue