* [Powertop] [RFC] [PATCH 10/11] Deduplication: merge go_idle()/go_unidle()/change_freq() overrides into abstract_cpu() class
@ 2012-11-05 11:12 Ivan Shapovalov
0 siblings, 0 replies; only message in thread
From: Ivan Shapovalov @ 2012-11-05 11:12 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 3806 bytes --]
When merging, also (while at it) use the new freq_updated() method in
these functions.
Signed-off-by: Ivan Shapovalov <intelfx100(a)gmail.com>
---
src/cpu/cpu.h | 11 +++--------
src/cpu/cpu_linux.cpp | 31 -------------------------------
src/cpu/intel_cpus.cpp | 28 ----------------------------
src/cpu/intel_cpus.h | 5 -----
4 files changed, 3 insertions(+), 72 deletions(-)
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 498447b..9c61641 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -143,9 +143,9 @@ public:
/* Frequency micro accounting methods */
virtual void calculate_freq(uint64_t time);
- virtual void go_idle(uint64_t time) { idle = true; if (parent) parent->calculate_freq(time);};
- virtual void go_unidle(uint64_t time) { idle = false; if (parent) parent->calculate_freq(time);};;
- virtual void change_freq(uint64_t time, int freq) { current_frequency = freq; if (parent) parent->calculate_freq(time);};
+ virtual void go_idle(uint64_t time) { idle = true; freq_updated(time); }
+ virtual void go_unidle(uint64_t time) { idle = false; freq_updated(time); }
+ virtual void change_freq(uint64_t time, int freq) { current_frequency = freq; freq_updated(time); }
virtual void change_effective_frequency(uint64_t time, uint64_t freq);
@@ -172,11 +172,6 @@ public:
virtual char * fill_pstate_line(int line_nr, char *buffer);
virtual char * fill_pstate_name(int line_nr, char *buffer);
-
- virtual void change_freq(uint64_t time, int freq);
- virtual void go_idle(uint64_t time);
- virtual void go_unidle(uint64_t time);
-
};
class cpu_core: public abstract_cpu
diff --git a/src/cpu/cpu_linux.cpp b/src/cpu/cpu_linux.cpp
index 24fbcb3..4025880 100644
--- a/src/cpu/cpu_linux.cpp
+++ b/src/cpu/cpu_linux.cpp
@@ -318,34 +318,3 @@ char * cpu_linux::fill_pstate_line(int line_nr, char *buffer)
sprintf(buffer," %5.1f%% ", percentage(1.0* (pstates[line_nr]->time_after) / total_stamp));
return buffer;
}
-
-
-
-
-void cpu_linux::change_freq(uint64_t time, int frequency)
-{
- current_frequency = frequency;
-
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
-
-void cpu_linux::go_idle(uint64_t time)
-{
-
- idle = true;
-
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
-
-
-void cpu_linux::go_unidle(uint64_t time)
-{
- idle = false;
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
index 89eefee..c49102b 100644
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -429,31 +429,3 @@ int nhm_cpu::has_pstate_level(int level)
return 1;
return cpu_linux::has_pstate_level(level);
}
-
-void nhm_cpu::change_freq(uint64_t time, int frequency)
-{
- current_frequency = frequency;
-
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
-
-void nhm_cpu::go_idle(uint64_t time)
-{
-
- idle = true;
-
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
-
-
-void nhm_cpu::go_unidle(uint64_t time)
-{
- idle = false;
- if (parent)
- parent->calculate_freq(time);
- old_idle = idle;
-}
diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
index a4c0852..a125540 100644
--- a/src/cpu/intel_cpus.h
+++ b/src/cpu/intel_cpus.h
@@ -98,11 +98,6 @@ public:
virtual char * fill_pstate_name(int line_nr, char *buffer);
virtual char * fill_pstate_line(int line_nr, char *buffer);
virtual int has_pstate_level(int level);
-
- virtual void change_freq(uint64_t time, int freq);
- virtual void go_idle(uint64_t time);
- virtual void go_unidle(uint64_t time);
-
};
class atom_package: public cpu_package
--
1.8.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-11-05 11:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 11:12 [Powertop] [RFC] [PATCH 10/11] Deduplication: merge go_idle()/go_unidle()/change_freq() overrides into abstract_cpu() class Ivan Shapovalov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.