<?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 Intel PCM: Obtaining the Same BasicCounterType each time in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781752#M366</link>
    <description>Hi Roman,&lt;BR /&gt;&lt;BR /&gt;thanks for your help. I reinstalled the msr again and it worked fine with me.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I do have another question about the program() method can I ask it here or open a new thread?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I noticed that the number of PCM instance is increasing with each call. my question is should I call the program() method only one time, or call it any time then cleanup() after, or there is no need to call program() at all?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 08 Dec 2011 18:25:11 GMT</pubDate>
    <dc:creator>amr_eladawy</dc:creator>
    <dc:date>2011-12-08T18:25:11Z</dc:date>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781745#M359</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to call the &lt;A href="http://software.intel.com/en-us/articles/intel-performance-counter-monitor/"&gt;PCM library &lt;/A&gt;version 1.7 from java using JNI. The idea is simply as following:&lt;BR /&gt;&lt;BR /&gt;1. Call the PCM to get BaiscCounterType(CoreCounter, Socketcounter,SystemCounter)&lt;BR /&gt;2. Run some Java Code&lt;BR /&gt;3. Call the PCM again to get the BasicCounter &lt;BR /&gt;4. Call the PCM to measure the diffrence. (getCyclesLostDueL2CacheMisses,getCyclesLostDueL3CacheMisses)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now, the problem is that I get the same BasicCounterType in step 1 and 3 which causes invalid results in step 4.&lt;BR /&gt;&lt;BR /&gt;The JNI C++ code methods are as following:&lt;BR /&gt;&lt;BR /&gt;1. Here is the method I use to get the BasicCounterType (CoreCounter). This method calls the getSystemCounterState() in cpucounters.cpp. Please note that I return the pointer address of the counter only.&lt;BR /&gt;&lt;BR /&gt;JNIEXPORT jlong JNICALL Java_org_jpcm_JpcmJNI_getSystemCounterState&lt;BR /&gt; (JNIEnv *, jobject)&lt;BR /&gt;{&lt;BR /&gt; return (long)&amp;amp;getSystemCounterState();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2. Then after executing some java code, the same method is invoked again to get the counter reading after that.&lt;BR /&gt;&lt;BR /&gt;3. The two long values (Pointers for Before &amp;amp; After) are passed to the following method to get the L3 cach miss&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JNIEXPORT jdouble JNICALL Java_org_jpcm_JpcmJNI_getCyclesLostDueL3CacheMisses&lt;BR /&gt; (JNIEnv *, jobject, jlong before, jlong after)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt; BasicCounterState* stateBefore;&lt;BR /&gt; BasicCounterState* stateAfter;&lt;BR /&gt; stateBefore= (BasicCounterState*)before;&lt;BR /&gt; stateAfter = (BasicCounterState*)after;&lt;BR /&gt;&lt;BR /&gt; return getCyclesLostDueL3CacheMisses((*stateBefore),(*stateAfter));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;________________________________________________________________&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The problem is that I get the same CoreCounter each time I call the PCM. By the wrod Same, I mean that I get the same Pointer Address Value (long) each time.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any ideas how to solve that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Amr&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Dec 2011 08:03:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781745#M359</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-05T08:03:31Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781746#M360</link>
      <description>Amr,&lt;BR /&gt;&lt;BR /&gt;by "return (long)&amp;amp;getSystemCounterState();" you are returning address of a temporary object (SystemCounterState) returned by getSystemCounterState() function. In C++ using adresses of temporary objects is a bad idea: the object basically does not exist after your "return" anymore. You see the same pointer address value because the same memory region is used to store the temporary object by the compiler/runtime system. &lt;BR /&gt;&lt;BR /&gt;Instead, you should copy not the address but the whole content of returned SystemCounterState object to Java and use these copies as getCyclesLostDueL3CacheMisses parameters (pointers to them).&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Roman</description>
      <pubDate>Mon, 05 Dec 2011 12:25:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781746#M360</guid>
      <dc:creator>Roman_D_Intel</dc:creator>
      <dc:date>2011-12-05T12:25:02Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781747#M361</link>
      <description>Hello Roman,&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for your prompt response. I am trying your suggestion.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Amr</description>
      <pubDate>Mon, 05 Dec 2011 20:22:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781747#M361</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-05T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781748#M362</link>
      <description>Hi Roman,&lt;BR /&gt;&lt;BR /&gt;I have tried your approach, and now the CPP JNI code returns the full data of BasicCounterType. This requried having a Java model for BasicCounterState class.&lt;BR /&gt;&lt;BR /&gt;Please note that I get the error PCM::MSRAccessDenied How can I fix that? Does this has to do anything with the following case?&lt;BR /&gt;&lt;BR /&gt;Looking into the Data returned from CPP here are the two BasicCounterState obtained before and After &lt;BR /&gt;&lt;BR /&gt;BasicCounterState [instRetiredAny=0, cpuClkUnhaltedThread=0, cpuClkUnhaltedRef=0, l3Miss=43981, event0=43981, archLLCRef=43981, l3UnsharedHit=0, event1=0, archLLCMiss=0, l2HitM=0, event2=0, l2Hit=0, event3=0, invariantTSC=&lt;SPAN style="text-decoration: underline;"&gt;31392333685000&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;BasicCounterState [instRetiredAny=0, cpuClkUnhaltedThread=0, cpuClkUnhaltedRef=0, l3Miss=43981, event0=43981, archLLCRef=43981, l3UnsharedHit=0, event1=0, archLLCMiss=0, l2HitM=0, event2=0, l2Hit=0, event3=0, invariantTSC=&lt;SPAN style="text-decoration: underline;"&gt;31401913898752&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Are these reasonable Data? &lt;BR /&gt;&lt;BR /&gt;I can see that the following members have the same value:&lt;BR /&gt;1. l3Miss&lt;BR /&gt;2. event0&lt;BR /&gt;3. archLLCRef&lt;BR /&gt;&lt;BR /&gt;and the invariantTSC has a diffrent values.&lt;BR /&gt;&lt;BR /&gt;Does this mean that these e members are pointers to the desired data?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks alot for your valuable help. Really appreciated. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;amr&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Dec 2011 17:36:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781748#M362</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-06T17:36:07Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781749#M363</link>
      <description>amr,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;the counter values are not valid because of thePCM::MSRAccessDenied error. It seems that you application cannot access MSRs (model specific registers) for some reason. What OS are you using?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Roman&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Dec 2011 10:17:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781749#M363</guid>
      <dc:creator>Roman_D_Intel</dc:creator>
      <dc:date>2011-12-07T10:17:20Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781750#M364</link>
      <description>Hi Roman,&lt;BR /&gt;&lt;BR /&gt;My OS is Ubuntu 11.10. &lt;BR /&gt;&lt;BR /&gt;I had complied the msr.o and installed it using 'modprobe msr' , then changed the owner ship of the folders /dev/cpu recursivly.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Amr.&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Dec 2011 11:02:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781750#M364</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-07T11:02:11Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781751#M365</link>
      <description>Amr,&lt;BR /&gt;&lt;BR /&gt;can you see the counter values using pcm.x utility (part of Intel PCM)?&lt;BR /&gt;&lt;BR /&gt;Roman</description>
      <pubDate>Wed, 07 Dec 2011 11:22:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781751#M365</guid>
      <dc:creator>Roman_D_Intel</dc:creator>
      <dc:date>2011-12-07T11:22:59Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781752#M366</link>
      <description>Hi Roman,&lt;BR /&gt;&lt;BR /&gt;thanks for your help. I reinstalled the msr again and it worked fine with me.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I do have another question about the program() method can I ask it here or open a new thread?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I noticed that the number of PCM instance is increasing with each call. my question is should I call the program() method only one time, or call it any time then cleanup() after, or there is no need to call program() at all?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Dec 2011 18:25:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781752#M366</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-08T18:25:11Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781753#M367</link>
      <description>Hi Amr,&lt;BR /&gt;&lt;BR /&gt;you should call program() to initialize PCM once in the beginning of your program runtime and call cleanup() when you do not need PCM anymore in your program (e.g. before your program exits). Then the count of PCM instances should not increase each time.In thepcm.x example, theprogram() call is calledoncein the very beginning and cleanup() is called once on exit (in the kill and Ctrl-C handler).&lt;BR /&gt;&lt;BR /&gt;Roman</description>
      <pubDate>Thu, 08 Dec 2011 21:00:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781753#M367</guid>
      <dc:creator>Roman_D_Intel</dc:creator>
      <dc:date>2011-12-08T21:00:01Z</dc:date>
    </item>
    <item>
      <title>Intel PCM: Obtaining the Same BasicCounterType each time</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781754#M368</link>
      <description>Thanks a lot. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Dec 2011 20:23:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-Obtaining-the-Same-BasicCounterType-each-time/m-p/781754#M368</guid>
      <dc:creator>amr_eladawy</dc:creator>
      <dc:date>2011-12-09T20:23:38Z</dc:date>
    </item>
  </channel>
</rss>

