"Fossies" - the Fresh Open Source Software Archive 
Member "apache-log4j-2.12.4-src/log4j-core/src/test/resources/perf/SimplePerfTest.sh" (20 Dec 2021, 2536 Bytes) of package /linux/misc/apache-log4j-2.12.4-src.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/sh
2 #
3 #
4 # Licensed to the Apache Software Foundation (ASF) under one
5 # or more contributor license agreements. See the NOTICE file
6 # distributed with this work for additional information
7 # regarding copyright ownership. The ASF licenses this file
8 # to you under the Apache License, Version 2.0 (the
9 # "License"); you may not use this file except in compliance
10 # with the License. You may obtain a copy of the License at
11 #
12 # http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing,
15 # software distributed under the License is distributed on an
16 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 # KIND, either express or implied. See the License for the
18 # specific language governing permissions and limitations
19 # under the License.
20 #
21 if [ $# -eq 0 ]; then
22 echo Usage: $0 api-version core-version
23 exit 1
24 fi
25
26 DIR=$HOME
27 NOW=$(date +%Y%m%d-%H%M%S)
28
29 GC_OPTIONS="-XX:+UnlockDiagnosticVMOptions -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
30 GC_OPTIONS="${GC_OPTIONS} -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime"
31 GC_OPTIONS="${GC_OPTIONS} -XX:+PrintGCCause -Xloggc:$DIR/gc-$NOW.log"
32 #GC_OPTIONS="${GC_OPTIONS} -XX:+PrintSafepointStatistics -XX:+LogVMOutput -XX:LogFile=$DIR/safepoint$NOW.log"
33 GC_OPTIONS=
34
35 # Needs -XX:+UnlockDiagnosticVMOptions (as first VM arg)
36 #VM_OPTIONS="-XX:+PrintCompilation -XX:+PrintInlining"
37
38 LOG4J_OPTIONS="-Dlog4j.configurationFile=perf-CountingNoOpAppender.xml"
39 LOG4J_OPTIONS="${LOG4J_OPTIONS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
40 LOG4J_OPTIONS="${LOG4J_OPTIONS} -Dlog4j2.enable.threadlocals=true"
41 LOG4J_OPTIONS="${LOG4J_OPTIONS} -DAsyncLogger.WaitStrategy=Block"
42 LOG4J_OPTIONS="${LOG4J_OPTIONS} -Dlog4j.format.msg.async=true"
43 export LOG4J_OPTIONS
44
45 CP="log4j-api-${1}.jar:log4j-core-${2}.jar:disruptor-3.3.4.jar"
46 CP="${CP}:log4j-core-2.6-SNAPSHOT-tests.jar"
47 #CP="${CP}:${HOME}/Documents/log4j/log4j-core/target/test-classes"
48 export CP
49
50 export MEM_OPTIONS="-Xms128m -Xmx128m"
51 export MAIN="org.apache.logging.log4j.core.async.perftest.SimplePerfTest"
52
53 #PERF_OPTIONS="-e cycles,instructions,cache-references,cache-misses,branches,branch-misses,L1-dcache-loads,L1-dcache-load-misses,dTLB-loads,dTLB-load-misses"
54 PERF_OPTIONS=
55 #perf stat ${PERF_OPTIONS} java ${MEM_OPTIONS} ${GC_OPTIONS} ${VM_OPTIONS} ${LOG4J_OPTIONS} -cp "${CP}" ${MAIN}
56
57 java ${MEM_OPTIONS} ${GC_OPTIONS} ${VM_OPTIONS} ${LOG4J_OPTIONS} -cp "${CP}" ${MAIN}