1 # Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 3 #
 4 # This code is free software; you can redistribute it and/or modify it
 5 # under the terms of the GNU General Public License version 2 only, as
 6 # published by the Free Software Foundation.
 7 #
 8 # This code is distributed in the hope that it will be useful, but WITHOUT
 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11 # version 2 for more details (a copy is included in the LICENSE file that
12 # accompanied this code).
13 #
14 # You should have received a copy of the GNU General Public License version
15 # 2 along with this work; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 #
18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 # or visit www.oracle.com if you need additional information or have any
20 # questions.
21 
22 # Compare the performance of petclinic with two JDK builds
23 # - Do the training run 10 times.
24 # - After each training run, run petclinic 10 times
25 #
26 # To compare the results, run result.sh
27 
28 #------------------------------ configuration --------------------
29 OLD_DIR=/jdk3/le4/open/test/hotspot/jtreg/premain/spring-petclinic
30 NEW_DIR=/jdk3/le3/open/test/hotspot/jtreg/premain/spring-petclinic
31 
32 OLD_HOME=/jdk3/bld/le4/images/jdk
33 NEW_HOME=/jdk3/bld/le3/images/jdk
34 
35 OLD_JVM=$OLD_HOME/bin/java
36 NEW_JVM=$NEW_HOME/bin/java
37 #------------------------------ configuration end-----------------
38 
39 cd ~/tmp/
40 mkdir -p pet-clinic-bench
41 cd pet-clinic-bench
42 mkdir -p data
43 
44 CMDLINE="-XX:SharedArchiveFile=spring-petclinic.dynamic.jsa -XX:+ReplayTraining -XX:+LoadCachedCode"
45 CMDLINE="$CMDLINE -XX:CachedCodeFile=spring-petclinic.code.jsa -Xlog:init -Xlog:scc=error -Xmx2g"
46 CMDLINE="$CMDLINE -cp @petclinic-snapshot/target/unpacked/classpath -DautoQuit=true"
47 CMDLINE="$CMDLINE -Dspring.aot.enabled=true org.springframework.samples.petclinic.PetClinicApplication"
48 
49 (
50 set -x
51 
52 for i in {1..10}; do
53     echo "make old $i"
54     (cd $OLD_DIR; make clean0; make PREMAIN_HOME=$OLD_HOME run 2>&1) > data/make.old.$i
55     grep "Booted and returned" data/make.old.$i
56 
57     echo "make new $i"
58     (cd $NEW_DIR; make clean0; make PREMAIN_HOME=$NEW_HOME run 2>&1) > data/make.new.$i
59     grep "Booted and returned" data/make.new.$i
60 
61     rm -f data/time.old.$i
62     rm -f data/time.new.$i
63 
64     for j in {1..10}; do
65         sync; echo 'after 100' | tclsh
66         (cd $OLD_DIR; $OLD_JVM $CMDLINE 2>&1) > tmp.txt
67         cat tmp.txt >> data/time.old.$i
68         echo $i $j old $(grep "Booted and returned" tmp.txt)
69 
70         sync; echo 'after 100' | tclsh
71         (cd $NEW_DIR; $NEW_JVM $CMDLINE 2>&1) > tmp.txt
72         cat tmp.txt >> data/time.new.$i
73         echo $i $j new $(grep "Booted and returned" tmp.txt)
74     done
75 done
76 ) 2>&1 | tee log.txt