When we crate a program, we can get time execution from our program to know how long our program running. This is a code how to get time execution from our program with C/C++. Create a main.c file and copy this code to that file.
int main(int argc, char **argv)
t1 = time(NULL); //get time at the beginning of process
t2 = time(NULL); //get time at the end of process
divresult = div (t2-t1, 60); //compute time executed
printf("Time executed = %d min %d sec\n", divresult.quot, divresult.rem);
Compile main.c with command :
gcc main.c -o timeexec
You can copy this code to your program to get time execution from your program.
My name is Toto Sugito. This is my notes when I try something. Maybe, this is NOT THE BEST SOLUTION for your problems. If you have other method or idea that better with my post, please share in this blog. Thank for visiting my site.