[PassScenario]
# set to "yes" scenario_support (Default value is no)
# set scenario_num to be tested
-# set scenario_max_timeout_ms (unit:millisecond, default timeout is 3000ms)
scenario_support=yes
scenario_num=2
-scenario_max_timeout_ms=3000
# describe the scenario section as follows
#[Scenario0]
#name=AppLaunch # (dbus method name)
+#max_duration_ms=3000 # (unit:millisecond, max dururation is 3000ms)
#support=yes
[Scenario0]
name=AppLaunch
+max_duration_ms=3000
support=yes
[Scenario1]
name=UltraPowerSaving
+max_duration_ms=3000
support=yes
scenarios->num = num;
}
- } else if (MATCH(result->name, "scenario_max_timeout_ms")) {
- int max_timeout_ms;
-
- max_timeout_ms = sys_strtol(result->value);
- if (max_timeout_ms < 0) {
- _E("failed to get maximum timeout of scenario");
- return -ERANGE;
- }
- scenarios->max_timeout_ms = max_timeout_ms;
}
}
"%s", result->value);
else if (MATCH(result->name, "support"))
scenarios->list[index].support = is_supported(result->value);
+ else if (MATCH(result->name, "max_duration_ms")) {
+ int max_duration_ms = sys_strtol(result->value);
+
+ if (max_duration_ms < 0) {
+ _E("failed to parse max_duration_ms property (%d)\n",
+ max_duration_ms);
+ return -EINVAL;
+ }
+
+ /*
+ * If maximum duration is zero, it measn that this scenario is
+ * mode without any maximum duration.
+ */
+ scenarios->list[index].max_duration_ms = max_duration_ms;
+ }
return 0;
}
if (scenarios->num > 0 && scenarios->list) {
scenarios->num = 0;
- scenarios->max_timeout_ms = 0;
free(scenarios->list);
scenarios->list = NULL;
}
/* Initialize the variables before parsing the pass-pmqos.conf */
scenarios->num = 0;
- scenarios->max_timeout_ms = 0;
/* get configuration file */
ret = config_parse(path, pmqos_load_config, scenarios);
#include "pmqos.h"
-#define DEFAULT_PMQOS_TIMER 3000
-
#define PMQOS_CONF_PATH "/etc/pass/pass-pmqos.conf"
#define MILLISECONDS(tv) ((tv.tv_sec)*1000 + (tv.tv_nsec)/1000000)
#define DELTA(a, b) (MILLISECONDS(a) - MILLISECONDS(b))
static GList *pmqos_head;
guint g_unlock_timeout_id;
-static int unlock_max_timeout_ms;
static struct timespec unlock_timer_start_st;
static struct timespec unlock_timer_end_st;
static struct pmqos_cpu unlock_timer_owner = {"", 0};
const char *name_from;
char *name;
bool support;
+ int max_duration_ms;
int i, ret = 0;
gboolean ret_out = TRUE;
_E("PASS PMQoS is stopped\n");
ret_out = FALSE;
goto out;
- } else {
- name_from = g_dbus_method_invocation_get_method_name(invoc);
- ret = -ENOTSUP;
- if (g_pmqos) {
- for (i = 0; i < g_pmqos->num; i++) {
- name = g_pmqos->list[i].name;
- support = g_pmqos->list[i].support;
- if (!strcmp(name, name_from) && support) {
- ret = 0;
- break;
- }
+ }
+
+ name_from = g_dbus_method_invocation_get_method_name(invoc);
+ ret = -ENOTSUP;
+ if (g_pmqos) {
+ for (i = 0; i < g_pmqos->num; i++) {
+ name = g_pmqos->list[i].name;
+ support = g_pmqos->list[i].support;
+ max_duration_ms = g_pmqos->list[i].max_duration_ms;
+
+ if (!strcmp(name, name_from) && support) {
+ ret = 0;
+ if (duration > max_duration_ms)
+ duration = max_duration_ms;
+ break;
}
}
+ }
- if (ret < 0) {
- _E("cannot set the PMQoS scenario: "
- "%s is not supported\n", name_from);
- ret_out = FALSE;
- goto out_dbus;
- }
+ if (ret < 0) {
+ _E("cannot set the PMQoS scenario: "
+ "%s is not supported\n", name_from);
+ ret_out = FALSE;
+ goto out_dbus;
}
if (duration)
int found = 0;
int ret;
- /* Check valid parameter */
- if (val > unlock_max_timeout_ms) {
- _I("Timeout cannot be higher than maximum timeout (%d ms)",
- unlock_max_timeout_ms);
- val = unlock_max_timeout_ms;
- }
-
/* find cpu */
for (elem = pmqos_head; elem != NULL; elem = elem->next) {
cpu = elem->data;
g_pmqos->list[i].name);
}
- /*
- * Set maximum timeout for the scenario by using the parsed data from
- * pass-pmqos.conf. But, if there is no setting from pass-pmqos.conf
- * pmqos uses the default timeout value (3000 millisecond).
- */
- if (g_pmqos->max_timeout_ms)
- unlock_max_timeout_ms = g_pmqos->max_timeout_ms;
- else
- unlock_max_timeout_ms = DEFAULT_PMQOS_TIMER;
-
return 0;
}