1 # Copyright (c) 2025, 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 # Make a digest of bench.20250930.txt, etc, to be cut-and-pasted into ../../../../../README.md
23 #
24 # Example:
25 # tclsh digest.tcl bench.20250930.txt
26
27 set group {
28 helidon-quickstart-se "Helidon Quick Start"
29 javac_bench "JavacBenchApp 50 source files"
30 micronaut-first-app "Micronaut First App Demo"
31 quarkus-getting-started "Quarkus Getting Started Demo"
32 spring-boot-getting-started "Spring-boot Getting Started Demo"
33 spring-petclinic "Spring PetClinic Demo"
34 }
35
36 set file1 [lindex $argv 0]
37 set file2 [lindex $argv 1]
38 set fd [open $file1]
39 set data [read $fd]
40 close $fd
41
42 if {![regexp {built from https://github.com/openjdk/leyden/commit/([0-9a-z]+)} $data dummy version]} {
43 puts "Error: cannot find version"
44 exit 1
45 }
46
47 if {![regexp "processor\[\t \]+: (\[0-9\]+)" $data dummy cores]} {
48 puts "Error: cannot find cores"
49 exit 1
50 } else {
51 incr cores 1
52 }
53
54 puts "- Leyden: https://github.com/openjdk/leyden/tree/$version"
55 puts ""
56 puts "For details information about the hardware and raw numbers, see \[$file1\](test/hotspot/jtreg/premain/bench_data/$file1)"
57 puts " and \[$file2\](test/hotspot/jtreg/premain/bench_data/$file2)"
58 puts ""
59
60 set output ""
61 set section 1
62 set runs [list $file1 "Desktop/Server Class ($cores Cores)" $file2 "2 Cores Only"]
63 foreach {file type} $runs {
64 append output "### 5.$section Benchmark Results - $type\n"
65 set fd [open $file]
66 set speed ""
67 set i 0
68 while {![eof $fd]} {
69 set line [gets $fd]
70 if {[regexp {([0-9]+.[0-9]+x) improvement} $line dummy x]} {
71 set speed $x
72 } elseif {[regexp {[-]Normalized-----} $line]} {
73 set data ""
74
75 while {![eof $fd]} {
76 set line [gets $fd]
77 if {[regexp {[-]--------------------} $line]} {
78 break
79 } else {
80 append data $line\n
81 }
82 }
83 set name [lindex $group [expr $i * 2 + 1]]
84 append output "\n#### $name ($speed improvement - $type)\n\n"
85 append output "[string trim $data]\n"
86
87 set thename($i) $name
88 set summary($file,$i) $speed
89 set speed ""
90 incr i
91 }
92 }
93 incr section 1
94 }
95
96 puts "#### Premain AOT Cache Summary\n"
97
98 puts "This is the speed up of **premain aot cache** vs **mainline default** in the two types of configurations"
99 puts ""
100 puts "| Benchmark | [lindex $runs 1] | [lindex $runs 3]|"
101 puts "|:-------------|-------------:| -------------:|"
102
103 set total $i
104 set t1 [lindex $runs 0]
105 set t2 [lindex $runs 2]
106 for {set i 0} {$i < $total} {incr i} {
107 puts "| $thename($i) | $summary($t1,$i) | $summary($t2,$i) |"
108 }
109
110 puts ""
111 puts [string trim $output]
112