<?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: P4080DS: High CPU Usage by C++ application in P-Series</title>
    <link>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425826#M2419</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The compiler optimization can't reduce the number of memory allocation/creations and other memory related operations. In your case, it is reasonable to investigate profiling logs and your code in order to optimize the usage of costly operations. Generally, these C/C++ optimization rules are common for any computing platform and you can find many articles and discussions on this topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://stackoverflow.com/questions/2555402/c-performance-memory-optimization-guidelines" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/2555402/c-performance-memory-optimization-guidelines&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.tantalon.com/pete/cppopt/final.htm" rel="nofollow" target="_blank"&gt;http://www.tantalon.com/pete/cppopt/final.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://en.wikibooks.org/wiki/Optimizing_C%2B%2B/Writing_efficient_code/Allocations_and_deallocations" rel="nofollow" target="_blank"&gt;http://en.wikibooks.org/wiki/Optimizing_C%2B%2B/Writing_efficient_code/Allocations_and_deallocations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last thing to do is to improve memory related operations themselves (heap manager, memcpy, strings...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CodeWarrior runtime library: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;A hand optimized version of memcpy is available in&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PowerPC_EABI_Support/Runtime/Src/__mem.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; It is turned OFF by default. User could manually turn it ON by &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define USE_FAST_MEMCPY 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; and rebuilding the runtime libraries. Fast memcpy would then be enabled only if&lt;/P&gt;&lt;P&gt;&amp;nbsp; the target processor support:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - lfd/stfd instructions and floating point support is ON&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - evldd/evstd instructions&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; *** Please note that there is a code size tradeoff when enabling fast memcpy as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compared to original memcpy&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Pavel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jun 2015 08:06:15 GMT</pubDate>
    <dc:creator>LPP</dc:creator>
    <dc:date>2015-06-05T08:06:15Z</dc:date>
    <item>
      <title>P4080DS: High CPU Usage by C++ application</title>
      <link>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425825#M2418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a P4080DS board for my C++ application. The application uses a lot of malloc and free.&lt;/P&gt;&lt;P&gt;From the Oprofiles report, we got to know that these memory allocation/creations and other memory related operations like memcpy, memset are taking a lot of CPU.&lt;/P&gt;&lt;P&gt;This drastically reduces the performance of the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with optimizing the GCC including with -O3 optimization and certain flags while building SDK and tried to use it to compile my application.&lt;/P&gt;&lt;P&gt;This also did not give much improvement in the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone suggest on how to decrease the CPU load?&lt;/P&gt;&lt;P&gt;Any other suggestions, by which we can improve the performance like any libraries need to be optimized, or any configurations to be done?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sharath Chandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 17:41:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425825#M2418</guid>
      <dc:creator>sharathchandra</dc:creator>
      <dc:date>2015-06-03T17:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: P4080DS: High CPU Usage by C++ application</title>
      <link>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425826#M2419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The compiler optimization can't reduce the number of memory allocation/creations and other memory related operations. In your case, it is reasonable to investigate profiling logs and your code in order to optimize the usage of costly operations. Generally, these C/C++ optimization rules are common for any computing platform and you can find many articles and discussions on this topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://stackoverflow.com/questions/2555402/c-performance-memory-optimization-guidelines" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/2555402/c-performance-memory-optimization-guidelines&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.tantalon.com/pete/cppopt/final.htm" rel="nofollow" target="_blank"&gt;http://www.tantalon.com/pete/cppopt/final.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://en.wikibooks.org/wiki/Optimizing_C%2B%2B/Writing_efficient_code/Allocations_and_deallocations" rel="nofollow" target="_blank"&gt;http://en.wikibooks.org/wiki/Optimizing_C%2B%2B/Writing_efficient_code/Allocations_and_deallocations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last thing to do is to improve memory related operations themselves (heap manager, memcpy, strings...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CodeWarrior runtime library: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;A hand optimized version of memcpy is available in&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PowerPC_EABI_Support/Runtime/Src/__mem.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; It is turned OFF by default. User could manually turn it ON by &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define USE_FAST_MEMCPY 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; and rebuilding the runtime libraries. Fast memcpy would then be enabled only if&lt;/P&gt;&lt;P&gt;&amp;nbsp; the target processor support:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - lfd/stfd instructions and floating point support is ON&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - evldd/evstd instructions&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; *** Please note that there is a code size tradeoff when enabling fast memcpy as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compared to original memcpy&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Pavel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 08:06:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425826#M2419</guid>
      <dc:creator>LPP</dc:creator>
      <dc:date>2015-06-05T08:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: P4080DS: High CPU Usage by C++ application</title>
      <link>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425827#M2420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried profiling our application with Oprofile.&amp;nbsp; We observed the most of our CPU is being taken by &lt;STRONG&gt;_wordcopy_fwd_aligned.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CPU: e500mc, speed 1499.98 MHz (estimated)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Counted CPU_CLK events (Cycles) with a unit mask of 0x00 (No unit mask) count 750000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;samples&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; linenr info&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; image name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;33455&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 90.7279&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wordcopy.c:38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc-2.15.so&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _wordcopy_fwd_aligned&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;332&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.9004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memcpy.os:0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc-2.15.so&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; L5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We even tried using lib_e500mc.so to increase the performance but of no use. &lt;/P&gt;&lt;P&gt;We use lot of vectors and maps. Probably internally, wordcopy may be called in STLs. &lt;/P&gt;&lt;P&gt;Can you suggest how to speed up this one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also do we have some &lt;STRONG&gt;&lt;EM&gt;scalable dynamic memory allocator&lt;/EM&gt;&lt;/STRONG&gt; for the board like we have on other platforms like intel ,etc.?&lt;/P&gt;&lt;P&gt;I am going through other links you have mentioned, will also try them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sharath Chandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 17:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/P-Series/P4080DS-High-CPU-Usage-by-C-application/m-p/425827#M2420</guid>
      <dc:creator>sharathchandra</dc:creator>
      <dc:date>2015-06-05T17:41:23Z</dc:date>
    </item>
  </channel>
</rss>

