Keeping track of time taken by each handler and function

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Keeping track of time taken by each handler and function

Post by kaveh1000 » Wed Feb 01, 2023 3:36 pm

I have a stack with several scripts and many handlers. I want to track taken by each hander and functions in order to see where the bottlenecks are and make them more efficient. I now put these lines around each handler:

Code: Select all

   put the millisecs into ms
   answer the millisecs - ms
but it is labour intensive. Any way of tracking times taken by handlers without this method?. Thanks.
Kaveh

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Keeping track of time taken by each handler and function

Post by dunbarx » Wed Feb 01, 2023 4:13 pm

Kaveh1000

I assume you meant something like:

Code: Select all

on mouseUp
  put the milliseconds into startTime
  doStuff
  answer the milliseconds - startTime
 end mouseUp
Gives the time to do "doStuff". But it is only two extra lines of code. Why do you think this is labor intensive?

Craig

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Keeping track of time taken by each handler and function

Post by kaveh1000 » Wed Feb 01, 2023 4:25 pm

Hi Craig

I have probably 100 or more handlers. Also each handler has other handlers and functions inside. So I am having to put these lines around each handler one by one. So was wondering any way of getting a list of every handler and the time it took to do its job!

Regards
Kaveh
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Keeping track of time taken by each handler and function

Post by FourthWorld » Wed Feb 01, 2023 4:48 pm

4W Flight Recorder will give you relative times of everything triggered while it's monitoring.

You can get it from the Stacks section of LiveNet - in the IDE see Development -> Plugins -> GoLiveNet
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mtalluto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 125
Joined: Tue Apr 11, 2006 7:02 pm
Location: Seattle, WA
Contact:

Re: Keeping track of time taken by each handler and function

Post by mtalluto » Wed Feb 01, 2023 5:59 pm

You can use the built in profiler. It works similarly to Richard’s flight recorder.
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Keeping track of time taken by each handler and function

Post by kaveh1000 » Wed Feb 01, 2023 6:03 pm

Thanks Mark. Seems Profiler only in Business edition ;-)
Kaveh

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Keeping track of time taken by each handler and function

Post by bn » Wed Feb 01, 2023 7:37 pm

kaveh1000 wrote:
Wed Feb 01, 2023 6:03 pm
Thanks Mark. Seems Profiler only in Business edition ;-)
PowerDebug from Mark Wieder has a profiling option. Similar to the profiling of the business edition.
It is not free but it is a lifetime license.


https://www.ahsoftware.net/PowerTools/PowerDebug.lc

Kind regards
Bernd

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Keeping track of time taken by each handler and function

Post by kaveh1000 » Thu Feb 02, 2023 7:09 pm

Thank you all. I had no idea about any of these tools. :-)
Kaveh

Post Reply

Return to “Talking LiveCode”