Hi guys,
Attached is a patch to add configurable precision for ecore timers, an
idea that I got at ELC-E from various power saving talks and also
after looking at my machine's powertop results with some effects
running.
Since timers can be delayed by the system itself, for example under
heavy load, the idea here is to dispatch as much as possible the
timers at the same time. If we have timers that abs(t1 - t2) <=
precision, then have the timer to expire in max(t1, t2) and then
min(t1, t2) will be delayed up to precision amount. Maybe i was not
too clear, attached is also a test case.
I still don't have any code using it, but possible I'll add to some products.
Please comment and I'll commit it to SVN this weekend.
--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [EMAIL PROTECTED]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
#include <Ecore.h>
#include <stdio.h>
#include <stdlib.h>
static double t0;
static const double t1 = 0.6;
static const double t2 = 1.0;
static const double precision = 0.5;
struct test_data
{
struct {
double f1, f2;
} last;
struct {
double f1, f2;
} count;
};
static int
idle(void *data)
{
struct test_data *d = data;
printf("idle: f1: %8.2f (%2.2f %2.2f), f2: %8.2f (%2.2f %2.2f), "
"dif=%+1.2f\n",
d->last.f1, d->count.f1 * t1, d->last.f1 - t0,
d->last.f2, d->count.f2 * t2, d->last.f2 - t0,
d->last.f2 - d->last.f1);
return 1;
}
static int
f1(void *data)
{
struct test_data *d = data;
d->last.f1 = ecore_loop_time_get();
d->count.f1++;
printf(" f1: %8.2f (%2.2f)\n", d->last.f1, d->count.f1 * t1);
return 1;
}
static int
f2(void *data)
{
struct test_data *d = data;
d->last.f2 = ecore_loop_time_get();
d->count.f2++;
printf(" f2: %8.2f (%2.2f)\n", d->last.f2, d->count.f2 * t2);
return 1;
}
static int
quit(void *data)
{
ecore_main_loop_quit();
return 1;
}
int main(void)
{
struct test_data d;
ecore_init();
ecore_timer_precision_set(0.5);
t0 = ecore_loop_time_get();
d.last.f1 = ecore_loop_time_get();
d.last.f2 = ecore_loop_time_get();
d.count.f1 = 0;
d.count.f2 = 0;
ecore_timer_add(0.6, f1, &d);
ecore_timer_add(1.0, f2, &d);
ecore_idle_enterer_add(idle, &d);
ecore_timer_add(5.0, quit, NULL);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel