{"id":441,"date":"2013-04-26T14:46:05","date_gmt":"2013-04-26T14:46:05","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/?page_id=441"},"modified":"2013-08-01T12:53:27","modified_gmt":"2013-08-01T12:53:27","slug":"gprof","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/gprof\/","title":{"rendered":"gprof (GNU Profiler)"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><code>gprof<\/code> is the GNU Profiler that can be used, in combination with compiler flags, to determine where time has been spent during program execution.<\/p>\n<h2>Restrictions on use<\/h2>\n<p>None<\/p>\n<h2>Set up procedure<\/h2>\n<p>None<\/p>\n<h2>Running the application<\/h2>\n<p>Your application needs compiling with <code>-p -g<\/code> (Intel) or <code>-pg<\/code> (GNU). When such applications are run they create, or append, to <code>gmon.out<\/code>. <code>gprof<\/code> uses the information in this file to give various program profiles. A basic (abridged) example is<\/p>\n<pre class=\"in1\">\r\nifort -O0 -p -g primes_skel.f90 chkPrime.f90 -o prime_profile.exe\r\ntime .\/prime_profile.exe > primes.txt\r\n\r\n  real\t0m2.688s\r\n  user\t0m2.654s\r\n  sys\t0m0.023s\r\n\r\n\r\ngprof prime_profile.exe gmon.out \r\n\r\n  Flat profile:\r\n\r\n  Each sample counts as 0.01 seconds.\r\n    %   cumulative   self              self     total           \r\n   time   seconds   seconds    calls   s\/call   s\/call  name    \r\n   69.73      1.56     1.56  1000000     0.00     0.00  chkprime_\r\n   24.66      2.11     0.55                             sqrtf.A\r\n    2.69      2.17     0.06                             cvtas__nan_x\r\n    1.35      2.20     0.03                             sqrtf.L\r\n    0.90      2.22     0.02                             sqrtf\r\n    0.67      2.23     0.02        1     0.02     1.57  MAIN__\r\n<\/pre>\n<p>This illustrates that nearly 70% of the time was spent in the <code>chkprime()<\/code> function.<\/p>\n<p>See the <code>man gprof<\/code> for options available.<\/p>\n<p>Note that production codes should be run under the batch system, <strong>not on the login node<\/strong><\/p>\n<h2>More Information<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Overview gprof is the GNU Profiler that can be used, in combination with compiler flags, to determine where time has been spent during program execution. Restrictions on use None Set up procedure None Running the application Your application needs compiling with -p -g (Intel) or -pg (GNU). When such applications are run they create, or append, to gmon.out. gprof uses the information in this file to give various program profiles. A basic (abridged) example is.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/gprof\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-441","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/comments?post=441"}],"version-history":[{"count":4,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/441\/revisions"}],"predecessor-version":[{"id":955,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/441\/revisions\/955"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/media?parent=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}