LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mesure time of cpp function with time (https://www.linuxquestions.org/questions/linux-newbie-8/mesure-time-of-cpp-function-with-time-4175687220/)

CarnariusXx 12-21-2020 06:52 AM

Mesure time of cpp function with time
 
Hello thats my first thred in this forum so I want to say hello to everbody. I just started with Linux (Ubuntu 20.04) and I try to mesure time of all functions in my debug file of cpp code. I try with $time because I need that three values of time func. Is there any way to run this n times and save output for each of cpp functions?
For eg, I've write two func and I'd like to output is two files with real, sys and user times.

pan64 12-21-2020 12:23 PM

if you mean profiling you will see some good ideas here: https://stackoverflow.com/questions/...nning-on-linux

auge 12-21-2020 01:17 PM

Perhaps use gettimeofday before and after the call and then calculate the difference?


All times are GMT -5. The time now is 11:15 PM.