Github user hhbyyh commented on the pull request:

    https://github.com/apache/spark/pull/7871#issuecomment-127111587
  
    Oh I should have made it more clear. An example:
    ```
      def run(): Unit ={
        val conf = new SparkConf().setMaster("local").setAppName("ss")
        val sc = new SparkContext(conf)
        val multiTimer = new MultiStopwatch(sc)
        for(i <- 0 to 2) {
          someFunction(multiTimer)
        }
      }
    
      def someFunction(multiTimer: MultiStopwatch): Unit ={
        multiTimer.addLocal("total")
        multiTimer("total").start()
        // ...
        multiTimer("total").stop()
      }
    ```
    will throw `Exception in thread "main" java.lang.IllegalArgumentException: 
requirement failed: Stopwatch with name total already exists.`
    This is probably by design, yet it's not quite handy. Since users will have 
to:
    1. avoid passing MultiStopwatch around as a parameter 
    2. or avoid invoking `someFunction` multiple times.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to