Answer the question
In order to leave comments, you need to log in
How to monitor the execution of methods in Scala?
There is some Scala code.
def computations1(params: AnyRef*): Future[ComputaionResults] ={
//computations
}
def computations2(params: AnyRef*): Future[ComputaionResults] ={
//computations
}
for{
results1 <- computations1()
results2 <- computations2()
} yield {
//do with results
}
Answer the question
In order to leave comments, you need to log in
def time[R](block: => R): R = {
val t0 = System.nanoTime()
val result = block // call-by-name
val t1 = System.nanoTime()
println("Elapsed time: " + (t1 - t0) + "ns")
result
}
// Now wrap your method calls, for example change this...
val result = 1 to 1000 sum
// ... into this
val result = time { 1 to 1000 sum }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question