yuin #897(2007/07/15 06:49 GMT) [ Scala ] Rating0/0=0.00
オーバーロードされたメソッドがあっても始めに見つかったメソッドのみ対象。
1 2 3 4 5 6 7 8 9 10 11 12
def profile(args: Any*):Unit = { val f = getClass.getDeclaredMethods.find(_.getName.startsWith("func")).get val start = System.nanoTime f.invoke(this, args.map(_.asInstanceOf[AnyRef]).toArray) println(System.nanoTime-start + " nano seconds.") } def func(i:Int, j:Int):Unit = { println(i, j) } profile(1,2)
Rating0/0=0.00-0+
[ reply ]
yuin
#897()
[
Scala
]
Rating0/0=0.00
def profile(args: Any*):Unit = { val f = getClass.getDeclaredMethods.find(_.getName.startsWith("func")).get val start = System.nanoTime f.invoke(this, args.map(_.asInstanceOf[AnyRef]).toArray) println(System.nanoTime-start + " nano seconds.") } def func(i:Int, j:Int):Unit = { println(i, j) } profile(1,2)Rating0/0=0.00-0+
[ reply ]