<?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 - measure time using Performance Counters in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776906#M290</link>
    <description>&lt;P&gt;You can get the TSC frequency from:&lt;BR /&gt;uint64 PCM::getNominalFrequency()&lt;BR /&gt;&lt;BR /&gt;You can get the TSC with the Windows*intrinsic:&lt;BR /&gt;#include &lt;INTRIN.H&gt;&lt;BR /&gt;unsigned __int64 __rdtsc(void);&lt;BR /&gt;&lt;BR /&gt;You can check if the TSC is invariant with the above link (see &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=101951"&gt;http://software.intel.com/en-us/forums/showthread.php?t=101951&lt;/A&gt;) &lt;BR /&gt;&lt;BR /&gt;Pat&lt;/INTRIN.H&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2012 20:56:26 GMT</pubDate>
    <dc:creator>Patrick_F_Intel1</dc:creator>
    <dc:date>2012-04-06T20:56:26Z</dc:date>
    <item>
      <title>Intel PCM - measure time using Performance Counters</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776903#M287</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I am trying to time my piece of code using performance counters.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I see that there we cannot use the cycle count from the cores due to turbo boost and various other frequency variations in the CPU.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;For this I think I should use the Invariant TSC value provided by "getInvariantTSC()". But, there is no corresponding Invariant TSC frequency value which I need to calculate the time.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I get this frequency? Or should I use QueryPerformanceCounter/Frequency() on Windows?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Pranith&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Apr 2012 15:32:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776903#M287</guid>
      <dc:creator>pranith</dc:creator>
      <dc:date>2012-04-06T15:32:58Z</dc:date>
    </item>
    <item>
      <title>Intel PCM - measure time using Performance Counters</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776904#M288</link>
      <description>Hello Pranith,&lt;BR /&gt;The answerdepends on what accuracy you need and what you mean by 'time my piece of code'.&lt;BR /&gt;In my experience, the TSC can provide nanosecond resolution with little overhead.&lt;BR /&gt;QueryPerformanceCounter can provide about microsecond resolution with more overhead.&lt;BR /&gt;You can look &lt;A href="http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter"&gt;http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter&lt;/A&gt; for an intro to QueryPerformanceCounter().&lt;BR /&gt;I can't find a reference to getInvariantTSC().&lt;BR /&gt;If you have an invariant TSC (see &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=101951"&gt;http://software.intel.com/en-us/forums/showthread.php?t=101951&lt;/A&gt;) then the TSC runs at the same rate regardless of Cstate, Pstate, turbo mode, etc.&lt;BR /&gt;Pat</description>
      <pubDate>Fri, 06 Apr 2012 16:54:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776904#M288</guid>
      <dc:creator>Patrick_F_Intel1</dc:creator>
      <dc:date>2012-04-06T16:54:59Z</dc:date>
    </item>
    <item>
      <title>Intel PCM - measure time using Performance Counters</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776905#M289</link>
      <description>&lt;DIV&gt;By 'time my piece of code', I meant:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;main()&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt; warmup();&lt;/DIV&gt;&lt;DIV&gt; startCounters(start);&lt;/DIV&gt;&lt;DIV&gt; &lt;CODE&gt;&lt;/CODE&gt;&lt;/DIV&gt;&lt;DIV&gt; stopCounters(end);&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt; timeToExecute = f(start, end);&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I was referring to cpucounters.h in Intel PCM for getInvariantTSC(). That gives us the invariant clock ticks. But to get time from those ticks, I need the frequency at which this clock ticks.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I wanted to use performance counters to do this, but if I cannot get the invariant clock frequency, then I would use QueryPerformanceCounter/Frequency to time my code.&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Apr 2012 20:27:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776905#M289</guid>
      <dc:creator>pranith</dc:creator>
      <dc:date>2012-04-06T20:27:29Z</dc:date>
    </item>
    <item>
      <title>Intel PCM - measure time using Performance Counters</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776906#M290</link>
      <description>&lt;P&gt;You can get the TSC frequency from:&lt;BR /&gt;uint64 PCM::getNominalFrequency()&lt;BR /&gt;&lt;BR /&gt;You can get the TSC with the Windows*intrinsic:&lt;BR /&gt;#include &lt;INTRIN.H&gt;&lt;BR /&gt;unsigned __int64 __rdtsc(void);&lt;BR /&gt;&lt;BR /&gt;You can check if the TSC is invariant with the above link (see &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=101951"&gt;http://software.intel.com/en-us/forums/showthread.php?t=101951&lt;/A&gt;) &lt;BR /&gt;&lt;BR /&gt;Pat&lt;/INTRIN.H&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 20:56:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Intel-PCM-measure-time-using-Performance-Counters/m-p/776906#M290</guid>
      <dc:creator>Patrick_F_Intel1</dc:creator>
      <dc:date>2012-04-06T20:56:26Z</dc:date>
    </item>
  </channel>
</rss>

