File: NativeSpeed.java

package info (click to toggle)
king 2.24%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 78,588 kB
  • sloc: java: 111,577; xml: 1,868; cpp: 209; perl: 127; sh: 102; python: 99; makefile: 60; ansic: 7
file content (18 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class NativeSpeed {
    public native void doNativeFunc();

    static {
        System.loadLibrary("nativespeed");
    }
    
    public static void main(String[] args) {
        NativeSpeed ns = new NativeSpeed();
        final int num = 10000000; // 10 million
        long time = System.currentTimeMillis();
        for(int i = 0; i < num; i++)
            ns.doNativeFunc();
        time = System.currentTimeMillis() - time;
        System.err.println(num+" native calls in "+time+" ms");
    }
}