)
ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie")
+TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
PROPERTIES SKIP_BUILD_RPATH TRUE
#include <linux/limits.h>
#include <ttrace.h>
#include <vconf.h>
+#include <math.h>
#include "perf.h"
#include "launchpad_common.h"
#define PAD_ERR_INVALID_ARGUMENT -3
#define PAD_ERR_INVALID_PATH -4
#define CPU_CHECKER_TIMEOUT 1000
+#define DEFAULT_THRESHOLD 90
+#define MIN_THRESHOLD 40
+#define PI 3.14159265
typedef struct {
int type;
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 G_SOURCE_CONTINUE;
}
+static float __interpolator(float input)
+{
+ float ret;
+ float min = MIN_THRESHOLD / 100.0f;
+ float max = DEFAULT_THRESHOLD / 100.0f;
+
+ if (input > 1.0f)
+ input = 1.0f;
+ if (input < 0.0f)
+ input = 0.0f;
+
+ ret = cos(input * PI) / 2.0f + 0.5f;
+ ret *= max - min;
+ ret += min;
+
+ return ret;
+}
+
+static void __update_threshold(float delta)
+{
+ static float pos = 0.0f;
+
+ pos += delta;
+ if (pos < 0.0f)
+ 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);
+}
+
static gboolean __handle_idle_checker(gpointer data)
{
unsigned long long total = 0;
total++;
per = (idle - cpc->cpu_idle_time) * 100 / (total - cpc->cpu_total_time);
- _D("CPU Idle : %d %d", per, cpc->type);
+ _D("[CPU] Idle : %d / type : %d", per, cpc->type);
- if (per >= 90) {
+ if (per >= __threshold) {
+ __update_threshold(-0.02f * (per - __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);
+
return G_SOURCE_CONTINUE;
}