Change-Id: If5ff51abedefb5fa218babbd2bbb125cdf153352
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
return RUNTIME_INFO_ERROR_NONE;
}
return RUNTIME_INFO_ERROR_NONE;
}
+//LCOV_EXCL_START : Not called callback
void runtime_info_updated(runtime_info_key_e key)
{
runtime_info_item_h runtime_info_item;
void runtime_info_updated(runtime_info_key_e key)
{
runtime_info_item_h runtime_info_item;
runtime_info_item->event_subscription->changed_cb(key, runtime_info_item->event_subscription->user_data);
}
}
runtime_info_item->event_subscription->changed_cb(key, runtime_info_item->event_subscription->user_data);
}
}
snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_%s_freq",
core_idx, type);
cpufreq_fp = fopen(path, "r");
snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_%s_freq",
core_idx, type);
cpufreq_fp = fopen(path, "r");
+
+ //LCOV_EXCL_START : fallback routine
if (cpufreq_fp == NULL) {
if (core_idx > 0) {
_I("Fail to get the information about core%d. Get the core0's instead",
if (cpufreq_fp == NULL) {
if (core_idx > 0) {
_I("Fail to get the information about core%d. Get the core0's instead",
return RUNTIME_INFO_ERROR_IO_ERROR;
}
}
return RUNTIME_INFO_ERROR_IO_ERROR;
}
}
if (!fscanf(cpufreq_fp, "%d", &result)) {
if (!fscanf(cpufreq_fp, "%d", &result)) {
+ //LCOV_EXCL_START : system error
_E("IO_ERROR(0x%08x) : there is no information in the cpuinfo file",
RUNTIME_INFO_ERROR_IO_ERROR);
fclose(cpufreq_fp);
return RUNTIME_INFO_ERROR_IO_ERROR;
_E("IO_ERROR(0x%08x) : there is no information in the cpuinfo file",
RUNTIME_INFO_ERROR_IO_ERROR);
fclose(cpufreq_fp);
return RUNTIME_INFO_ERROR_IO_ERROR;
}
*cpu_freq = result / 1000;
}
*cpu_freq = result / 1000;
return RUNTIME_INFO_ERROR_NONE;
}
return RUNTIME_INFO_ERROR_NONE;
}
+//LCOV_EXCL_START : fallback routine
int runtime_info_get_frequency_cpuinfo(int core_idx, int *cpu_freq)
{
FILE *cpuinfo_fp;
int runtime_info_get_frequency_cpuinfo(int core_idx, int *cpu_freq)
{
FILE *cpuinfo_fp;
fclose(cpuinfo_fp);
return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
}
fclose(cpuinfo_fp);
return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
}
#define kBtoKiB(val) (int)(((long long)val * 1024)/1000)
#define kBtoKiB(val) (int)(((long long)val * 1024)/1000)
+//LCOV_EXCL_START : system error
static int runtime_info_get_dbus_error(const char *err_name)
{
int size;
static int runtime_info_get_dbus_error(const char *err_name)
{
int size;
else
return RUNTIME_INFO_ERROR_REMOTE_IO;
}
else
return RUNTIME_INFO_ERROR_REMOTE_IO;
}
/* Handler function which handles dbus related instructions
* for both per process memory and cpu requests.
/* Handler function which handles dbus related instructions
* for both per process memory and cpu requests.
int ret;
if (!pid || !error) {
int ret;
if (!pid || !error) {
+ //LCOV_EXCL_START : system error
_E("INVALID_PARAMETER(0x%08x): pid list and error params cannot be null");
if (error)
*error = RUNTIME_INFO_ERROR_INVALID_PARAMETER;
return NULL;
_E("INVALID_PARAMETER(0x%08x): pid list and error params cannot be null");
if (error)
*error = RUNTIME_INFO_ERROR_INVALID_PARAMETER;
return NULL;
}
conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!conn) {
}
conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!conn) {
+ //LCOV_EXCL_START : system error
_E("DBUS_CONNECTION_ERROR");
*error = RUNTIME_INFO_ERROR_REMOTE_IO;
return NULL;
_E("DBUS_CONNECTION_ERROR");
*error = RUNTIME_INFO_ERROR_REMOTE_IO;
return NULL;
}
if (info == MEMORY_USAGE) {
}
if (info == MEMORY_USAGE) {
ret = dbus_message_append_args(msg, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &pid,
size, DBUS_TYPE_INVALID);
if (!ret) {
ret = dbus_message_append_args(msg, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &pid,
size, DBUS_TYPE_INVALID);
if (!ret) {
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: not able to append pid array to message");
*error = RUNTIME_INFO_ERROR_IO_ERROR;
dbus_message_unref(msg);
return NULL;
_E("DBUS_METHOD_CALL: not able to append pid array to message");
*error = RUNTIME_INFO_ERROR_IO_ERROR;
dbus_message_unref(msg);
return NULL;
reply = dbus_connection_send_with_reply_and_block(conn, msg,
DBUS_REPLY_TIMEOUT, &err);
if (!reply)
reply = dbus_connection_send_with_reply_and_block(conn, msg,
DBUS_REPLY_TIMEOUT, &err);
if (!reply)
- _E("DBUS_METHOD_CALL: not able to send message");
+ _E("DBUS_METHOD_CALL: not able to send message"); //LCOV_EXCL_LINE : system error
if (dbus_error_is_set(&err)) {
if (dbus_error_is_set(&err)) {
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: dbus_connection_send error(%s:%s)", err.name, err.message);
*error = runtime_info_get_dbus_error(err.name);
dbus_error_free(&err);
reply = NULL;
_E("DBUS_METHOD_CALL: dbus_connection_send error(%s:%s)", err.name, err.message);
*error = runtime_info_get_dbus_error(err.name);
dbus_error_free(&err);
reply = NULL;
}
dbus_message_unref(msg);
}
dbus_message_unref(msg);
/* Get the needed information from resourced daemon using dbus */
replymsg = runtime_info_dbus_process_usage_info(pid, size, MEMORY_USAGE, &error);
if (!replymsg) {
/* Get the needed information from resourced daemon using dbus */
replymsg = runtime_info_dbus_process_usage_info(pid, size, MEMORY_USAGE, &error);
if (!replymsg) {
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: call to resourced not successful");
return error;
_E("DBUS_METHOD_CALL: call to resourced not successful");
return error;
}
/* Check if the message is an error message or not in expected
* format and return error value */
dbus_message_iter_init(replymsg, &iter);
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32) {
}
/* Check if the message is an error message or not in expected
* format and return error value */
dbus_message_iter_init(replymsg, &iter);
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32) {
+ //LCOV_EXCL_START : system error
dbus_message_iter_get_basic(&iter, &error);
_E("DBUS_METHOD_CALL: call to resourced returned error message");
dbus_message_unref(replymsg);
return error;
dbus_message_iter_get_basic(&iter, &error);
_E("DBUS_METHOD_CALL: call to resourced returned error message");
dbus_message_unref(replymsg);
return error;
} else if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
} else if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: received dbus message is not in expected format");
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_REMOTE_IO;
_E("DBUS_METHOD_CALL: received dbus message is not in expected format");
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_REMOTE_IO;
}
/* Populate the entries of info array using the data received from resourced */
}
/* Populate the entries of info array using the data received from resourced */
/* Get the needed information from resourced daemon using dbus */
replymsg = runtime_info_dbus_process_usage_info(pid, size, CPU_USAGE, &error);
/* Get the needed information from resourced daemon using dbus */
replymsg = runtime_info_dbus_process_usage_info(pid, size, CPU_USAGE, &error);
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: call to resourced not successful");
return error;
_E("DBUS_METHOD_CALL: call to resourced not successful");
return error;
}
/* Check if the message is an error message or not in expected format
* and return error value */
dbus_message_iter_init(replymsg, &iter);
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32) {
}
/* Check if the message is an error message or not in expected format
* and return error value */
dbus_message_iter_init(replymsg, &iter);
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32) {
+ //LCOV_EXCL_START : system error
dbus_message_iter_get_basic(&iter, &error);
_E("DBUS_METHOD_CALL: call to resourced returned error message");
dbus_message_unref(replymsg);
return error;
dbus_message_iter_get_basic(&iter, &error);
_E("DBUS_METHOD_CALL: call to resourced returned error message");
dbus_message_unref(replymsg);
return error;
} else if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
} else if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
+ //LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: received dbus message is not in expected format");
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_REMOTE_IO;
_E("DBUS_METHOD_CALL: received dbus message is not in expected format");
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_REMOTE_IO;
}
/* Populate the entries of info array using the data received from resourced */
*usage = (process_cpu_usage_s *)malloc(size * sizeof(process_cpu_usage_s));
if (!(*usage)) {
}
/* Populate the entries of info array using the data received from resourced */
*usage = (process_cpu_usage_s *)malloc(size * sizeof(process_cpu_usage_s));
if (!(*usage)) {
+ //LCOV_EXCL_START : system error
_E("OUT_OF_MEMORY(0x%08x)", RUNTIME_INFO_ERROR_OUT_OF_MEMORY);
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_OUT_OF_MEMORY;
_E("OUT_OF_MEMORY(0x%08x)", RUNTIME_INFO_ERROR_OUT_OF_MEMORY);
dbus_message_unref(replymsg);
return RUNTIME_INFO_ERROR_OUT_OF_MEMORY;
}
dbus_message_iter_recurse(&iter, &iter_array);
}
dbus_message_iter_recurse(&iter, &iter_array);
cpuinfo_fp = fopen("/sys/devices/system/cpu/possible", "r");
if (cpuinfo_fp == NULL) {
cpuinfo_fp = fopen("/sys/devices/system/cpu/possible", "r");
if (cpuinfo_fp == NULL) {
+ //LCOV_EXCL_START : system error
_E("IO_ERROR(0x%08x) : failed to open file to read cpu information",
RUNTIME_INFO_ERROR_IO_ERROR);
return RUNTIME_INFO_ERROR_IO_ERROR;
_E("IO_ERROR(0x%08x) : failed to open file to read cpu information",
RUNTIME_INFO_ERROR_IO_ERROR);
return RUNTIME_INFO_ERROR_IO_ERROR;
}
if (!fscanf(cpuinfo_fp, "%d-%d", &buf, &result)) {
}
if (!fscanf(cpuinfo_fp, "%d-%d", &buf, &result)) {
+ //LCOV_EXCL_START : system error
_E("IO_ERROR(0x%08x) : there is no information in the system file",
RUNTIME_INFO_ERROR_IO_ERROR);
fclose(cpuinfo_fp);
return RUNTIME_INFO_ERROR_IO_ERROR;
_E("IO_ERROR(0x%08x) : there is no information in the system file",
RUNTIME_INFO_ERROR_IO_ERROR);
fclose(cpuinfo_fp);
return RUNTIME_INFO_ERROR_IO_ERROR;
}
*num_core = result + 1;
}
*num_core = result + 1;
if (runtime_info_get_frequency_cpufreq(core_idx, "cur", cpu_freq)
!= RUNTIME_INFO_ERROR_NONE) {
if (runtime_info_get_frequency_cpufreq(core_idx, "cur", cpu_freq)
!= RUNTIME_INFO_ERROR_NONE) {
+ //LCOV_EXCL_START : system error
_I("This system doesn't support cpufreq. Use cpuinfo instead.");
switch (runtime_info_get_frequency_cpuinfo(core_idx, cpu_freq)) {
_I("This system doesn't support cpufreq. Use cpuinfo instead.");
switch (runtime_info_get_frequency_cpuinfo(core_idx, cpu_freq)) {
_E("Fail to get current CPU frequency");
return RUNTIME_INFO_ERROR_IO_ERROR;
};
_E("Fail to get current CPU frequency");
return RUNTIME_INFO_ERROR_IO_ERROR;
};
}
return RUNTIME_INFO_ERROR_NONE;
}
return RUNTIME_INFO_ERROR_NONE;
if (runtime_info_get_frequency_cpufreq(core_idx, "max", cpu_freq)
!= RUNTIME_INFO_ERROR_NONE) {
if (runtime_info_get_frequency_cpufreq(core_idx, "max", cpu_freq)
!= RUNTIME_INFO_ERROR_NONE) {
+ //LCOV_EXCL_START : system error
_I("This system doesn't support cpufreq. Use cpuinfo instead.");
switch (runtime_info_get_frequency_cpuinfo(core_idx, cpu_freq)) {
_I("This system doesn't support cpufreq. Use cpuinfo instead.");
switch (runtime_info_get_frequency_cpuinfo(core_idx, cpu_freq)) {
_E("Fail to get current CPU frequency");
return RUNTIME_INFO_ERROR_IO_ERROR;
};
_E("Fail to get current CPU frequency");
return RUNTIME_INFO_ERROR_IO_ERROR;
};
}
return RUNTIME_INFO_ERROR_NONE;
}
return RUNTIME_INFO_ERROR_NONE;
+//LCOV_EXCL_START : not used function
int runtime_info_vconf_get_value_double(const char *vconf_key, double *value)
{
int ret = vconf_get_dbl(vconf_key, value);
int runtime_info_vconf_get_value_double(const char *vconf_key, double *value)
{
int ret = vconf_get_dbl(vconf_key, value);
*value = str_value;
return RUNTIME_INFO_ERROR_NONE;
}
*value = str_value;
return RUNTIME_INFO_ERROR_NONE;
}
+//LCOV_EXCL_START : not called callback
typedef void (*runtime_info_vconf_event_cb)(keynode_t *node, void *event_data);
static void runtime_info_vconf_event_cb0(keynode_t *node, void *event_data)
typedef void (*runtime_info_vconf_event_cb)(keynode_t *node, void *event_data);
static void runtime_info_vconf_event_cb0(keynode_t *node, void *event_data)
int runtime_info_vconf_set_event_cb(const char *vconf_key, runtime_info_key_e runtime_info_key, int slot)
{
int runtime_info_vconf_set_event_cb(const char *vconf_key, runtime_info_key_e runtime_info_key, int slot)
{