[Powertop] [PATCH 2/3] Use package name to identify domains

Srinivas Pandruvada <srinivas.pandruvada at linux.intel.com>
Newsgroups dev.linux.lists.powertop
Message-ID <1401928523-3378-2-git-send-email-srinivas.pandruvada@linux.intel.com>
Here the cpu is identifying a package id. Currently the RAPL
package name is not used, but by changing to powercap sysfs
package name, it can be used to identify RAPL package domains
in a multi processor system.
---
 src/cpu/cpu.cpp              | 4 ++--
 src/cpu/cpu_rapl_device.cpp  | 4 ++--
 src/cpu/dram_rapl_device.cpp | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index b3b6166..37cc409 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -82,14 +82,14 @@ static class abstract_cpu * new_package(int package, int cpu, char * vendor, int
 	cpudev = new class cpudevice(_("cpu package"), packagename, ret);
 	all_devices.push_back(cpudev);
 
-	sprintf(packagename, _("cpu rapl package %i"), cpu);
+	sprintf(packagename, _("package-%i"), cpu);
 	cpu_rapl_dev = new class cpu_rapl_device(cpudev, _("cpu rapl package"), packagename, ret);
 	if (cpu_rapl_dev->device_present())
 		all_devices.push_back(cpu_rapl_dev);
 	else
 		delete cpu_rapl_dev;
 
-	sprintf(packagename, _("dram rapl package %i"), cpu);
+	sprintf(packagename, _("package-%i"), cpu);
 	dram_rapl_dev = new class dram_rapl_device(cpudev, _("dram rapl package"), packagename, ret);
 	if (dram_rapl_dev->device_present())
 		all_devices.push_back(dram_rapl_dev);
diff --git a/src/cpu/cpu_rapl_device.cpp b/src/cpu/cpu_rapl_device.cpp
index be10d9e..357a1c8 100644
--- a/src/cpu/cpu_rapl_device.cpp
+++ b/src/cpu/cpu_rapl_device.cpp
@@ -33,9 +33,9 @@ cpu_rapl_device::cpu_rapl_device(cpudevice *parent, const char *classname, const
 	  device_valid(false)
 {
 	if (_cpu)
-		rapl = new c_rapl_interface(cpu->get_first_cpu());
+		rapl = new c_rapl_interface(dev_name, cpu->get_first_cpu());
 	else
-		rapl = new c_rapl_interface(0);
+		rapl = new c_rapl_interface();
 	last_time = time(NULL);
 	if (rapl->pp0_domain_present()) {
 		device_valid = true;
diff --git a/src/cpu/dram_rapl_device.cpp b/src/cpu/dram_rapl_device.cpp
index fd31cb5..36d47a2 100644
--- a/src/cpu/dram_rapl_device.cpp
+++ b/src/cpu/dram_rapl_device.cpp
@@ -34,9 +34,9 @@ dram_rapl_device::dram_rapl_device(cpudevice *parent, const char *classname, con
 	  device_valid(false)
 {
 	if (_cpu)
-		rapl = new c_rapl_interface(cpu->get_first_cpu());
+		rapl = new c_rapl_interface(dev_name, cpu->get_first_cpu());
 	else
-		rapl = new c_rapl_interface(0);
+		rapl = new c_rapl_interface();
 	last_time = time(NULL);
 	if (rapl->dram_domain_present()) {
 		device_valid = true;
-- 
1.7.11.7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.