• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

How to measure the running time of 1 command in AutoIT

AnonyViet by AnonyViet
February 17, 2023
in Tips
0

For programmers, it is very important to use a certain command and ask it to run according to the time given by the programmer, for example: a coder writes an auto game program and then when the code operations are complete and when he runs the test, it does not work as he wants (runs in a messy way and the timeout, the execution time is not in the right order) and forces the coder to do repeat the steps and estimate the time. So how do we accurately measure each time (milliseconds) that a command runs? Specifically Autoit

Join the channel Telegram belong to AnonyViet 👉 Link 👈

AutoIT is not a powerful programming language, but it has proven itself to be a useful language right on the command line itself. Therefore, we need to measure and know how much time an instruction in a programming language takes and give a reasonable timeout.

I will guide in detail the code steps for you to understand easily:

The structure of the time measurement code is as follows:

Local $time = TimerInit() ; Lấy thời gian của hệ thống, tính bằng mili giây

; Các lệnh cần đo được chèn ở đây

Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)

Example 1: Measure the duration of the Sleep(5000) instruction

Code :

Local $time = TimerInit()
Sleep(5000)
Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)

Measured results:

How to measure the running time of 1 instruction in AutoIT 4

Example 2: Measure the time to do the math

Code :

Local $time = TimerInit()
$x = 10
$y = 5
$z = $x + $y
Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)
MsgBox(0,0,$z)

Measured results:

How to measure the running time of 1 command in AutoIT 5

Note: If you want to output the results after calculating, you must put Msgbox after the sample frame code to measure the time, if it is in the sample frame, it will also measure the time you click OK. In case you want to export the results before exporting the measured time, you must set Msgbox to output the results before Msgbox reports the measured time.

After successfully measuring an instruction, we can estimate the waiting time for the program most accurately. For example: You want to let the user wait for a certain command, but do not know how long it takes to wait, we can apply this code to measure first and use Sleep() in the most reasonable way 🙂

In addition to the above 2 code examples, you can completely measure other commands such as: measure the time to read a .txt file, measure the time to get the source code of a website, measure the time to create or delete a necessary file, …

Like Fanpage or in home page regularly to update good articles in the near future.

AnonyViet wishes you success !!

N1412

The article achieved: 5/5 – (100 votes)

Previous Post

Share Javascript programming course from basic to advanced

Next Post

Share C# programming course with Winform worth 600K

AnonyViet

AnonyViet

Related Posts

Instructions on how to edit Facebook scheduled posts
Tips

Instructions on how to edit Facebook scheduled posts

November 16, 2025
Suggested AI command to create a rustic and charming image of a Ban Lien girl
Tips

Suggested AI command to create a rustic and charming image of a Ban Lien girl

November 16, 2025
Windows 10 will have a new, simpler interface
Tips

Windows 10 will have a new, simpler interface

November 16, 2025
How to check what data Facebook is controlling about you
Tips

How to check what data Facebook is controlling about you

November 15, 2025
How to record Chromebook screen – ChromeOS
Tips

How to record Chromebook screen – ChromeOS

November 14, 2025
How to create photos under the snow extremely quickly in just a few minutes
Tips

How to create photos under the snow extremely quickly in just a few minutes

November 13, 2025
Next Post
Share C# programming course with Winform worth 600K

Share C# programming course with Winform worth 600K

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions on how to edit Facebook scheduled posts

Instructions on how to edit Facebook scheduled posts

November 16, 2025
Suggested AI command to create a rustic and charming image of a Ban Lien girl

Suggested AI command to create a rustic and charming image of a Ban Lien girl

November 16, 2025
Windows 10 will have a new, simpler interface

Windows 10 will have a new, simpler interface

November 16, 2025
Share Key Active Visual Studio 2026

Share Key Active Visual Studio 2026

November 15, 2025
Instructions on how to edit Facebook scheduled posts

Instructions on how to edit Facebook scheduled posts

November 16, 2025
Suggested AI command to create a rustic and charming image of a Ban Lien girl

Suggested AI command to create a rustic and charming image of a Ban Lien girl

November 16, 2025
Windows 10 will have a new, simpler interface

Windows 10 will have a new, simpler interface

November 16, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions on how to edit Facebook scheduled posts

Instructions on how to edit Facebook scheduled posts

November 16, 2025
Suggested AI command to create a rustic and charming image of a Ban Lien girl

Suggested AI command to create a rustic and charming image of a Ban Lien girl

November 16, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

new88 trang chủ shbet trang chủ f168 trang chủ qq88 nhà cái 78win

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

new88 trang chủ shbet trang chủ f168 trang chủ qq88 nhà cái 78win

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply