]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin6.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / scratch / org / simantics / databoard / tests / Jotakin6.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.databoard.tests;\r
12 \r
13 import java.util.concurrent.locks.ReentrantReadWriteLock;\r
14 \r
15 import org.simantics.databoard.Bindings;\r
16 import org.simantics.databoard.binding.Binding;\r
17 \r
18 public class Jotakin6 {\r
19 \r
20         public static class X {\r
21                 public int[] array = new int[1024*1024*4];\r
22                 public long[] array2 = new long[1024*1024*4];\r
23         }\r
24         \r
25         public static class Y {\r
26         }\r
27         \r
28         public static void main(String[] args) \r
29         throws Exception {\r
30                 \r
31                 ReentrantReadWriteLock lock = new ReentrantReadWriteLock();\r
32                 \r
33                 lock.writeLock().lock();\r
34                 lock.readLock().lock();\r
35                 lock.readLock().unlock();\r
36                 lock.writeLock().unlock();\r
37                 \r
38                 X x = new X();\r
39                 Binding b = Bindings.getBinding(X.class);\r
40                 \r
41                 int hash = b.hashValue(x);\r
42                 \r
43                 long startTime = System.currentTimeMillis();\r
44                 \r
45                 hash = b.hashValue(x);\r
46                 \r
47                 long elapsedTime = System.currentTimeMillis() - startTime;\r
48                 \r
49                 System.out.println("hash="+hash+", time="+elapsedTime);\r
50                 \r
51         }\r
52         \r
53 }\r
54 \r