Get time for debugging purposes
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Get time for debugging purposes
How in xlisp can I get current clock time so I can print it?
Or otherwise figure out where time is going in my code?
Or otherwise figure out where time is going in my code?
-
kozikowski
- Forum Staff
- Posts: 68902
- Joined: Thu Aug 02, 2007 5:57 pm
- Operating System: macOS 10.13 High Sierra
Re: Get time for debugging purposes
Are you working up to give Audacity Time Of Day? That would be welcome.
Koz
Koz
Re: Get time for debugging purposes
I don't think that you can, though it might be a nice feature for version 4 plug-ins.Paul L wrote:How in xlisp can I get current clock time so I can print it?
How "fine grained" do you want to get?Paul L wrote:Or otherwise figure out where time is going in my code?
You can approximate the time taken by a function by looping through it a large number of times.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Get time for debugging purposes
Is there a more complete XLISP reference than http://www.cs.cmu.edu/~rbd/doc/nyquist/part19.html ?
I am referring to Common Lisp: The Language by Guy Steele. It dates from the 1980s, but apparently so does that web page. The book doesn't have the object oriented stuff but it describes many things, some of which I find usable in the Nyquist prompt, others not.
For instance, today I discovered the incf and decf macros, which I don't need to redefine for myself. But it was the book that told me that, not the web page.
I am referring to Common Lisp: The Language by Guy Steele. It dates from the 1980s, but apparently so does that web page. The book doesn't have the object oriented stuff but it describes many things, some of which I find usable in the Nyquist prompt, others not.
For instance, today I discovered the incf and decf macros, which I don't need to redefine for myself. But it was the book that told me that, not the web page.
Re: Get time for debugging purposes
This is the main XLISP manual that I use: http://www.audacity-forum.de/download/e ... -index.htm
The language reference (http://www.audacity-forum.de/download/e ... -index.htm) is particularly useful as it provides examples for most of the functions.
The language reference (http://www.audacity-forum.de/download/e ... -index.htm) is particularly useful as it provides examples for most of the functions.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Get time for debugging purposes
I don't think that INCF and DECF are standard XLISP functions, though they are available in Nyquist and appear in the Nyquist index: http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Robert J. H.
- Posts: 3633
- Joined: Thu May 31, 2012 8:33 am
- Operating System: Windows 10
Re: Get time for debugging purposes
It is a common LISP standard function. It unfortunately misses the optional increase amount. I've seen Paul's inc definition in the first plug-in and was wondering why he uses practically the same macro code...steve wrote:I don't think that INCF and DECF are standard XLISP functions, though they are available in Nyquist and appear in the Nyquist index: http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
The macros are also listed in my "Nyquist Reference" plug-in.
-
Robert J. H.
- Posts: 3633
- Joined: Thu May 31, 2012 8:33 am
- Operating System: Windows 10
Re: Get time for debugging purposes
By the way, I've contacted Edgar about a possible clock implementation in Nyquist. That was about 3 weeks ago.
If the system function would work, the matter would be easy by echoing the system time into a file or by setting up a system variable that can be read out by get-env.
I hope Edgar will find a solution (he's always very busy...).
If the system function would work, the matter would be easy by echoing the system time into a file or by setting up a system variable that can be read out by get-env.
I hope Edgar will find a solution (he's always very busy...).
Re: Get time for debugging purposes
I have an edition of Steele dated 1984. Is that still a good reference?
Is there a function that simply dumps all defined function and macro names? I could see what parts are implemented and which not.
I have noticed that not all is as in the book. For instance: make-array cannot take a list of dimensions but only a single number.
And also: (return-from tag value) is supposed to require that tag is in lexical scope, according to the book, but contrary to the book (and sometimes usefully for debugging), in Nyquist the tag is dynamically scoped, so I can write a long distance exit from any named function higher up the call stack at the time.
Is there a function that simply dumps all defined function and macro names? I could see what parts are implemented and which not.
I have noticed that not all is as in the book. For instance: make-array cannot take a list of dimensions but only a single number.
And also: (return-from tag value) is supposed to require that tag is in lexical scope, according to the book, but contrary to the book (and sometimes usefully for debugging), in Nyquist the tag is dynamically scoped, so I can write a long distance exit from any named function higher up the call stack at the time.
Re: Get time for debugging purposes
There's quite a lot more stuff in Common Lisp that in XLISP. You'll probably get quite frustrated if you use a book about Common Lisp as a language reference, but it will probably still be an excellent reference for other things, such as how to write in a "Lisp-like" way.
When I started using Nyquist, there was very little documentation. There was a Nyquist manual (similar to the current manual but less complete and less accurate), a brief introduction to XLISP by Edgar-rft, and (I think version 1 of) the XLISP manual by David Michael Betz, and the original version of this: http://audacityteam.org/help/nyquist There were also a few Nyquist plug-ins shipped with Audacity that could be used as examples, but they were not written by experienced LISP programmers so were not particularly good examples of "the right way" to write.
Since then, those documents have all been updated and expanded, and Edgar-rft wrote this "Nyquist Plug-ins Reference": http://wiki.audacityteam.org/wiki/Nyqui ... _Reference
My list of on-line documentation:
http://wiki.audacityteam.org/wiki/Nyqui ... _Reference
http://www.audacity-forum.de/download/e ... -index.htm
http://www.audacity-forum.de/download/e ... /home.html
http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
http://dept-info.labri.fr/~idurand/ense ... ation.html
There is also Robert's "Little Helper" reference: http://forum.audacityteam.org/viewtopic ... 03#p195503
When I started using Nyquist, there was very little documentation. There was a Nyquist manual (similar to the current manual but less complete and less accurate), a brief introduction to XLISP by Edgar-rft, and (I think version 1 of) the XLISP manual by David Michael Betz, and the original version of this: http://audacityteam.org/help/nyquist There were also a few Nyquist plug-ins shipped with Audacity that could be used as examples, but they were not written by experienced LISP programmers so were not particularly good examples of "the right way" to write.
Since then, those documents have all been updated and expanded, and Edgar-rft wrote this "Nyquist Plug-ins Reference": http://wiki.audacityteam.org/wiki/Nyqui ... _Reference
My list of on-line documentation:
http://wiki.audacityteam.org/wiki/Nyqui ... _Reference
http://www.audacity-forum.de/download/e ... -index.htm
http://www.audacity-forum.de/download/e ... /home.html
http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
http://dept-info.labri.fr/~idurand/ense ... ation.html
There is also Robert's "Little Helper" reference: http://forum.audacityteam.org/viewtopic ... 03#p195503
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)