unsigned long long cpu_total_time;
unsigned long long cpu_idle_time;
guint idle_checker;
+ int threshold;
} candidate_process_context_t;
typedef struct {
static GList *candidate_slot_list;
static app_labels_monitor *label_monitor;
static GList *launcher_info_list;
-static int __threshold = DEFAULT_THRESHOLD;
static candidate_process_context_t *__add_slot(int type, int loader_id,
int caller_pid, const char *loader_path, const char *extra,
return ret;
}
-static void __update_threshold(float delta)
+static void __update_threshold(candidate_process_context_t *cpc, float delta)
{
static float pos = 0.0f;
if (pos > 1.0f)
pos = 1.0f;
- __threshold = (int)(__interpolator(pos) * 100);
- _D("[CPU] delta:%f / input cursor : %f / threshold : %d", delta, pos, __threshold);
+ cpc->threshold = (int)(__interpolator(pos) * 100);
+ _D("[CPU] type:%d / delta:%f / input cursor : %f / threshold : %d",
+ cpc->type, delta, pos, cpc->threshold);
}
static gboolean __handle_idle_checker(gpointer data)
per = (idle - cpc->cpu_idle_time) * 100 / (total - cpc->cpu_total_time);
_D("[CPU] Idle : %d / type : %d", per, cpc->type);
- if (per >= __threshold) {
- __update_threshold(-0.02f * (per - __threshold));
+ if (per >= cpc->threshold) {
+ __update_threshold(cpc, -0.02f * (per - cpc->threshold));
__prepare_candidate_process(cpc->type, cpc->loader_id);
cpc->idle_checker = 0;
return G_SOURCE_REMOVE;
cpc->cpu_idle_time = idle;
cpc->cpu_total_time = total;
- __update_threshold(0.05f);
+ __update_threshold(cpc, 0.05f);
return G_SOURCE_CONTINUE;
}
cpc->cpu_total_time = 0;
cpc->cpu_idle_time = 0;
cpc->idle_checker = 0;
+ cpc->threshold = DEFAULT_THRESHOLD;
fd = __listen_candidate_process(cpc->type, cpc->loader_id);
if (fd == -1) {