netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=0781f707d5afea784699c5ea35f222f7f93fa753

commit 0781f707d5afea784699c5ea35f222f7f93fa753
Author: Alastair Poole <nets...@gmail.com>
Date:   Sun Sep 6 13:23:08 2020 +0100

    cpu: basic freq.
---
 src/bin/system/machine.h         |  3 +++
 src/bin/system/machine/cpu.bogox | 21 +++++++++++++++++++++
 src/bin/ui/ui.c                  |  1 +
 src/bin/ui/ui_util.c             |  6 ++++--
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/bin/system/machine.h b/src/bin/system/machine.h
index a9583cc..8d95ea4 100644
--- a/src/bin/system/machine.h
+++ b/src/bin/system/machine.h
@@ -97,6 +97,9 @@ system_cpu_usage_get(int *ncpu);
 cpu_core_t **
 system_cpu_usage_delayed_get(int *ncpu, int usecs);
 
+int
+system_cpu_frequency_get(void);
+
 void
 system_memory_usage_get(meminfo_t *memory);
 
diff --git a/src/bin/system/machine/cpu.bogox b/src/bin/system/machine/cpu.bogox
index 5a71de6..8e9999c 100644
--- a/src/bin/system/machine/cpu.bogox
+++ b/src/bin/system/machine/cpu.bogox
@@ -279,3 +279,24 @@ system_cpu_usage_get(int *ncpu)
    return system_cpu_usage_delayed_get(ncpu, 1000000);
 }
 
+int
+system_cpu_frequency_get(void)
+{
+   int freq = -1;
+
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+   size_t len = sizeof(freq);
+   if (sysctlbyname("dev.cpu.0.freq", &freq, &len, NULL, 0) != -1)
+     freq *= 1000;
+#elif defined(__OpenBSD__)
+   int mib[2] = { CTL_HW, HW_CPUSPEED };
+   size_t len = sizeof(freq);
+   if (sysctl(mib, sizeof(mib), &freq, &len, NULL, 0) != -1)
+     freq *= 1000;
+#elif defined(__linux__)
+
+#else
+
+#endif
+   return freq;
+}
diff --git a/src/bin/ui/ui.c b/src/bin/ui/ui.c
index 4303861..d353b40 100644
--- a/src/bin/ui/ui.c
+++ b/src/bin/ui/ui.c
@@ -1671,6 +1671,7 @@ _system_info_all_poll_feedback_cb(void *data, 
Ecore_Thread *thread, void *msg)
    if (ui->zfs_mounted)
      info->memory.used += info->memory.zfs_arc_used;
 
+   printf("it is %d\n", system_cpu_frequency_get());
    pb = ui->progress_mem;
    ratio = info->memory.total / 100.0;
    value = info->memory.used / ratio;
diff --git a/src/bin/ui/ui_util.c b/src/bin/ui/ui_util.c
index 196b86b..5ae93ec 100644
--- a/src/bin/ui/ui_util.c
+++ b/src/bin/ui/ui_util.c
@@ -270,6 +270,7 @@ about_anim(void *data)
    ad = data;
 
    evas_object_geometry_get(ad->bg, NULL, NULL,  &w, &h);
+   if (w <= 0 || h <= 0) return EINA_TRUE;
    evas_object_geometry_get(ad->label, &x, NULL, &ow, &oh);
    evas_object_move(ad->label, x, ad->pos);
    evas_object_show(ad->label);
@@ -504,6 +505,7 @@ _anim_clouds(void *data)
    ui = anim->ui;
 
    evas_object_geometry_get(ui->win, NULL, NULL, &ww, &wh);
+   if (ww <= 0 || wh <= 0) return EINA_TRUE;
    evas_object_image_size_get(anim->im, &iw, &ih);
 
    if (ww > iw) iw = ww;
@@ -537,8 +539,8 @@ _anim_clouds(void *data)
         evas_object_show(anim->bolt);
      }
 
-   if (bolt && bolt % 2) evas_object_hide(anim->bolt);
-   if (bolt > 30)
+   if (bolt && (bolt % 2)) evas_object_hide(anim->bolt);
+   if (bolt > 20)
      {
         evas_object_hide(anim->bolt);
         bolt = 0;

-- 


Reply via email to