[ https://issues.apache.org/jira/browse/LANG-1504?focusedWorklogId=364811&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-364811 ]
ASF GitHub Bot logged work on LANG-1504: ---------------------------------------- Author: ASF GitHub Bot Created on: 31/Dec/19 01:22 Start Date: 31/Dec/19 01:22 Worklog Time Spent: 10m Work Description: garydgregory commented on issue #482: LANG-1504 - Adding steps feature to StopWatch URL: https://github.com/apache/commons-lang/pull/482#issuecomment-569841120 Since we already have split() we should keep the name. Another idea, is that split times should be kept in history list. But then, I'd want a list of pairs (message-split time) and it starts to feel like feature creep ;-) Split history example in Android: https://ibb.co/g9cbGXn I'm not sure how handy this would as I do not have a use case for it. I'd like to cut a RC later this week. There is already plenty for a release ATM but let's keep the discussion going :-) Gary On Mon, Dec 30, 2019 at 7:22 PM Rafael Topera <notificati...@github.com> wrote: > 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** > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/apache/commons-lang/pull/482?email_source=notifications&email_token=AAJB6N2KGGVNWSYE637EDE3Q3KGE3A5CNFSM4KBARU2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH3P46Y#issuecomment-569835131>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAJB6NYOU656F74UM24RTRLQ3KGE3ANCNFSM4KBARU2A> > . > ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 364811) Time Spent: 1h (was: 50m) > StopWatch: steps feature > ------------------------ > > Key: LANG-1504 > URL: https://issues.apache.org/jira/browse/LANG-1504 > Project: Commons Lang > Issue Type: New Feature > Components: lang.time.* > Reporter: Rafael Santos > Priority: Major > Time Spent: 1h > Remaining Estimate: 0h > > Would be great if we could use StopWatch to track times on many places of our > code. > I created a new feature called "*steps*". > > With this feature we can add label to each step and then get a report with > time between each step. > > Example: > {code:java} > final StopWatch watch = new StopWatch(); > watch.step("starting"); > exampleGoSleep(); > watch.step("sleeping"); > exampleGoWalk(); > watch.step("walking "); > exampleGoDance(); > watch.step("dancing "); > System.out.println(watch.getStepsReport()); > {code} > The output would be: > {noformat} > [starting] 0ms > [sleeping] 235ms > [walking ] 20ms > [dancing ] 458ms > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)