のパフォーマンスを測定しようとしていますDatabase Insert
。これらすべてのパフォーマンス数値をConcurrentHashMap
. これらの数値のヒストグラムを作成しようとしています。
その同時ハッシュマップでは、このようなものになります。例を引用しています。しかし、そのマップにはより多くのデータがあり、より多くのキーと値のペアを意味します。
Key- 11
Value- 2
つまり、11 ミリ秒で 2 つのコールが返ってきました。以下の別の例
Key - 30
Value -1
つまり、1 コールが 30 ミリ秒で戻ってきました。
上記の地図に基づいて、私はこのようなことをしようとしています-
Number of calls came back in between 1 and 10 ms
Number of calls came back in between 10 and 20 ms
Number of calls came back in between 20 and 30 ms
Number of calls came back in between 30 and 40 ms
Number of calls came back in between 40 and 50 ms
Number of calls came back in between 50 and 60 ms
Number of calls came back in between 60 and 70 ms
Number of calls came back in between 70 and 80 ms
Number of calls came back in between 80 and 90 ms
Number of calls came back in between 90 and 100 ms
Number of calls came back in greater than 100 ms
そのマップから上記のようなヒストグラムを作成する簡単な方法を見つけることができません。私が考えることができるのは、さまざまなカウンターをハードコーディングし、その特定の範囲内にある場合はそれらのカウンターを増やし続けることだけです。しかし、これはきれいな方法ではないようです。どうすればこの問題を解決できますか?
private static void logHistogramInfo() {
// here histogram is the concurrenthashmap
System.out.println(histogram);
}