From 993d1ff0d1f91383fa56a4ab3c0e689f34e3c379 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 18 Jun 2012 11:50:05 +0900 Subject: [PATCH] Load time and Execute time is separated. Loading a new livebox is not able to be completed in A sec.. So it is changed to 10 secs. But the other function call should be returned in A sec like old. Change-Id: Ia81663008057ec958ff05c121588d94ffd275e63 --- include/conf.h | 1 + include/fault.h | 2 +- src/fault.c | 8 ++++---- src/livebox.c | 4 ++-- src/so_handler.c | 34 +++++++++++++++++----------------- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/include/conf.h b/include/conf.h index 02be3ed..e61de73 100644 --- a/include/conf.h +++ b/include/conf.h @@ -50,6 +50,7 @@ extern struct conf g_conf; extern int conf_init(void); #define DEFAULT_LIFE_TIMER 1 +#define DEFAULT_LOAD_TIMER 10 #define DEFAULT_UPDATE_TIMEOUT 7 #define BASE_W 720 #define BASE_H 1280 diff --git a/include/fault.h b/include/fault.h index f5d6f54..cf033b9 100644 --- a/include/fault.h +++ b/include/fault.h @@ -1,6 +1,6 @@ extern int fault_init(void); extern int fault_fini(void); -extern int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm); +extern int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time); extern int fault_unmark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm); /* End of a file */ diff --git a/src/fault.c b/src/fault.c index 61d3beb..912a8bb 100644 --- a/src/fault.c +++ b/src/fault.c @@ -55,8 +55,8 @@ static void signal_handler(int signum, siginfo_t *info, void *unused) return; } - DbgPrint("ALARM: %d.%d (%d)\n", - res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER); + DbgPrint("ALARM: %d.%d (%d, %d)\n", + res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER); } else { int i; int fd; @@ -155,7 +155,7 @@ int fault_fini(void) return 0; } -int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm) +int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time) { struct packet *packet; @@ -178,7 +178,7 @@ int fault_mark_call(const char *pkgname, const char *filename, const char *funcn if (!noalarm) { gettimeofday(&s_info.alarm_tv, NULL); s_info.marked = 1; - alarm(DEFAULT_LIFE_TIMER); + alarm(life_time); } return 0; diff --git a/src/livebox.c b/src/livebox.c index 0bb9313..e446d3d 100644 --- a/src/livebox.c +++ b/src/livebox.c @@ -219,7 +219,7 @@ static Eina_Bool update_timeout_cb(void *data) ErrPrint("Updating item is not matched\n"); fault_unmark_call(item->inst->item->pkgname, item->inst->filename, "update,crashed", NO_ALARM); - fault_mark_call(item->inst->item->pkgname, item->inst->filename, "update,timeout", NO_ALARM); + fault_mark_call(item->inst->item->pkgname, item->inst->filename, "update,timeout", NO_ALARM, DEFAULT_LIFE_TIMER); s_info.update = NULL; exit(ETIME); @@ -274,7 +274,7 @@ static Eina_Bool updator_cb(void *data) * While waiting the Callback function call, * Add this for finding the crash */ - fault_mark_call(item->inst->item->pkgname, item->inst->filename, "update,crashed", NO_ALARM); + fault_mark_call(item->inst->item->pkgname, item->inst->filename, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER); if (ret < 0) { item->monitor_cnt--; diff --git a/src/so_handler.c b/src/so_handler.c index b88e3c1..0b1a963 100644 --- a/src/so_handler.c +++ b/src/so_handler.c @@ -75,14 +75,14 @@ static void delete_livebox(struct so_item *item) { if (item->adaptor.finalize) { int ret; - fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM); + fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); ret = item->adaptor.finalize(item->pkgname); fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM); ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret); } else if (item->livebox.finalize) { int ret; - fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM); + fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); ret = item->livebox.finalize(); fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM); @@ -129,7 +129,7 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi) return NULL; } - fault_mark_call(pkgname, __func__, __func__, USE_ALARM); + fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER); item->handle = dlopen(livebox_path, RTLD_LOCAL | RTLD_LAZY); if (!item->handle) { fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); @@ -202,7 +202,7 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi) if (item->adaptor.initialize) { int ret; - fault_mark_call(pkgname, "initialize", __func__, USE_ALARM); + fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); ret = item->adaptor.initialize(pkgname); fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM); if (ret < 0) { @@ -251,7 +251,7 @@ static struct so_item *new_livebox(const char *pkgname) return NULL; } - fault_mark_call(pkgname, __func__, __func__, USE_ALARM); + fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER); item->handle = dlopen(livebox_path, RTLD_LOCAL | RTLD_LAZY); if (!item->handle) { fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); @@ -324,7 +324,7 @@ static struct so_item *new_livebox(const char *pkgname) if (item->livebox.initialize) { int ret; - fault_mark_call(pkgname, "initialize", __func__, USE_ALARM); + fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); ret = item->livebox.initialize(pkgname); fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM); if (ret < 0) { @@ -470,7 +470,7 @@ int so_create(const char *pkgname, const char *filename, const char *content_inf if (!item->heap) DbgPrint("Failed to prepare heap monitor\n"); - fault_mark_call(pkgname, filename, __func__, USE_ALARM); + fault_mark_call(pkgname, filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.create) { ret = item->adaptor.create(pkgname, filename, content_info, cluster, category); @@ -509,7 +509,7 @@ int so_destroy(struct instance *inst) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.destroy) { ret = item->adaptor.destroy(item->pkgname, inst->filename); @@ -544,7 +544,7 @@ int so_is_updated(struct instance *inst) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.is_updated) { ret = item->adaptor.is_updated(item->pkgname, inst->filename); @@ -568,7 +568,7 @@ int so_need_to_destroy(struct instance *inst) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.need_to_destroy) { ret = item->adaptor.need_to_destroy(item->pkgname, inst->filename); @@ -592,7 +592,7 @@ int so_update(struct instance *inst) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); if (item->adaptor.update_content) { ret = item->adaptor.update_content(item->pkgname, inst->filename); } else if (item->livebox.update_content) { @@ -614,7 +614,7 @@ int so_clicked(struct instance *inst, const char *event, double timestamp, doubl if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.clicked) { ret = item->adaptor.clicked(item->pkgname, inst->filename, event, timestamp, x, y); @@ -638,7 +638,7 @@ int so_script_event(struct instance *inst, const char *emission, const char *sou if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.script_event) { ret = item->adaptor.script_event(item->pkgname, inst->filename, emission, source, event_info); @@ -662,7 +662,7 @@ int so_resize(struct instance *inst, int w, int h) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.resize) { ret = item->adaptor.resize(item->pkgname, inst->filename, w, h); @@ -692,7 +692,7 @@ int so_create_needed(const char *pkgname, const char *cluster, const char *categ return -EFAULT; } - fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM); + fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.create_needed) { ret = item->adaptor.create_needed(pkgname, cluster, category); @@ -729,7 +729,7 @@ int so_change_group(struct instance *inst, const char *cluster, const char *cate return -ENOMEM; } - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.change_group) { ret = item->adaptor.change_group(item->pkgname, inst->filename, cluster, category); @@ -763,7 +763,7 @@ int so_get_output_info(struct instance *inst, int *w, int *h, double *priority) if (!item) return -EINVAL; - fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM); + fault_mark_call(item->pkgname, inst->filename, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); heap_hook(item->heap); if (item->adaptor.get_output_info) { ret = item->adaptor.get_output_info(item->pkgname, inst->filename, w, h, priority); -- 2.7.4