1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
| D:\soft\Java\jdk1.8.0_172\bin\java.exe "-javaagent:D:\soft\JetBrains\IntelliJ IDEA 2018.1.6\lib\idea_rt.jar=57167:D:\soft\JetBrains\IntelliJ IDEA 2018.1.6\bin" -Dfile.encoding=UTF-8 -classpath "D:\soft\Java\jdk1.8.0_172\jre\lib\charsets.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\deploy.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\access-bridge-64.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\cldrdata.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\dnsns.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\jaccess.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\jfxrt.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\localedata.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\nashorn.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\sunec.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\sunjce_provider.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\sunmscapi.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\sunpkcs11.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\ext\zipfs.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\javaws.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\jce.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\jfr.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\jfxswt.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\jsse.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\management-agent.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\plugin.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\resources.jar;D:\soft\Java\jdk1.8.0_172\jre\lib\rt.jar;D:\myworkspace\03mygithub\MyThread\bin;D:\soft\JetBrains\IntelliJ IDEA 2018.1.6\lib\junit-4.12.jar;D:\soft\JetBrains\IntelliJ IDEA 2018.1.6\lib\hamcrest-core-1.3.jar" com.zc.concurrent.issue.ReentrantLockVsSynchronizedTest ------------------------------------- // 线程数1,每个线程循环 100000 次 3789172(elapse), testLongAdder: result=100000, threadCount=1, loopCount=100000 6642633(elapse), testReentrantLockUnfair: result=100000, threadCount=1, loopCount=100000 6841152(elapse), testReentrantLockFair: result=100000, threadCount=1, loopCount=100000 8382098(elapse), testSynchronized: result=100000, threadCount=1, loopCount=100000 44980066(elapse), testAtomicInteger: result=100000, threadCount=1, loopCount=100000 ------------------------------------- // 线程数2,每个线程循环 100000 次 2647611(elapse), testLongAdder: result=300000, threadCount=2, loopCount=100000 3772457(elapse), testAtomicInteger: result=300000, threadCount=2, loopCount=100000 5013131(elapse), testSynchronized: result=300000, threadCount=2, loopCount=100000 5831547(elapse), testReentrantLockFair: result=300000, threadCount=2, loopCount=100000 9820412(elapse), testReentrantLockUnfair: result=300000, threadCount=2, loopCount=100000 ------------------------------------- // 线程数4,每个线程循环 100000 次 2838213(elapse), testSynchronized: result=700000, threadCount=4, loopCount=100000 3695923(elapse), testAtomicInteger: result=700000, threadCount=4, loopCount=100000 12967987(elapse), testLongAdder: result=700000, threadCount=4, loopCount=100000 13843291(elapse), testReentrantLockUnfair: result=700000, threadCount=4, loopCount=100000 1132170308(elapse), testReentrantLockFair: result=700000, threadCount=4, loopCount=100000 ------------------------------------- // 线程数6,每个线程循环 100000 次 2340008(elapse), testLongAdder: result=1300000, threadCount=6, loopCount=100000 5598133(elapse), testSynchronized: result=1300000, threadCount=6, loopCount=100000 11595358(elapse), testAtomicInteger: result=1300000, threadCount=6, loopCount=100000 17305800(elapse), testReentrantLockUnfair: result=1300000, threadCount=6, loopCount=100000 1706668497(elapse), testReentrantLockFair: result=1300000, threadCount=6, loopCount=100000 ------------------------------------- // 线程数8,每个线程循环 100000 次 2604212(elapse), testLongAdder: result=2100000, threadCount=8, loopCount=100000 7267222(elapse), testSynchronized: result=2100000, threadCount=8, loopCount=100000 15585101(elapse), testAtomicInteger: result=2100000, threadCount=8, loopCount=100000 20813467(elapse), testReentrantLockUnfair: result=2100000, threadCount=8, loopCount=100000 2392860159(elapse), testReentrantLockFair: result=2100000, threadCount=8, loopCount=100000 ------------------------------------- // 线程数10,每个线程循环 100000 次 6970763(elapse), testLongAdder: result=3100000, threadCount=10, loopCount=100000 9930961(elapse), testSynchronized: result=3100000, threadCount=10, loopCount=100000 20397367(elapse), testAtomicInteger: result=3100000, threadCount=10, loopCount=100000 25850936(elapse), testReentrantLockUnfair: result=3100000, threadCount=10, loopCount=100000 2794116491(elapse), testReentrantLockFair: result=3100000, threadCount=10, loopCount=100000 ------------------------------------- // 线程数50,每个线程循环 100000 次 14844099(elapse), testLongAdder: result=8100000, threadCount=50, loopCount=100000 47918859(elapse), testSynchronized: result=8100000, threadCount=50, loopCount=100000 98661562(elapse), testAtomicInteger: result=8100000, threadCount=50, loopCount=100000 126939598(elapse), testReentrantLockUnfair: result=8100000, threadCount=50, loopCount=100000 14410074177(elapse), testReentrantLockFair: result=8100000, threadCount=50, loopCount=100000 ------------------------------------- // 线程数100,每个线程循环 100000 次 29294384(elapse), testLongAdder: result=18100000, threadCount=100, loopCount=100000 90143110(elapse), testSynchronized: result=18100000, threadCount=100, loopCount=100000 193961488(elapse), testAtomicInteger: result=18100000, threadCount=100, loopCount=100000 244101889(elapse), testReentrantLockUnfair: result=18100000, threadCount=100, loopCount=100000 31166365222(elapse), testReentrantLockFair: result=18100000, threadCount=100, loopCount=100000 ------------------------------------- // 线程数200,每个线程循环 100000 次 69702637(elapse), testLongAdder: result=38100000, threadCount=200, loopCount=100000 170973104(elapse), testSynchronized: result=38100000, threadCount=200, loopCount=100000 341206964(elapse), testAtomicInteger: result=38100000, threadCount=200, loopCount=100000 489087584(elapse), testReentrantLockUnfair: result=38100000, threadCount=200, loopCount=100000 63709112896(elapse), testReentrantLockFair: result=38100000, threadCount=200, loopCount=100000 ------------------------------------- // 线程数500,每个线程循环 100000 次 133355267(elapse), testLongAdder: result=88100000, threadCount=500, loopCount=100000 465237384(elapse), testSynchronized: result=88100000, threadCount=500, loopCount=100000 982221507(elapse), testAtomicInteger: result=88100000, threadCount=500, loopCount=100000 1246923387(elapse), testReentrantLockUnfair: result=88100000, threadCount=500, loopCount=100000 163173197284(elapse), testReentrantLockFair: result=88100000, threadCount=500, loopCount=100000 ------------------------------------- ------------------------------------- // 线程数500,每个线程循环 10000 次 46909254(elapse), testSynchronized: result=93100000, threadCount=500, loopCount=10000 53434593(elapse), testLongAdder: result=93100000, threadCount=500, loopCount=10000 76151149(elapse), testAtomicInteger: result=93100000, threadCount=500, loopCount=10000 115951527(elapse), testReentrantLockUnfair: result=93100000, threadCount=500, loopCount=10000 16067416290(elapse), testReentrantLockFair: result=93100000, threadCount=500, loopCount=10000 ------------------------------------- // 线程数500,每个线程循环 1000 次 21785245(elapse), testLongAdder: result=93600000, threadCount=500, loopCount=1000 22926219(elapse), testSynchronized: result=93600000, threadCount=500, loopCount=1000 23726455(elapse), testAtomicInteger: result=93600000, threadCount=500, loopCount=1000 23893305(elapse), testReentrantLockUnfair: result=93600000, threadCount=500, loopCount=1000 1583798403(elapse), testReentrantLockFair: result=93600000, threadCount=500, loopCount=1000 ------------------------------------- // 线程数500,每个线程循环 100 次 21886704(elapse), testSynchronized: result=93650000, threadCount=500, loopCount=100 22070561(elapse), testReentrantLockUnfair: result=93650000, threadCount=500, loopCount=100 22847925(elapse), testLongAdder: result=93650000, threadCount=500, loopCount=100 24225539(elapse), testAtomicInteger: result=93650000, threadCount=500, loopCount=100 133848487(elapse), testReentrantLockFair: result=93650000, threadCount=500, loopCount=100 ------------------------------------- // 线程数500,每个线程循环 10 次 20742504(elapse), testSynchronized: result=93655000, threadCount=500, loopCount=10 21348326(elapse), testLongAdder: result=93655000, threadCount=500, loopCount=10 21286160(elapse), testReentrantLockUnfair: result=93655000, threadCount=500, loopCount=10 21943591(elapse), testAtomicInteger: result=93655000, threadCount=500, loopCount=10 22087863(elapse), testReentrantLockFair: result=93655000, threadCount=500, loopCount=10 ------------------------------------- // 线程数500,每个线程循环 1 次 20936918(elapse), testReentrantLockUnfair: result=93655500, threadCount=500, loopCount=1 21259769(elapse), testAtomicInteger: result=93655500, threadCount=500, loopCount=1 21328093(elapse), testLongAdder: result=93655500, threadCount=500, loopCount=1 22007810(elapse), testSynchronized: result=93655500, threadCount=500, loopCount=1 23318273(elapse), testReentrantLockFair: result=93655500, threadCount=500, loopCount=1 ------------------------------------- // 线程数1000,每个线程循环 1 次 53460398(elapse), testLongAdder: result=1500, threadCount=1000, loopCount=1 58974079(elapse), testAtomicInteger: result=1500, threadCount=1000, loopCount=1 82545706(elapse), testSynchronized: result=1500, threadCount=1000, loopCount=1 130621152(elapse), testReentrantLockFair: result=1500, threadCount=1000, loopCount=1 200410000(elapse), testReentrantLockUnfair: result=1500, threadCount=1000, loopCount=1 ------------------------------------- // 线程数1500,每个线程循环 1 次 84837038(elapse), testSynchronized: result=3000, threadCount=1500, loopCount=1 104347079(elapse), testAtomicInteger: result=3000, threadCount=1500, loopCount=1 109697722(elapse), testReentrantLockUnfair: result=3000, threadCount=1500, loopCount=1 138776874(elapse), testReentrantLockFair: result=3000, threadCount=1500, loopCount=1 212777150(elapse), testLongAdder: result=3000, threadCount=1500, loopCount=1 -------------------------------------
Process finished with exit code 0
|