<< Chapter < Page | Chapter >> Page > |
Profile the following program using gprof. Is there any way to tell how much of the time spent in routine c was due to recursive calls?
main()
{int i, n=10;
for (i=0; i<1000; i++) {
c(n);a(n);
}}
c(n)int n;
{if (n>0) {
a(n-1);c(n-1);
}}
a(n)int n;
{c(n);
}
Profile an engineering code (floating-point intensive) with full optimization on and off. How does the profile change? Can you explain the change?
Write a program to determine the overhead of the getrusage and the etime calls. Other than consuming processor time, how can making a system call to check the time too often alter the application performance?
Notification Switch
Would you like to follow the 'High performance computing' conversation and receive update notifications?