This page is optimized for mobile devices, if you would prefer the desktop version just click here

4.6 Exercises

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); }
Got questions? Get instant answers now!

Profile an engineering code (floating-point intensive) with full optimization on and off. How does the profile change? Can you explain the change?

Got questions? Get instant answers now!

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?

Got questions? Get instant answers now!
<< Chapter < Page Page > Chapter >>

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.
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use and Privacy Policy.