MeasureMemoryをオンにしてテストを行っていたところ、「NonConstantMemoryUsage」例外が発生していました。
エラーメッセージで示されているように、担当者を変更しませんでした。私は何が欠けていますか?
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 1 elements with size 24 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 1 elements with size 24 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 34 elements with size 88 bytes
[caliper] allocating char array with 1 elements with size 24 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 1 elements with size 24 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 16 elements with size 48 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 70 elements with size 160 bytes
[caliper] allocating char array with 1 elements with size 24 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating char array with 142 elements with size 304 bytes
[caliper] allocating char array with 74 elements with size 168 bytes
[caliper] allocating java/lang/String with size 32 bytes
[caliper] allocating org/apache/commons/collections/map/AbstractReferenceMap$WeakRef with size 32 bytes
[caliper] allocating org/apache/commons/collections/map/AbstractReferenceMap$ReferenceEntry with size 32 bytes
[caliper] allocating java/lang/Object array with 0 elements with size 16 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating org/joda/time/DateTime with size 24 bytes
[caliper] allocating org/hibernate/util/IdentityMap$IdentityKey with size 16 bytes
[caliper] allocating org/hibernate/event/LoadEvent with size 40 bytes
[caliper] allocating org/hibernate/engine/EntityKey with size 48 bytes
[caliper] allocating org/hibernate/event/LoadEvent with size 40 bytes
[caliper] allocating org/hibernate/engine/EntityKey with size 48 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] allocating java/lang/Object array with 1 elements with size 24 bytes
[caliper] ...more allocations...
[caliper] [done measured section]
[caliper] 482 instance(s) allocated per rep
[caliper] 0 out of thread instance(s) allocated in 1 reps
[caliper] [starting measured section]
[caliper] see first run for list of allocations
[caliper] [done measured section]
[caliper] 2966 instance(s) allocated per rep
[caliper] 0 out of thread instance(s) allocated in 2 reps
エラー:内部ループのすべての担当者が同じ回数を割り当てるわけではありません!担当者ループは、一定数の割り当てを使用する必要があります。ループ内で担当者の値を使用していますか?
今のところ、さらに続行できるように、NonConstantMemoryUsageをスローしていたAllocationMeasurerのコードにコメントしました(それが良いアイデアかどうかはわかりません!)。現在、負のバイト割り当てが発生しています。
0% Scenario{vm=java, trial=0, benchmark=GetCompleteUserInfoByEmail, length=1, trials=5, memory=-Xmx1024M} 5017892000.00 ns; σ=18238565.40 ns @ 3 trials, allocated -45356 instances for a total of -2873264B
50% Scenario{vm=java, trial=0, benchmark=GetUserByEmail, length=10, trials=5, memory=-Xmx1024M} 5044517000.00 ns; σ=25651666.81 ns @ 3 trials, allocated -45816 instances for a total of -2873264B
length instances B s linear runtime
1 -45356.000 -2873264.000 5.02 =============================
10 -45816.000 -2873264.000 5.04 ==============================
vm:java
トライアル:0
ベンチマーク:GetCompleteUserInfoByEmail
トライアル:5
メモリ:-Xmx1024M