watcher: wip
This commit is contained in:
parent
58a039a820
commit
3138afa782
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef EVISUM_WATCHER_H
|
||||
#define EVISUM_WATCHER_H
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "machine.h"
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef MACHINE_H
|
||||
#define MACHINE_H
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,4 @@
|
|||
src += files([
|
||||
'machine.c',
|
||||
'machine.h',
|
||||
])
|
Loading…
Reference in New Issue