cpu: basic freq.

This commit is contained in:
Alastair Poole 2020-09-06 13:23:08 +01:00
parent 74efbb1178
commit 0781f707d5
4 changed files with 29 additions and 2 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;