Skip to contentSkip to conversation

devfreq: add devfreq devices stats support

PATCH Superseded Sanjay Singh Rawat 1 participant 1 message Oct 10, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Sanjay Singh Rawat

author
#0 lore raw

PATCH v3 1/1 devfreq: add devfreq devices stats support

add window to show frequency stats for devfreq devices

Signed-off-by Rajagopal Venkat <rajagopal.venkat(a)gmail.com>
Signed-off-by Sanjay Singh Rawat <sanjay.rawat(a)linaro.org>

---

v3 - remove unused variables, reduce array size to suitable value
- replace the inactive code block in the report function with TODO comment

v2 - Show devfreq window on support basis. Check for empty devfreq
directory.
- Free the open dirp while exiting.

---
 src/Makefile.am           |   1 +
 src/devices/devfreq.cpp   | 333 ++++++++++++++++++++++++++++++++++++++++++++++
 src/devices/devfreq.h     |  75 +++++++++++
 src/main.cpp              |   9 ++
 src/report/report-maker.h |   1 +
 5 files changed, 419 insertions(+)
 create mode 100644 src/devices/devfreq.cpp
 create mode 100644 src/devices/devfreq.h
src/Makefile.am +1 -0
index 311b75e..d2f1da7 100644
@@ -39,6 +39,7 @@ powertop_SOURCES = \
 	devices/alsa.h \
 	devices/backlight.cpp \
 	devices/backlight.h \
+	devices/devfreq.cpp \
 	devices/device.cpp \
 	devices/device.h \
 	devices/gpu_rapl_device.cpp \
src/devices/devfreq.cpp new file +333 -0

333 lines not on this page · raw message

src/devices/devfreq.h new file +75 -0

75 lines not on this page · raw message

src/main.cpp +9 -0
index d3963ed..2162004 100644
@@ -48,6 +48,7 @@
 
 
 #include "devices/device.h"
+#include "devices/devfreq.h"
 #include "devices/usb.h"
 #include "devices/ahci.h"
 #include "measurement/measurement.h"
@@ -201,6 +202,7 @@ void one_measurement(int seconds, char *workload)
 	create_all_usb_devices();
 	start_power_measurement();
 	devices_start_measurement();
+	start_devfreq_measurement();
 	start_process_measurement();
 	start_cpu_measurement();
 
@@ -213,6 +215,7 @@ void one_measurement(int seconds, char *workload)
 	end_cpu_measurement();
 	end_process_measurement();
 	collect_open_devices();
+	end_devfreq_measurement();
 	devices_end_measurement();
 	end_power_measurement();
 
@@ -240,6 +243,8 @@ void one_measurement(int seconds, char *workload)
 	report_show_open_devices();
 
 	report_devices();
+	display_devfreq_devices();
+	report_devfreq_devices();
 	ahci_create_device_stats_table();
 	store_results(measurement_time);
 	end_cpu_data();
@@ -353,6 +358,7 @@ static void powertop_init(void)
 
 	enumerate_cpus();
 	create_all_devices();
+	create_all_devfreq_devices();
 	detect_power_meters();
 
 	register_parameter("base power", 100, 0.5);
@@ -464,6 +470,8 @@ int main(int argc, char **argv)
 	}
 	if (!auto_tune)
 		init_display();
+
+	initialize_devfreq();
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -500,6 +508,7 @@ int main(int argc, char **argv)
 
 	clean_open_devices();
 	clear_all_devices();
+	clear_all_devfreq();
 	clear_all_cpus();
 
 	return 0;
src/report/report-maker.h +1 -0
index 423568a..bda4cef 100644
@@ -89,6 +89,7 @@ enum section_type {
 	SECTION_SYSINFO,
 	SECTION_CPUIDLE,
 	SECTION_CPUFREQ,
+	SECTION_DEVFREQ,
 	SECTION_DEVPOWER,
 	SECTION_SOFTWARE,
 	SECTION_SUMMARY,
Signature · 1 line
1.8.3.2