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