{"id":86,"date":"2012-05-13T14:47:00","date_gmt":"2012-05-13T14:47:00","guid":{"rendered":"http:\/\/finaldie.com\/wordpress\/?p=86"},"modified":"2012-11-08T09:33:19","modified_gmt":"2012-11-08T09:33:19","slug":"profile-with-callgrind","status":"publish","type":"post","link":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/","title":{"rendered":"Profile with callgrind"},"content":{"rendered":"<h1>SUMMARY<\/h1>\n<p>There are still three articles about introducing the way to analyse\u00a0a program. But today, I&#8217;ll show you another member: <strong>callgrind<\/strong>. It&#8217;s a tool which belongs to\u00a0<a href=\"http:\/\/www.valgrind.org\/\" target=\"_blank\">valgrind<\/a>.<\/p>\n<h1>WHY<\/h1>\n<p>Sometimes maybe you encounter the issue as same as me: I don&#8217;t want to re-compile the program and the oprofile cannot work in my system as well, so.. uh&#8230;. what should I do?<\/p>\n<p>Don&#8217;t worry guys, the valgrind can save you :D. Why I say that? Because when you write a program in C\/C++, you must choose a kernel which can support valgrind working well. As we know, valgrind can detect memory errors easily, it&#8217;s a great helper for us. So, if all profilers cannot work well, at least, we have the valgrind. :D<\/p>\n<h1>HOW<\/h1>\n<p>The way is simple:<\/p>\n<ol>\n<li>valgrind &#8211;tool=callgrind .\/yourbin<\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/jrfonseca\/wiki\/Gprof2Dot\" target=\"_blank\">gprof2dot.py<\/a> -f callgrind callgrind.out.xxx | dot -Tpng -o output.png<\/li>\n<\/ol>\n<h1>THE SAMPLE<\/h1>\n<p>Here is a sample of analysis <a href=\"https:\/\/github.com\/cloudwu\/mread\">mread<\/a> program, which written by cloudwu.<\/p>\n<p><a href=\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-90\" title=\"callgraph_mread\" src=\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\" alt=\"call graph of mread\" width=\"2209\" height=\"2261\" \/><\/a><\/p>\n<h1>GUI TOOL<\/h1>\n<p>There is GUI front end tool &#8212; <a href=\"http:\/\/kcachegrind.sourceforge.net\/html\/Home.html\" target=\"_blank\">kcachegrind<\/a>, if you want to analyse the program more\u00a0meticulous, you can try it :D<\/p>\n<h1>THE LAST<\/h1>\n<p>In the end, there are four articles for introducing how to analyse a C\/C++ program:<\/p>\n<ul>\n<li><a href=\"http:\/\/finaldie.com\/wordpress\/?p=70\" target=\"_blank\">Profile with gprof<\/a><\/li>\n<li><a href=\"http:\/\/finaldie.com\/wordpress\/?p=76\" target=\"_blank\">Profile with oprofile<\/a><\/li>\n<li><a href=\"http:\/\/finaldie.com\/wordpress\/?p=82\" target=\"_blank\">Profile with gperf2tool<\/a><\/li>\n<li>And self one<\/li>\n<\/ul>\n<p>Ok, I hope these articles can help you to increase your\u00a0capability of\u00a0analysing a program. :D for any questions, please feel free to reach me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SUMMARY There are still three articles about introducing the way to analyse\u00a0a program. But today, I&#8217;ll show you another member: callgrind. It&#8217;s a tool which belongs to\u00a0valgrind. WHY Sometimes maybe you encounter the issue as same as me: I don&#8217;t want to re-compile the program and the oprofile cannot work in my system as well, &#8230; <a title=\"Profile with callgrind\" class=\"read-more\" href=\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\" aria-label=\"More on Profile with callgrind\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Profile with callgrind - Final Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Profile with callgrind - Final Blog\" \/>\n<meta property=\"og:description\" content=\"SUMMARY There are still three articles about introducing the way to analyse\u00a0a program. But today, I&#8217;ll show you another member: callgrind. It&#8217;s a tool which belongs to\u00a0valgrind. WHY Sometimes maybe you encounter the issue as same as me: I don&#8217;t want to re-compile the program and the oprofile cannot work in my system as well, ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\" \/>\n<meta property=\"og:site_name\" content=\"Final Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hu.yuzhang\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-13T14:47:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-11-08T09:33:19+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\" \/>\n<meta name=\"author\" content=\"final\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hyzwowtools\" \/>\n<meta name=\"twitter:site\" content=\"@hyzwowtools\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"final\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\",\"url\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\",\"name\":\"Profile with callgrind - Final Blog\",\"isPartOf\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\",\"datePublished\":\"2012-05-13T14:47:00+00:00\",\"dateModified\":\"2012-11-08T09:33:19+00:00\",\"author\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3\"},\"breadcrumb\":{\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage\",\"url\":\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\",\"contentUrl\":\"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/finaldie.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Profile with callgrind\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/finaldie.com\/blog\/#website\",\"url\":\"https:\/\/finaldie.com\/blog\/\",\"name\":\"Final Blog\",\"description\":\"As simple as possible...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/finaldie.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3\",\"name\":\"final\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g\",\"caption\":\"final\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Profile with callgrind - Final Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/","og_locale":"en_US","og_type":"article","og_title":"Profile with callgrind - Final Blog","og_description":"SUMMARY There are still three articles about introducing the way to analyse\u00a0a program. But today, I&#8217;ll show you another member: callgrind. It&#8217;s a tool which belongs to\u00a0valgrind. WHY Sometimes maybe you encounter the issue as same as me: I don&#8217;t want to re-compile the program and the oprofile cannot work in my system as well, ... Read more","og_url":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/","og_site_name":"Final Blog","article_publisher":"https:\/\/www.facebook.com\/hu.yuzhang","article_published_time":"2012-05-13T14:47:00+00:00","article_modified_time":"2012-11-08T09:33:19+00:00","og_image":[{"url":"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png"}],"author":"final","twitter_card":"summary_large_image","twitter_creator":"@hyzwowtools","twitter_site":"@hyzwowtools","twitter_misc":{"Written by":"final","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/","url":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/","name":"Profile with callgrind - Final Blog","isPartOf":{"@id":"https:\/\/finaldie.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage"},"image":{"@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage"},"thumbnailUrl":"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png","datePublished":"2012-05-13T14:47:00+00:00","dateModified":"2012-11-08T09:33:19+00:00","author":{"@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3"},"breadcrumb":{"@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/finaldie.com\/blog\/profile-with-callgrind\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#primaryimage","url":"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png","contentUrl":"http:\/\/finaldie.com\/wordpress\/wp-content\/uploads\/2012\/05\/callgraph_mread.png"},{"@type":"BreadcrumbList","@id":"https:\/\/finaldie.com\/blog\/profile-with-callgrind\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/finaldie.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Profile with callgrind"}]},{"@type":"WebSite","@id":"https:\/\/finaldie.com\/blog\/#website","url":"https:\/\/finaldie.com\/blog\/","name":"Final Blog","description":"As simple as possible...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/finaldie.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3","name":"final","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g","caption":"final"}}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/86"}],"collection":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":5,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions\/124"}],"wp:attachment":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}