summaryrefslogtreecommitdiffstats
path: root/src/utl_cpuu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utl_cpuu.cpp')
-rwxr-xr-xsrc/utl_cpuu.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/utl_cpuu.cpp b/src/utl_cpuu.cpp
index 7786356e..c01326d6 100755
--- a/src/utl_cpuu.cpp
+++ b/src/utl_cpuu.cpp
@@ -42,10 +42,11 @@ void CCpuUtlCp::Update(){
if ( m_dpcpu->sample_data() ) {
m_work++;
}
- if (m_ticks==100) {
+ if (m_ticks==100000) {
/* LPF*/
- m_cpu_util_lpf = (m_cpu_util_lpf*0.75)+((double)m_work*0.25);
- AppendHistory(m_work);
+ double work = (m_work / double(m_ticks)) * 100;
+ m_cpu_util_lpf = (m_cpu_util_lpf*0.75)+(work*0.25);
+ AppendHistory(work);
m_ticks=0;
m_work=0;
}
@@ -62,10 +63,10 @@ uint8_t CCpuUtlCp::GetValRaw(){
}
/* get cpu % utilization history */
-void CCpuUtlCp::GetHistory(cpu_vct_t &cpu_vct){
- cpu_vct.clear();
+void CCpuUtlCp::GetHistory(cpu_vct_st &cpu_vct){
+ cpu_vct.m_history.clear();
for (int i = m_history_latest_index + m_history_size; i > m_history_latest_index; i--) {
- cpu_vct.push_back(m_cpu_util[i % m_history_size]);
+ cpu_vct.m_history.push_back(m_cpu_util[i % m_history_size]);
}
}