You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/12/31 00:23:14 UTC

[GitHub] [commons-lang] topera edited a comment on issue #482: LANG-1504 - Adding steps feature to StopWatch

topera edited a comment on issue #482: LANG-1504 - Adding steps feature to StopWatch
URL: https://github.com/apache/commons-lang/pull/482#issuecomment-569835131
 
 
   > FYI, the conventional name for what you call "step" is "split", sometimes also "lap" (less modern terminology.)
   
   I didn`t know that, thanks for sharing :)
   
   I take a look now and the StopWatch already has the **split** method, but works in a different way.
   
   Some differences:
   1. With **split** we need to call **getSplitTime** while we are in the middle of split (I mean, before calling **unsplit**). In the "steps" solution we can get all times in a separated report, at the end of our performance test, for example.
   
   2. With **split** we can have just one split each time. With **steps**, many
   
   3. With **steps** we can label each step with a name
   
   4. Split counts the time since the StopWatch started, not the time between splits.
   Example
   
   ```
   final StopWatch sw = StopWatch.createStarted();
   
           Thread.sleep(100);
   
           sw.split();
   
           Thread.sleep(200);
   
           sw.split();
   
           Thread.sleep(400);
   
           System.out.println("splitTime: " + sw.getSplitTime()); // returns 300: the time between start and latest split
           System.out.println("time: " + sw.getTime()); // returns 700
   ```
   
   So, my proposal is to use a new name no change the idea of the old split.
   Possibilities: **lap** (as you said), **step**, **stage**
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services