<?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 TECHNOLOGY INTEL RAPL HELP in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/TECHNOLOGY-INTEL-RAPL-HELP/m-p/1063968#M5196</link>
    <description>&lt;P&gt;&lt;BR /&gt;
	Hello, I need help in understanding part of code technology intel rapl msr, I would like to know what its for and how it works&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void Rapl::sample() {
	uint32_t max_int = ~((uint32_t) 0);

	next_state-&amp;gt;pkg = read_msr(MSR_PKG_ENERGY_STATUS) &amp;amp; max_int;
	next_state-&amp;gt;pp0 = read_msr(MSR_PP0_ENERGY_STATUS) &amp;amp; max_int;

	if (pp1_supported) {
		next_state-&amp;gt;pp1 = read_msr(MSR_PP1_ENERGY_STATUS) &amp;amp; max_int;
		next_state-&amp;gt;dram = 0;
	} else {
		next_state-&amp;gt;pp1 = 0;
		next_state-&amp;gt;dram = read_msr(MSR_DRAM_ENERGY_STATUS) &amp;amp; max_int;
	}

	gettimeofday(&amp;amp;(next_state-&amp;gt;tsc), NULL);

	running_total.pkg += energy_delta(current_state-&amp;gt;pkg, next_state-&amp;gt;pkg);
	running_total.pp0 += energy_delta(current_state-&amp;gt;pp0, next_state-&amp;gt;pp0);
	running_total.pp1 += energy_delta(current_state-&amp;gt;pp0, next_state-&amp;gt;pp0);
	running_total.dram += energy_delta(current_state-&amp;gt;dram, next_state-&amp;gt;dram);

	rapl_state_t *pprev_state = prev_state;
	prev_state = current_state;
	current_state = next_state;
	next_state = pprev_state;
}
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE style="color: rgb(0, 0, 0);"&gt;
&lt;CODE&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;double Rapl::time_delta(struct timeval *begin, struct timeval *end) {
        return (end-&amp;gt;tv_sec - begin-&amp;gt;tv_sec)
                + ((end-&amp;gt;tv_usec - begin-&amp;gt;tv_usec)/1000000.0);
}
&lt;/PRE&gt;

	&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;

&lt;P&gt;&lt;SPAN style="font-size: 16.26px;"&gt;thanks for help in advance&lt;/SPAN&gt;&amp;nbsp;! :)&lt;/P&gt;</description>
    <pubDate>Sun, 08 Jan 2017 14:16:03 GMT</pubDate>
    <dc:creator>Luke_L_</dc:creator>
    <dc:date>2017-01-08T14:16:03Z</dc:date>
    <item>
      <title>TECHNOLOGY INTEL RAPL HELP</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/TECHNOLOGY-INTEL-RAPL-HELP/m-p/1063968#M5196</link>
      <description>&lt;P&gt;&lt;BR /&gt;
	Hello, I need help in understanding part of code technology intel rapl msr, I would like to know what its for and how it works&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void Rapl::sample() {
	uint32_t max_int = ~((uint32_t) 0);

	next_state-&amp;gt;pkg = read_msr(MSR_PKG_ENERGY_STATUS) &amp;amp; max_int;
	next_state-&amp;gt;pp0 = read_msr(MSR_PP0_ENERGY_STATUS) &amp;amp; max_int;

	if (pp1_supported) {
		next_state-&amp;gt;pp1 = read_msr(MSR_PP1_ENERGY_STATUS) &amp;amp; max_int;
		next_state-&amp;gt;dram = 0;
	} else {
		next_state-&amp;gt;pp1 = 0;
		next_state-&amp;gt;dram = read_msr(MSR_DRAM_ENERGY_STATUS) &amp;amp; max_int;
	}

	gettimeofday(&amp;amp;(next_state-&amp;gt;tsc), NULL);

	running_total.pkg += energy_delta(current_state-&amp;gt;pkg, next_state-&amp;gt;pkg);
	running_total.pp0 += energy_delta(current_state-&amp;gt;pp0, next_state-&amp;gt;pp0);
	running_total.pp1 += energy_delta(current_state-&amp;gt;pp0, next_state-&amp;gt;pp0);
	running_total.dram += energy_delta(current_state-&amp;gt;dram, next_state-&amp;gt;dram);

	rapl_state_t *pprev_state = prev_state;
	prev_state = current_state;
	current_state = next_state;
	next_state = pprev_state;
}
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE style="color: rgb(0, 0, 0);"&gt;
&lt;CODE&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;double Rapl::time_delta(struct timeval *begin, struct timeval *end) {
        return (end-&amp;gt;tv_sec - begin-&amp;gt;tv_sec)
                + ((end-&amp;gt;tv_usec - begin-&amp;gt;tv_usec)/1000000.0);
}
&lt;/PRE&gt;

	&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;

&lt;P&gt;&lt;SPAN style="font-size: 16.26px;"&gt;thanks for help in advance&lt;/SPAN&gt;&amp;nbsp;! :)&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jan 2017 14:16:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/TECHNOLOGY-INTEL-RAPL-HELP/m-p/1063968#M5196</guid>
      <dc:creator>Luke_L_</dc:creator>
      <dc:date>2017-01-08T14:16:03Z</dc:date>
    </item>
    <item>
      <title>Have you read Section 14.9 of</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/TECHNOLOGY-INTEL-RAPL-HELP/m-p/1063969#M5197</link>
      <description>&lt;P&gt;Have you read Section 14.9 of Volume 3 of the Intel Architectures Software Developer's Manual (document 325384, revision 060, September 2016)?&amp;nbsp; (The manual is currently available at &lt;A href="http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html)" target="_blank"&gt;http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 18:39:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/TECHNOLOGY-INTEL-RAPL-HELP/m-p/1063969#M5197</guid>
      <dc:creator>McCalpinJohn</dc:creator>
      <dc:date>2017-01-09T18:39:49Z</dc:date>
    </item>
  </channel>
</rss>

