Jump to content

How to benchmark code in C like a pro?

Gat Pelsinger
Go to solution Solved by Sauron,

You're looking for a profiler

What are the ways to benchmark code in C? I use the time.h header file with its clock_gettime() function and use the CLOCK_MONOTONIC clock. This does give me nanosecond precision, but sometimes it can be very unstable and I usually have to scale my code's execution time higher with a loop. I am looking for a more professional tool or library to benchmark code.

 

Microsoft owns my soul.

 

Also, Dell is evil, but HP kinda nice.

Link to comment
Share on other sites

Link to post
Share on other sites

You're looking for a profiler

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×