<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Profiling a program built with and without STLport in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216252#M676265</link>
    <description>James,&lt;BR /&gt;&lt;BR /&gt;Thanks, I will try to install it.</description>
    <pubDate>Mon, 28 Dec 2009 14:58:03 GMT</pubDate>
    <dc:creator>blackwater</dc:creator>
    <dc:date>2009-12-28T14:58:03Z</dc:date>
    <item>
      <title>Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216246#M676259</link>
      <description>The question is about significant difference in performance of the same application when it was built with STLport and without STLport. &lt;BR /&gt;&lt;BR /&gt;For the sake of profiling I build on HP-UX 11.31 ia64 my application with STLport 5.1.7 and without STLport. So there were two configurations:&lt;BR /&gt;&lt;BR /&gt;1) gcc 4.3.1, STLport 5.1.7, level of optimization O2&lt;BR /&gt;2) gcc 4.3.1, own gcc STL, level of optimization O2&lt;BR /&gt;&lt;BR /&gt;It is probably important to mention that we have been developing the application for a long time using STLport and now we decided to build it without STLport, compare performance and if it is the same or better then start using own gcc STL library.&lt;BR /&gt;&lt;BR /&gt;So I run a simple test when 500 000 requests are sent to the application, processed in one worker thread and sent back&lt;BR /&gt;500 000 responses.&lt;BR /&gt;&lt;BR /&gt;What is interesting is that the version with STLport processes requests 25% faster. So for the time  being it is not practical to give up using STLport. However I would like to get some assistance in finding out why STLport gives such a significant boost and what can be done to get this speed in the no-STLport version.&lt;BR /&gt;&lt;BR /&gt;I profiled both applications and the problem seems to be in the fact that the no-STLport verion calls too often pthread_mutex_unlock(). &lt;BR /&gt;&lt;BR /&gt;STLport-version of the application (profiled with Caliper) showed that there were 57308 pthread_mutex_unlock() calls count. No-STLport-version of the application (profiled with Caliper) showed that there were 124941 pthread_mutex_unlock() calls count. &lt;BR /&gt;&lt;BR /&gt;Actually I have done some search, found recommendation to assign variables of type std::string in this way (add .c_str() to a right-parameter): string_var_1 = string_var_2.c_str(), changed code in often called functions, profiled  again and it resulted in 70000 pthread_mutex_unlock() calls count. It is definitely some improvement but it is still worse than STLport-version and what is more important it is not feasible to find all places where it was necessary to add .c_str(). &lt;BR /&gt;&lt;BR /&gt;So what recommendations for this situations could you give?&lt;BR /&gt;&lt;BR /&gt;By the way I attached both profile reports.</description>
      <pubDate>Fri, 25 Dec 2009 10:12:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216246#M676259</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2009-12-25T10:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216247#M676260</link>
      <description>&amp;gt;So there were two configurations:&lt;BR /&gt;&lt;BR /&gt;Any reason you haven't looked into using aC++, even with STLport?  g++ can't compete with the code generated by aC++'s +O2 and above.&lt;BR /&gt;Of course you may lose more than you gain when using the aC++ runtime.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;What is interesting is that the version with STLport processes requests 25% faster. &lt;BR /&gt;&lt;BR /&gt;Hard to argue with that.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;the fact that the no-STLport version calls too often pthread_mutex_unlock.&lt;BR /&gt;&lt;BR /&gt;(Actually since lock/unlock come in pairs, it is calling pthread_mutex_lock too often.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;found recommendation to assign variables of type std::string in this way (add .c_str() to a right-parameter): string_var_1 = string_var_2.c_str()&lt;BR /&gt;&lt;BR /&gt;For aC++'s reference counted strings, this would hurt things.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;So what recommendations for this situations could you give?&lt;BR /&gt;&lt;BR /&gt;Change the g++ STL to optimize your cases?  Perhaps STLport is using its own allocator and bypassing malloc?&lt;BR /&gt;libstlport.so.5.1::stlp_std::__malloc_alloc::allocate&lt;BR /&gt;&lt;BR /&gt;Not using strings but const char*.&lt;BR /&gt;&lt;BR /&gt;If you look closely at your caliper outputs you'll see that for STLport 56.37% of the calls to lock come from __thread_mutex_lock, which comes from other libc functions:&lt;BR /&gt;real_free&lt;BR /&gt;localtime_r&lt;BR /&gt;__gmtime_r_posix&lt;BR /&gt;real_malloc&lt;BR /&gt;&lt;BR /&gt;So don't call these that often.  ;-)&lt;BR /&gt;You might get help by using MallocNG.&lt;BR /&gt;&lt;BR /&gt;For the no STLport case, with 86.91%, you are doing about 5 times as many calls to malloc.</description>
      <pubDate>Fri, 25 Dec 2009 16:50:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216247#M676260</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-25T16:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216248#M676261</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;Thanks for your answer.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Any reason you haven't looked into using aC++, even with STLport? &lt;BR /&gt;&lt;BR /&gt;It's a good idea. We'll give it a try. We don't have any compelling reasons to use only gcc.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Perhaps STLport is using its own allocator and bypassing malloc?&lt;BR /&gt;There is such way of allocating memory in STLport but we don't use it. We have built STLport with #define _STLP_USE_MALLOC 1. As you can see in [79] 96% of time stlp_std::__malloc_alloc::allocate spends in libc.so.1::malloc&lt;BR /&gt;&lt;BR /&gt;&amp;gt; If you look closely at your caliper outputs you'll see that for STLport 56.37% of the calls to lock come from __thread_mutex_lock, which comes from other libc functions:&lt;BR /&gt;&lt;BR /&gt;Yes, it's true. I have already realized that. It is likely that it might be optimized.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Dec 2009 07:36:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216248#M676261</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2009-12-28T07:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216249#M676262</link>
      <description>I am going to build the application &lt;BR /&gt;1) with acc and STLport&lt;BR /&gt;2) with acc and its own STL&lt;BR /&gt;and measure time of processing requests.</description>
      <pubDate>Mon, 28 Dec 2009 07:44:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216249#M676262</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2009-12-28T07:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216250#M676263</link>
      <description>One more point.&lt;BR /&gt;&lt;BR /&gt;Are you sure that MallocNG is available for download? &lt;BR /&gt;&lt;BR /&gt;I went to this page: &lt;A href="http://www.docs.hp.com/en/5992-4174/ch02s07.html," target="_blank"&gt;http://www.docs.hp.com/en/5992-4174/ch02s07.html,&lt;/A&gt; then I went to &lt;A href="http://hp.com/go/softwaredepot," target="_blank"&gt;http://hp.com/go/softwaredepot,&lt;/A&gt; then I searched for SWPACKv3 and finanly got (quote): "0 products shown below matched your search on "SWPACKv3". &lt;BR /&gt;</description>
      <pubDate>Mon, 28 Dec 2009 08:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216250#M676263</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2009-12-28T08:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216251#M676264</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Are you sure that MallocNG is available for download? &lt;BR /&gt;&lt;BR /&gt;Yes, see:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=MallocNextGen" target="_blank"&gt;http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=MallocNextGen&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 28 Dec 2009 14:47:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216251#M676264</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-28T14:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216252#M676265</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Thanks, I will try to install it.</description>
      <pubDate>Mon, 28 Dec 2009 14:58:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216252#M676265</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2009-12-28T14:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216253#M676266</link>
      <description>&amp;gt;As you can see in [79] 96% of time stlp_std::__malloc_alloc::allocate spends in malloc&lt;BR /&gt;&lt;BR /&gt;Then the decision to call malloc is made higher in the call tree.  Perhaps if you turn off inlining, it may be easier to find.&lt;BR /&gt;&lt;BR /&gt;If you use MallocNG, your STLport version should also be faster.</description>
      <pubDate>Mon, 28 Dec 2009 19:39:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216253#M676266</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-28T19:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216254#M676267</link>
      <description>&amp;gt;&amp;gt;Any reason you haven't looked into using aC++, even with STLport?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It's a good idea. We'll give it a try. We don't have any compelling reasons to use only gcc.&lt;BR /&gt;&lt;BR /&gt;I can build Boost 1.38 with aCC but it seems I can't build recent versions of the Boost library with aCC. Unfortunately this is a problem for my project.</description>
      <pubDate>Wed, 12 May 2010 12:45:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216254#M676267</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2010-05-12T12:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Profiling a program built with and without STLport</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216255#M676268</link>
      <description>My mistake. Checked again and 1.43 complies.</description>
      <pubDate>Wed, 12 May 2010 14:37:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/profiling-a-program-built-with-and-without-stlport/m-p/5216255#M676268</guid>
      <dc:creator>blackwater</dc:creator>
      <dc:date>2010-05-12T14:37:27Z</dc:date>
    </item>
  </channel>
</rss>

