scala Play Framework 2.5 で Java ReactiveX (RxJava) を使用して、couchbase と非同期的に通信しています。オブザーバブルの実行にかかった時間を知りたいですか? 以下のコードを使用してオブザーバブルを定義します。
def get(id: String) : Observable[Profile] = {
this.bucket
.async()
// can I have a start time here possibly using map?
.get(id)
.map[Profile](toProfile)
// can I have an end time here possibly using map?
}
私は以下を使用してそれを呼び出します
Thread.sleep(1000)
val observable = get("myID")
Thread.sleep(1000)
// measure start time here
println("observable: " + observable.toBlocking.first())
// measure end time here
Thread.sleep(1000)
オブザーバブルの実行にかかった時間をどのように測定できますか?
よろしくお願いします
フランシス