{"id":82,"date":"2012-05-02T14:33:44","date_gmt":"2012-05-02T14:33:44","guid":{"rendered":"http:\/\/finaldie.com\/wordpress\/?p=82"},"modified":"2013-01-27T08:25:21","modified_gmt":"2013-01-27T08:25:21","slug":"profile-with-gperf2tools","status":"publish","type":"post","link":"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/","title":{"rendered":"Profile with gperftools"},"content":{"rendered":"<h1>SUMMARY<\/h1>\n<p>From the last two\u00a0articles(<a href=\"http:\/\/finaldie.com\/wordpress\/?p=70\" target=\"_blank\">profile with gprof<\/a>,\u00a0<a href=\"http:\/\/finaldie.com\/wordpress\/?p=76\" target=\"_blank\">profile with oprofile<\/a>), you may know some experiences of profile with C\/C++ program. So let&#8217;s take a look at a new tool from google, called &#8220;<a href=\"http:\/\/code.google.com\/p\/gperftools\/wiki\/GooglePerformanceTools?redir=1\" target=\"_blank\">gperftools<\/a>&#8220;, full name is &#8220;Google performance tools&#8221;.<\/p>\n<h1>What are the differences?<\/h1>\n<p>We know gprof and oprofile, but why gperftools? Ok, take it easy, easy&#8230; Let me show you all:<\/p>\n<p>First, we know gprof need to re-compile the program with &#8220;-pg&#8221;, it&#8217;s not a system profile tool, and it do multiple threads profile so hard and sometimes it&#8217;s not so precise. However, oprofile can solve them much easier, but it always shows all program results during the profile time, and we need the permission of sudo.<\/p>\n<p>So, you can take the gperftools if you want to do profile with a multiple threads program without permission of sudo. I think it&#8217;s a much better choose than these two tools. Another reason why you choose it is that gperftools can generate a nice graph by itself. So, why not? :D just try it.<\/p>\n<h1>WORK FLOW<\/h1>\n<ul>\n<li>link with &#8220;-lprofiler&#8221; and\u00a0re-compile your program<\/li>\n<li>run &#8220;env CPUPROFILE=\/tmp\/result.prof .\/myprogram&#8221;<\/li>\n<li>pprof &#8211;pdf .\/myprogram \/tmp\/result.prof &gt; result_of_profile.pdf<\/li>\n<\/ul>\n<p>For generating the graph, we require the &#8220;dot&#8221;, and the simple way to get dot, we can install the\u00a0<a href=\"http:\/\/www.graphviz.org\/\" target=\"_blank\">graphviz<\/a>. And there are also many options to adjust the result of your profile, look up the\u00a0<a href=\"http:\/\/google-perftools.googlecode.com\/svn\/trunk\/doc\/cpuprofile.html\" target=\"_blank\">document<\/a>. Have fun :D<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SUMMARY From the last two\u00a0articles(profile with gprof,\u00a0profile with oprofile), you may know some experiences of profile with C\/C++ program. So let&#8217;s take a look at a new tool from google, called &#8220;gperftools&#8220;, full name is &#8220;Google performance tools&#8221;. What are the differences? We know gprof and oprofile, but why gperftools? Ok, take it easy, easy&#8230; &#8230; <a title=\"Profile with gperftools\" class=\"read-more\" href=\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/\" aria-label=\"More on Profile with gperftools\">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 gperftools - 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-gperf2tools\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Profile with gperftools - Final Blog\" \/>\n<meta property=\"og:description\" content=\"SUMMARY From the last two\u00a0articles(profile with gprof,\u00a0profile with oprofile), you may know some experiences of profile with C\/C++ program. So let&#8217;s take a look at a new tool from google, called &#8220;gperftools&#8220;, full name is &#8220;Google performance tools&#8221;. What are the differences? We know gprof and oprofile, but why gperftools? Ok, take it easy, easy&#8230; ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/\" \/>\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-02T14:33:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-27T08:25:21+00:00\" \/>\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-gperf2tools\/\",\"url\":\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/\",\"name\":\"Profile with gperftools - Final Blog\",\"isPartOf\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#website\"},\"datePublished\":\"2012-05-02T14:33:44+00:00\",\"dateModified\":\"2013-01-27T08:25:21+00:00\",\"author\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3\"},\"breadcrumb\":{\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/finaldie.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Profile with gperftools\"}]},{\"@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 gperftools - 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-gperf2tools\/","og_locale":"en_US","og_type":"article","og_title":"Profile with gperftools - Final Blog","og_description":"SUMMARY From the last two\u00a0articles(profile with gprof,\u00a0profile with oprofile), you may know some experiences of profile with C\/C++ program. So let&#8217;s take a look at a new tool from google, called &#8220;gperftools&#8220;, full name is &#8220;Google performance tools&#8221;. What are the differences? We know gprof and oprofile, but why gperftools? Ok, take it easy, easy&#8230; ... Read more","og_url":"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/","og_site_name":"Final Blog","article_publisher":"https:\/\/www.facebook.com\/hu.yuzhang","article_published_time":"2012-05-02T14:33:44+00:00","article_modified_time":"2013-01-27T08:25:21+00:00","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-gperf2tools\/","url":"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/","name":"Profile with gperftools - Final Blog","isPartOf":{"@id":"https:\/\/finaldie.com\/blog\/#website"},"datePublished":"2012-05-02T14:33:44+00:00","dateModified":"2013-01-27T08:25:21+00:00","author":{"@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3"},"breadcrumb":{"@id":"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/finaldie.com\/blog\/profile-with-gperf2tools\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/finaldie.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Profile with gperftools"}]},{"@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\/82"}],"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=82"}],"version-history":[{"count":3,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/82\/revisions\/150"}],"wp:attachment":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}