netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=3138afa782ed37cdebd639321a7ee45a509c50af

commit 3138afa782ed37cdebd639321a7ee45a509c50af
Author: Alastair Poole <nets...@gmail.com>
Date:   Sun May 16 12:12:19 2021 +0100

    watcher: wip
---
 src/bin/evisum_system.h  | 16 ++++++++++++++++
 src/bin/evisum_watcher.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/bin/evisum_watcher.h |  6 ++++++
 src/bin/meson.build      | 12 ++++++++++++
 src/bin/next/machine.c   |  1 +
 src/bin/next/machine.h   |  5 +++++
 src/bin/next/meson.build |  4 ++++
 7 files changed, 86 insertions(+)

diff --git a/src/bin/evisum_system.h b/src/bin/evisum_system.h
new file mode 100644
index 0000000..f826cb2
--- /dev/null
+++ b/src/bin/evisum_system.h
@@ -0,0 +1,16 @@
+#ifndef EVISUM_SYSTEM_H
+#define EVISUM_SYSTEM_H
+
+typedef struct _Evisum_System
+{
+   struct
+   {
+      int        count;
+      Eina_List *cores;
+      int        freq_min, freq_max;
+      int        temp_min, temp_max;
+   } cpu;
+
+} Evisum_System;
+
+#endif
diff --git a/src/bin/evisum_watcher.c b/src/bin/evisum_watcher.c
new file mode 100644
index 0000000..87b85b0
--- /dev/null
+++ b/src/bin/evisum_watcher.c
@@ -0,0 +1,42 @@
+#include <Eina.h>
+#include <Ecore.h>
+#include "next/machine.h"
+
+static Eina_Thread *background_thread = NULL;
+static Eina_List   *cores = NULL;
+static Eina_List   *batteries = NULL;
+static Eina_List   *sensors = NULL;
+static Eina_List   *network_interfaces = NULL;
+
+#define SECOND 1000000
+#define INTERVAL 16
+#define SLEEP_DURATION SECOND / INTERVAL
+#define CHECK_EVERY_SECOND(n) ((!n) || (!(n % INTERVAL))) 
+
+static void
+_cb_background_thread(void *data EINA_UNUSED, Ecore_Thread *thread)
+{
+   int64_t poll_count = 0;
+
+   while (!ecore_thread_check(thread))
+     {
+        if (CHECK_EVERY_SECOND(poll_count)) {}
+
+        usleep(SLEEP_DURATION);
+       poll_count++;
+     }
+}
+
+int
+main(int argc, char **argv)
+{
+   ecore_init();
+
+   background_thread = ecore_thread_run(_cb_background_thread, NULL, NULL, 
NULL);
+
+   ecore_main_loop_begin();
+
+   ecore_shutdown();
+
+   return 0;
+}
diff --git a/src/bin/evisum_watcher.h b/src/bin/evisum_watcher.h
new file mode 100644
index 0000000..7f4ed1b
--- /dev/null
+++ b/src/bin/evisum_watcher.h
@@ -0,0 +1,6 @@
+#ifndef EVISUM_WATCHER_H
+#define EVISUM_WATCHER_H
+
+
+
+#endif
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 4ed10a7..ee7a023 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -20,6 +20,18 @@ executable('evisum', src,
    gui_app              : true,
    install              : true)
 
+
+src_watch = files([
+   'evisum_watcher.c',
+   'evisum_watcher.h',
+])
+
+executable('evisum_watcher', src_watch,
+   include_directories  : inc,
+   dependencies         : [ deps, deps_os, deps_nls ],
+   gui_app              : false,
+   install              : true)
+
 if host_os == 'freebsd' or host_os == 'dragonfly'
    meson.add_install_script('perms.sh')
 endif
diff --git a/src/bin/next/machine.c b/src/bin/next/machine.c
new file mode 100644
index 0000000..a1a4e5f
--- /dev/null
+++ b/src/bin/next/machine.c
@@ -0,0 +1 @@
+#include "machine.h"
diff --git a/src/bin/next/machine.h b/src/bin/next/machine.h
new file mode 100644
index 0000000..1763df9
--- /dev/null
+++ b/src/bin/next/machine.h
@@ -0,0 +1,5 @@
+#ifndef MACHINE_H
+#define MACHINE_H
+
+
+#endif
diff --git a/src/bin/next/meson.build b/src/bin/next/meson.build
new file mode 100644
index 0000000..5d7961e
--- /dev/null
+++ b/src/bin/next/meson.build
@@ -0,0 +1,4 @@
+src += files([
+   'machine.c',
+   'machine.h',
+])

-- 


Reply via email to