Imbuter2000 Posted October 15, 2013 Share Posted October 15, 2013 (edited) I would like to monitor (in console) the processing time of each line of my scripts. Is there a shorter/cleaner way to do it than to insert a consolewrite(Timerdiff($timer) & @crlf) between each line of my scripts? (hundreds of lines!) Edited October 15, 2013 by Imbuter2000 Link to comment Share on other sites More sharing options...
gruntydatsun Posted October 15, 2013 Share Posted October 15, 2013 (edited) yo dawg i heard you like scripts... you can script a script to interleave the console writes in your script that would be a nice tool to add to scite in the same way TOOLS > TRACE: ADD TRACE LINES works. Edited October 15, 2013 by gruntydatsun Shrapnel 1 Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 15, 2013 Author Share Posted October 15, 2013 is there a shorter/cleaner way to do it than to insert a my_interleave_timer_script() command between each line of my scripts? (thus hundreds of times) Link to comment Share on other sites More sharing options...
BrewManNH Posted October 15, 2013 Share Posted October 15, 2013 Reasking the same question just rewording it isn't going to make it magically easier. Delve into the Lua script that is used to insert the trace lines that gruntyDatsun mentioned and modify it to insert timer functions instead, that would probably be the easiest way. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
gruntydatsun Posted October 15, 2013 Share Posted October 15, 2013 it's really late here. i want to try this now but I think it would lead to a divorce. something fun for tomorrow. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 15, 2013 Author Share Posted October 15, 2013 (edited) Ah sorry I misinterpreted what gruntyDatsun meant. Now I got it... but it would be unsatisfatory to me because I want permanently keep it ON even while working on my scripts. The purpose is to ALWAYS be alerted when an instruction takes too much time (for example an _IENavigate page load, that takes different time each time...) Edited October 15, 2013 by Imbuter2000 Link to comment Share on other sites More sharing options...
BrewManNH Posted October 15, 2013 Share Posted October 15, 2013 Now I got it... but it would be unsatisfatory to me because I want permanently keep it ON even while working on my scripts. The purpose are to be ALWAYS alerted when an instruction that takes too much time (for example an _IENavigate page load, that takes different time each time...) No idea what you're looking for then, you can't time a script unless it's running, and from what you just wrote you want to time a script as you're writing it? How do you plan on "being alerted" when it "takes too much time"? Too much time is extremely vague and has no meaning out of context, and being alerted can have many meanings depending upon what method you intend the alert to use. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 15, 2013 Author Share Posted October 15, 2013 No idea what you're looking for then, you can't time a script unless it's running, and from what you just wrote you want to time a script as you're writing it? How do you plan on "being alerted" when it "takes too much time"? Too much time is extremely vague and has no meaning out of context, and being alerted can have many meanings depending upon what method you intend the alert to use. ahah no, I just meant that I don't want to cancel and relaunch something so intrusive like an ADD TRACE LINES each time after I add a line of code. It would be like a mess and time-expensive to work with this "weight"! Link to comment Share on other sites More sharing options...
BrewManNH Posted October 15, 2013 Share Posted October 15, 2013 Unless you're willing to "do the work" by putting a timer before and after every line in your code, then the answer would have to be no you can't time the lines of your script in any meaningful way. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 15, 2013 Author Share Posted October 15, 2013 Unless you're willing to "do the work" by putting a timer before and after every line in your code, then the answer would have to be no you can't time the lines of your script in any meaningful way. Ok, this is what I thought. My wish was something working at run-time like "#AutoIt3Wrapper_run_debug_mode=Y" or even... a timer added to each line written to console by it... Link to comment Share on other sites More sharing options...
BrewManNH Posted October 15, 2013 Share Posted October 15, 2013 I personally think that, unless you're just timing chunks of code, timing your script isn't going to give you very much meaningful information. If you think the script is running too slowly in a certain section of the code, time that part and see if you can optimize it. Timing every single line is going to give you too much information, and very little of it will be useful. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 15, 2013 Author Share Posted October 15, 2013 For example, I use many XML msxml6.dll COM calls to parse third-party websites and I want to be alerted (in a alert.log file) when any XML parse takes more than 1 second. The third-party websites can change and therefore the XML parse time can change in future... Is the only option to add a timer line of code after each XML parse command? or to create a corresponding function for every msxml command (containing a timer)?! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 15, 2013 Moderators Share Posted October 15, 2013 Imbuter2000,I find this UDF very handy for timing the functions and reasonably sized code chunks in some of my longer scripts. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Imbuter2000 Posted October 16, 2013 Author Share Posted October 16, 2013 Imbuter2000, I find this UDF very handy for timing the functions and reasonably sized code chunks in some of my longer scripts. M23 Interesting utility, I'll consider it... Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now