author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 19 Jan 2013 23:54:47 +0000 | |
branch | refactoring-vmdata |
changeset 1986 | 9e63ab553922 |
parent 1818 | 2e5ed72e7dfd |
child 2014 | 9fa66342102b |
permissions | -rw-r--r-- |
1761 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
||
4 |
New code and modifications done at SWING Research Group [1]: |
|
5 |
||
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
16 |
[1] Code written at SWING Research Group contains a signature |
|
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
19 |
as of 1.9.2010 |
|
20 |
" |
|
21 |
"{ Package: 'stx:libjava/benchmarks' }" |
|
22 |
||
23 |
Object subclass:#JavaBenchmark |
|
1788 | 24 |
instanceVariableNames:'profiler' |
1761 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Benchmarks-Java-Framework' |
|
28 |
! |
|
29 |
||
30 |
!JavaBenchmark class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
35 |
||
36 |
New code and modifications done at SWING Research Group [1]: |
|
37 |
||
38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
48 |
[1] Code written at SWING Research Group contains a signature |
|
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
51 |
as of 1.9.2010 |
|
52 |
||
53 |
" |
|
54 |
! ! |
|
55 |
||
1788 | 56 |
!JavaBenchmark methodsFor:'accessing'! |
57 |
||
58 |
profiler |
|
59 |
^ profiler |
|
60 |
! |
|
61 |
||
62 |
profiler:something |
|
63 |
profiler := something. |
|
64 |
! ! |
|
65 |
||
66 |
!JavaBenchmark methodsFor:'profiling'! |
|
67 |
||
68 |
profileStart |
|
69 |
profiler == #callgrind ifTrue:[ |
|
70 |
Profiler valgrind callgrindInstrumentationStart |
|
71 |
]. |
|
72 |
||
73 |
"Created: / 02-11-2012 / 02:28:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
profileStop |
|
77 |
profiler == #callgrind ifTrue:[ |
|
78 |
Profiler valgrind callgrindInstrumentationStop |
|
79 |
]. |
|
80 |
||
81 |
"Created: / 02-11-2012 / 02:28:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
82 |
! ! |
|
83 |
||
1761 | 84 |
!JavaBenchmark methodsFor:'running'! |
85 |
||
86 |
runBenchmarkJ: n |
|
1762 | 87 |
"Actually run a **Java** benchmark. Return time in milliseconds or |
1761 | 88 |
string 'N/A' if there is no Java equivalent of the benchmark" |
89 |
||
90 |
| bench | |
|
91 |
||
1785 | 92 |
bench := (Java classForName: 'stx.libjava.benchmarks.' , self class name). |
1775 | 93 |
|
94 |
^(bench >> #'runBenchmarkJ(I)J') |
|
1774 | 95 |
valueWithReceiver: bench arguments: (Array with: n) |
1761 | 96 |
|
97 |
"Created: / 31-10-2012 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1774 | 98 |
"Modified: / 31-10-2012 / 21:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1775 | 99 |
"Modified (format): / 31-10-2012 / 22:52:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1762 | 100 |
! |
101 |
||
1780 | 102 |
runBenchmarkS2J: n |
103 |
"Actually run a cross-language call variant of the benchmark |
|
104 |
(i.e., Smalltalk calling Java or vice versa). Return time in milliseconds or |
|
105 |
string 'N/A' if there is no cross-call equivalent of the benchmark" |
|
106 |
||
107 |
^'N/A' |
|
108 |
||
109 |
"Created: / 31-10-2012 / 23:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
110 |
! |
|
111 |
||
1762 | 112 |
runBenchmarkS:n |
113 |
"Actually run a **Smalltalk** benchmark. Return time in milliseconds or |
|
114 |
string 'N/A' if there is no Smalltalk equivalent of the benchmark" |
|
115 |
||
116 |
^ self subclassResponsibility |
|
117 |
||
118 |
"Created: / 31-10-2012 / 10:26:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
119 |
! ! |
|
120 |
||
121 |
!JavaBenchmark methodsFor:'running-API'! |
|
122 |
||
123 |
runJ: passes |
|
1783 | 124 |
"Run **Java** version of the benchmark. Do the warmup" |
125 |
||
126 |
| time | |
|
1762 | 127 |
|
128 |
"Here, we have to do the warmup twice. First, to |
|
129 |
load all the Java code and an make sure methods |
|
130 |
are in oldspace (for ILCs), second to force resolve |
|
131 |
and machine-compile Java code" |
|
132 |
||
133 |
JavaVM booted ifFalse:[ |
|
134 |
Java flushAllJavaResources. |
|
135 |
Java initialize. |
|
136 |
JavaVM initializeVM. |
|
137 |
]. |
|
138 |
||
1781 | 139 |
self runBenchmarkJ: 2. |
1762 | 140 |
ObjectMemory scavenge. |
141 |
ObjectMemory tenure. |
|
1782 | 142 |
self runBenchmarkJ: 2. |
143 |
||
1788 | 144 |
self profileStart. |
1806 | 145 |
ObjectMemory debugBreakPoint3. |
1783 | 146 |
time := self runBenchmarkJ: passes. |
1788 | 147 |
self profileStop. |
1783 | 148 |
JavaVM performance printCountersOn: Stdout. |
149 |
^time. |
|
1762 | 150 |
|
151 |
"Created: / 31-10-2012 / 11:15:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1811 | 152 |
"Modified: / 07-11-2012 / 20:41:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1762 | 153 |
! |
154 |
||
1780 | 155 |
runS2J: passes |
1783 | 156 |
"Run **cross-language** version of the benchmark. Do the warmup" |
157 |
||
158 |
| time | |
|
1780 | 159 |
|
160 |
"Here, we have to do the warmup twice. First, to |
|
161 |
load all the Java code and an make sure methods |
|
162 |
are in oldspace (for ILCs), second to force resolve |
|
163 |
and machine-compile Java code" |
|
164 |
||
165 |
JavaVM booted ifFalse:[ |
|
166 |
Java flushAllJavaResources. |
|
167 |
Java initialize. |
|
168 |
JavaVM initializeVM. |
|
169 |
]. |
|
170 |
||
1781 | 171 |
self runBenchmarkS2J: 2. |
1780 | 172 |
ObjectMemory scavenge. |
173 |
ObjectMemory tenure. |
|
1781 | 174 |
self runBenchmarkS2J: 2. |
175 |
||
1788 | 176 |
self profileStart. |
1785 | 177 |
time := self runBenchmarkS2J: passes. |
1788 | 178 |
self profileStop. |
1783 | 179 |
JavaVM performance printCountersOn: Stdout. |
180 |
^time. |
|
181 |
||
1780 | 182 |
"Created: / 31-10-2012 / 23:40:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1811 | 183 |
"Modified: / 07-11-2012 / 20:41:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1780 | 184 |
! |
185 |
||
1762 | 186 |
runS: passes |
187 |
"Run **Smalltalk** version of the benchmark. Do the warmup" |
|
188 |
||
1788 | 189 |
| time | |
190 |
||
1790
7415875de93d
More results + fix for running Smalltalk benchmarks (JIT enabled)
vranyj1
parents:
1788
diff
changeset
|
191 |
ObjectMemory justInTimeCompilation: true. |
7415875de93d
More results + fix for running Smalltalk benchmarks (JIT enabled)
vranyj1
parents:
1788
diff
changeset
|
192 |
|
1781 | 193 |
self runBenchmarkS: 2. |
1762 | 194 |
ObjectMemory scavenge. |
195 |
ObjectMemory tenure. |
|
1781 | 196 |
self runBenchmarkS: 2. |
1788 | 197 |
self profileStart. |
198 |
time := self runBenchmarkS: passes. |
|
199 |
self profileStop. |
|
200 |
^time |
|
1762 | 201 |
|
202 |
"Created: / 31-10-2012 / 11:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1788 | 203 |
"Modified: / 02-11-2012 / 02:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1761 | 204 |
! ! |
205 |
||
206 |
!JavaBenchmark class methodsFor:'documentation'! |
|
207 |
||
208 |
version_SVN |
|
209 |
^ '$Id:: $' |
|
210 |
! ! |