What linux api I can use to measure execution time of some functions in my program?

StackOverflow https://stackoverflow.com/questions/22161548

  •  19-10-2022
  •  | 
  •  

سؤال

I am working on a user side application in C on linux. What linux api I can use to measure execution time of some functions in my program? I would like the accuracy up to nano second.

I have google it, I find example in clock clicks. I need the result in nano second.

Thank you.

لا يوجد حل صحيح

نصائح أخرى

You could use the time.h library to get the begin and end times and get the difference! This is not Linux specific however!

man clock_gettime

struct timespec is in nano second.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top