This page is optimized for mobile devices, if you would prefer the desktop version just
click here
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?
Read also:
OpenStax, High performance computing. OpenStax CNX. Aug 25, 2010 Download for free at http://cnx.org/content/col11136/1.5
Google Play and the Google Play logo are trademarks of Google Inc.