Skip to content

Commit de0cf7b

Browse files
committedMar 19, 2024
Added "make compare_premain_builds" and "make diff_training_logs" for pet-clinic

File tree

1 file changed

+62
-7
lines changed
  • test/hotspot/jtreg/premain/spring-petclinic

1 file changed

+62
-7
lines changed
 

‎test/hotspot/jtreg/premain/spring-petclinic/Makefile

+62-7
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,19 @@ PC_APP_UNPACKED = ${PC_REPO}/target/unpacked
6565
PC_APP_UNPACKED_ZIP = ${PC_REPO}/target/spring-petclinic-3.2.0.zip
6666

6767
PC_MAIN_CLASS = org.springframework.samples.petclinic.PetClinicApplication
68-
PC_CLASSLIST = spring-petclinic.classlist
69-
PC_STATIC_JSA = spring-petclinic.static.jsa
70-
PC_DYNAMIC_JSA = spring-petclinic.dynamic.jsa
71-
PC_CACHED_CODE = spring-petclinic.code.jsa
68+
69+
# Note: you can add specify PM_VER (PreMain Version) for comparing the performance of different builds of premain.
70+
# See the compare_premain_builds target below
71+
72+
# old workflow
73+
PC_CLASSLIST = spring-petclinic$(PM_VER).classlist
74+
PC_STATIC_JSA = spring-petclinic$(PM_VER).static.jsa
75+
PC_DYNAMIC_JSA = spring-petclinic$(PM_VER).dynamic.jsa
76+
PC_CACHED_CODE = spring-petclinic$(PM_VER).code.jsa
7277

7378
# new workflow
74-
PC_CDS_PREIMAGE = spring-petclinic.cds.preimage
75-
PC_CDS = spring-petclinic.cds
79+
PC_CDS_PREIMAGE = spring-petclinic$(PM_VER).cds.preimage
80+
PC_CDS = spring-petclinic$(PM_VER).cds
7681

7782
# TODO: should we add -Dspring.context.exit=onRefresh to command line??
7883
# This will make the JVM quit after printing this line:
@@ -153,7 +158,7 @@ ${PC_APP_UNPACKED}: ${PC_APP_JAR}
153158

154159
${PC_CLASSLIST}: ${PC_APP_UNPACKED}
155160
${PREMAIN_JAVA} -Xshare:off -XX:DumpLoadedClassList=${PC_CLASSLIST} \
156-
-Xlog:class+load=debug:file=spring-petclinic.classload.log ${SAVE_GEN_FILES} \
161+
-Xlog:class+load=debug:file=${PC_CLASSLIST}.classload.log ${SAVE_GEN_FILES} \
157162
${UNPACKED_CMDLINE}
158163
wc -lc ${PC_CLASSLIST}
159164

@@ -270,6 +275,8 @@ clean0:
270275
cleann:
271276
rm -fv spring-petclinic.cds.*
272277

278+
# You can choose a different number of loops like this:
279+
# make compare_premain_builds LOOPS="0 1 2" PM_OLD=.....
273280
LOOPS = 0 1 2 3 4 5 6 7 8 9 10
274281

275282
mainline_vs_premain:
@@ -286,3 +293,51 @@ mainline_vs_premain:
286293
fi; \
287294
first=0; \
288295
done
296+
297+
# Do something like this:
298+
# make compare_premain_builds \
299+
# PM_OLD=/repo/old/build/linux-x64/images/jdk \
300+
# PM_NEW=/repo/old/build/linux-x64/images/jdk
301+
# JDK17_HOME=/my/jdk/17/home
302+
303+
compare_premain_builds:
304+
@echo old build = ${PM_OLD}
305+
@echo New build = ${PM_NEW}
306+
@echo "Run,Old static CDS only,New static CDS only,Old static CDS + training + AOT,New static CDS + training + AOT,Old 1-step training,New 1-step training"
307+
@first=1; for i in ${LOOPS}; do \
308+
rm -f tmp.txt; \
309+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_OLD} PM_VER=.old runs | grep Booted >> tmp.txt; \
310+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_NEW} PM_VER=.new runs | grep Booted >> tmp.txt; \
311+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_OLD} PM_VER=.old run | grep Booted >> tmp.txt; \
312+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_NEW} PM_VER=.new run | grep Booted >> tmp.txt; \
313+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_OLD} PM_VER=.old runn | grep Booted >> tmp.txt; \
314+
$(MAKE) LOG_INIT= PREMAIN_HOME=${PM_NEW} PM_VER=.new runn | grep Booted >> tmp.txt; \
315+
if test "$$first" != "1"; then \
316+
echo $$i$$(cat tmp.txt | sed -e 's/.*in /,/g' -e 's/ms//g') | sed -e 's/ //g'; \
317+
fi; \
318+
first=0; \
319+
done
320+
321+
diff_training_logs:
322+
@for i in old new; do \
323+
grep cds,class spring-petclinic.$$i.static.jsa.log | \
324+
sed -e 's/.*0x[0-9a-f]* ..... //g' \
325+
-e 's/Lambda\/0x[0-9a-f]*/Lambda\/nnn/g' \
326+
-e 's/MH\/0x[0-9a-f]*/MH\/nnn/g' | \
327+
sort > old-workflow-static-classes.$$i.txt; \
328+
grep cds,class spring-petclinic.$$i.dynamic.jsa.log | \
329+
sed -e 's/.*0x[0-9a-f]* ..... //g' \
330+
-e 's/Lambda\/0x[0-9a-f]*/Lambda\/nnn/g' \
331+
-e 's/MH\/0x[0-9a-f]*/MH\/nnn/g' | \
332+
sort > old-workflow-dynamic-classes.$$i.txt; \
333+
grep cds,class spring-petclinic.$$i.cds.log | \
334+
sed -e 's/.*0x[0-9a-f]* ..... //g' \
335+
-e 's/Lambda\/0x[0-9a-f]*/Lambda\/nnn/g' \
336+
-e 's/MH\/0x[0-9a-f]*/MH\/nnn/g' | \
337+
sort > new-workflow-classes.$$i.txt; \
338+
done
339+
@ls -l *.old.txt *.new.txt
340+
@echo '***'
341+
@echo "You can diff the above files to diagnose speed differences between two builds"
342+
343+

0 commit comments

Comments
 (0)
Please sign in to comment.