summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghoon Park <jh9216.park@samsung.com>2017-06-19 14:56:05 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2017-08-09 10:53:31 +0900
commitb5bd3bcc9314344ef346f003f21eaf11295022a8 (patch)
tree110dd4be5159f74aaba29e3a7fdfb6ffd2a1e045
parentde0256beb6e63fdb153564c925a21f99d3bbfc48 (diff)
downloadlaunchpad-b5bd3bcc9314344ef346f003f21eaf11295022a8.tar.gz
launchpad-b5bd3bcc9314344ef346f003f21eaf11295022a8.tar.bz2
launchpad-b5bd3bcc9314344ef346f003f21eaf11295022a8.zip
Separate threshold value for each slot
- A threshold value should not affect other slots Change-Id: I3ed88b7866009515b7c5afb7110649bd7b4017f6 Signed-off-by: Junghoon Park <jh9216.park@samsung.com> Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rwxr-xr-xsrc/launchpad.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/launchpad.c b/src/launchpad.c
index 711ea7c..d2cdf3b 100755
--- a/src/launchpad.c
+++ b/src/launchpad.c
@@ -84,6 +84,7 @@ typedef struct {
unsigned long long cpu_idle_time;
guint idle_checker;
int cur_event;
+ int threshold;
} candidate_process_context_t;
typedef struct {
@@ -110,7 +111,6 @@ static int user_slot_offset;
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,
@@ -1107,7 +1107,7 @@ static float __interpolator(float input)
return ret;
}
-static void __update_threshold(float delta)
+static void __update_threshold(candidate_process_context_t *cpc, float delta)
{
static float pos = 0.0f;
@@ -1118,8 +1118,9 @@ static void __update_threshold(float delta)
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)
@@ -1141,8 +1142,8 @@ 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;
__add_idle_checker(cpc->cur_event, g_list_next(list));
@@ -1151,7 +1152,7 @@ static gboolean __handle_idle_checker(gpointer data)
cpc->cpu_idle_time = idle;
cpc->cpu_total_time = total;
- __update_threshold(0.05f);
+ __update_threshold(cpc, 0.05f);
return G_SOURCE_CONTINUE;
}
@@ -1508,6 +1509,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id,
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) {