1 package org
.lttng
.ust
.tests
;
3 import java
.io
.IOException
;
4 import java
.util
.logging
.FileHandler
;
5 import java
.util
.logging
.Level
;
6 import java
.util
.logging
.Logger
;
7 import java
.util
.logging
.SimpleFormatter
;
9 import org
.lttng
.ust
.LTTngUst
;
11 public class Benchmark
{
13 private static final int NB_RUNS
= 5;
14 private static final int NB_THREADS
= 2;
19 * @throws SecurityException
21 public static void main(String
[] args
) throws SecurityException
,
24 long start
, end
, average
, total
= 0;
29 /* Set up the logger */
30 log
= Logger
.getLogger("Test logger");
31 log
.setUseParentHandlers(false);
32 fh
= new FileHandler("/tmp/log", false);
33 fh
.setFormatter(new SimpleFormatter());
34 // log.addHandler(fh);
35 log
.setLevel(Level
.ALL
);
37 /* Set up the tracer */
39 System
.out
.println("Press a key to start.");
42 for (int i
= 0; i
< NB_RUNS
; i
++) {
43 runner
= new Runner(NB_THREADS
, log
);
45 start
= System
.nanoTime();
47 end
= System
.nanoTime();
49 total
+= (end
- start
);
51 average
= total
/ NB_RUNS
;
52 System
.out
.println("Average = " + average
/ 1000000 + " ms");
This page took 0.030668 seconds and 5 git commands to generate.