> On Aug. 6, 2014, 11:10 p.m., Chris Riccomini wrote: > > samza-core/src/main/scala/org/apache/samza/container/RunLoop.scala, line 81 > > <https://reviews.apache.org/r/23715/diff/2/?file=653839#file653839line81> > > > > Can we just have nested updateTimer calls here? > > Yan Fang wrote: > I was trying to do a nested updateTimer. Because the updateTimer only > returns Util, if I nest the "val envelope = consumerMultiplexer.choose", then > "if (envelope != null) " will not have the "envelope". Any suggestion? > > Another option is to do the updateTimer in consumerMultiplexer class, > instead of RunLoop. Because we will have TimerUtils, seems not a big deal. > > What do you think? > > Chris Riccomini wrote: > Can you try parameterizing the return type for runCodeBlock? Something > like this: > > private def updateTimer[T](timer: Timer)(runCodeBlock: => T) = { > val startingTime = clock() > val returnVal = runCodeBlock > timer.update(clock() - startingTime) > returnVal > } > > Then, I think you can call: > > val retVal = updateTimer(timer) { > 7 + 5 > } > > And retVal should hold 12, and be of type Int.
yes, cool! - Yan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23715/#review49825 ----------------------------------------------------------- On Aug. 6, 2014, 4:17 p.m., Yan Fang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/23715/ > ----------------------------------------------------------- > > (Updated Aug. 6, 2014, 4:17 p.m.) > > > Review request for samza. > > > Repository: samza > > > Description > ------- > > Add metrics for choose/process/window/commit/send time > > > Diffs > ----- > > samza-core/src/main/scala/org/apache/samza/container/RunLoop.scala 7fb4763 > > samza-core/src/main/scala/org/apache/samza/container/SamzaContainerMetrics.scala > bcb3fa3 > samza-core/src/test/scala/org/apache/samza/container/TestRunLoop.scala > d4ceffc > > Diff: https://reviews.apache.org/r/23715/diff/ > > > Testing > ------- > > > Thanks, > > Yan Fang > >
