Eina_List *l;
// static int doframeinfo = -1;
+ static double rtime = 0.0;
+ static double rlapse = 0.0;
+ static int frames = 0;
+ static int flapse = 0;
+
if (!e_comp) return EINA_FALSE;
TRACE_DS_BEGIN(COMP:UPDATE CB);
}
else
{
+#if 0
if (e_comp->calc_fps)
{
double fps = 0.0, dt;
ecore_event_add(E_EVENT_COMPOSITOR_FPS_UPDATE, NULL, NULL, NULL);
}
}
+#else
+ if (e_comp->calc_fps)
+ {
+ double dt;
+ double tim = ecore_time_get();
+
+ dt = tim - e_comp->frametimes[0];
+ e_comp->frametimes[0] = tim;
+
+ rtime += dt;
+ frames++;
+
+ if (rlapse == 0.0)
+ {
+ rlapse = tim;
+ flapse = frames;
+ }
+ else if ((tim - rlapse) >= 1.0)
+ {
+ e_comp->fps = (frames - flapse) / (tim - rlapse);
+ rlapse = tim;
+ flapse = frames;
+ rtime = 0.0;
+ }
+ }
+#endif
}
if (conf->lock_fps)
{
static E_Info_Client e_info_client;
+static int keepRunning = 1;
+static void end_program (int sig);
static Eina_Bool _e_info_client_eldbus_message(const char *method, E_Info_Message_Cb cb);
static Eina_Bool _e_info_client_eldbus_message_with_args(const char *method, E_Info_Message_Cb cb, const char *signature, ...);
}
+static void
+_cb_fps_info_get(const Eldbus_Message *msg)
+{
+ const char *name = NULL, *text = NULL;
+ Eina_Bool res;
+ const char *fps;
+
+ res = eldbus_message_error_get(msg, &name, &text);
+ EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+ res = eldbus_message_arguments_get(msg, "s", &fps);
+ EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+ if (strcmp(fps, "no_update"))
+ printf("%s\n", fps);
+
+finish:
+ if ((name) || (text )) {
+ printf("errname:%s errmsg:%s\n", name, text);
+ }
+}
+
+static void
+_e_info_client_proc_fps_info(int argc, char **argv)
+{
+ keepRunning = 1;
+
+ do {
+ if (!_e_info_client_eldbus_message("get_fps_info", _cb_fps_info_get))
+ return;
+
+ sleep(1);
+
+ }while(keepRunning);
+}
+
static struct
{
const char *option;
"input_devices", NULL,
"Print connected input devices",
_e_info_client_proc_input_device_info
+ },
+ {
+ "fps", NULL,
+ "Print FPS in every sec",
+ _e_info_client_proc_fps_info
}
};
int nproc = sizeof(procs) / sizeof(procs[0]);
int i;
+ signal(SIGINT, end_program);
+ signal(SIGALRM, end_program);
+ signal(SIGHUP, end_program);
+ signal(SIGPIPE, end_program);
+ signal(SIGQUIT, end_program);
+ signal(SIGTERM, end_program);
+
for (i = 0; i < nproc; i++)
{
if (!strncmp(argv[1]+1, procs[i].option, strlen(procs[i].option)))
printf("\n");
}
+static void end_program (int sig)
+{
+ keepRunning = 0;
+}
+
int
main(int argc, char **argv)
{
return reply;
}
+static Eldbus_Message *
+_e_info_server_cb_fps_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ static double old_fps = 0;
+
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ char buf[128] = {};
+
+ if (!e_comp->calc_fps)
+ {
+ e_comp->calc_fps = 1;
+ }
+
+ if (old_fps == e_comp->fps)
+ {
+ snprintf(buf, sizeof(buf), "no_update");
+ }
+ else if (e_comp->fps > 0.0)
+ {
+ snprintf(buf, sizeof(buf), "... FPS %3.1f", e_comp->fps);
+ old_fps = e_comp->fps;
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf), "... FPS N/A");
+ }
+
+ eldbus_message_arguments_append(reply, "s", buf);
+ return reply;
+}
+
static const Eldbus_Method methods[] = {
{ "get_window_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
{ "dump_topvwins", ELDBUS_ARGS({"s", "directory"}), NULL, _e_info_server_cb_topvwins_dump, 0 },
{ "rotation_message", ELDBUS_ARGS({"iii", "rotation_message"}), NULL, _e_info_server_cb_rotation_message, 0},
{ "get_res_lists", ELDBUS_ARGS({VALUE_TYPE_REQUEST_RESLIST, "client resource"}), ELDBUS_ARGS({"a("VALUE_TYPE_REPLY_RESLIST")", "array of client resources"}), _e_info_server_cb_res_lists_get, 0 },
{ "get_input_devices", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_INPUTDEV")", "array of input"}), _e_info_server_cb_input_device_info_get, 0},
+ { "get_fps_info", NULL, ELDBUS_ARGS({"s", "fps request"}), _e_info_server_cb_fps_info_get, 0},
{ NULL, NULL, NULL, NULL, 0 }
};