简体   繁体   中英

Timer using NASM/Linux

Recently i've been writing a simple compiler in C++ that translates the code written in my custom language into nasm for linux. Everything works fine, I've written a sliding puzzles solver in my language too, but i need to know how much time it takes. Do anyone know how to make a timer in NASM? Thanks!

From this page it seems that clock_gettime is the best option on Linux.

This blog post has some NASM code that demonstrates how to call the function and this SO answer shows how to link to the function in glibc, as another option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM