common: remove unused codes 45/82645/2
authortaeyoung <ty317.kim@samsung.com>
Fri, 5 Aug 2016 00:35:14 +0000 (09:35 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Mon, 8 Aug 2016 07:25:15 +0000 (00:25 -0700)
- cpu related apis exists in capi-system-runtime-info.
  capi-system-device does not support them anymore.

Change-Id: Ied7e6b9f41857c305cd7e17cd3683518d3f2918b
Signed-off-by: taeyoung <ty317.kim@samsung.com>
include/device.h
src/cpu.c [deleted file]

index e2f0532..59805a7 100755 (executable)
@@ -538,59 +538,6 @@ int device_memory_get_total(unsigned int *total_mem);
 int device_memory_get_available(unsigned int *avail_mem);
 
 /**
- * @brief Get time information the CPU has spent performing work.
- *
- * @remarks
- * Time units are in USER_HZ (typically hundredths of a second).
- *
- * @param[out] time structure of time information the CPU has spent
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #DEVICE_ERROR_NONE                          Successful
- * @retval #DEVICE_ERROR_INVALID_PARAMETER     Invalid parameter
- * @retval #DEVICE_ERROR_OPERATION_FAILED      Operation failed
- */
-int device_cpu_get_system_time(device_system_time_s *time);
-
-/**
- * @brief Get all of CPU count
- *
- * @param[out] cpu_cnt total count of CPU
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #DEVICE_ERROR_NONE                          Successful
- * @retval #DEVICE_ERROR_INVALID_PARAMETER     Invalid parameter
- * @retval #DEVICE_ERROR_OPERATION_FAILED      Operation failed
- */
-int device_cpu_get_count(int *cpu_cnt);
-
-/**
- * @brief Get currently frequency of CPU
- *
- * @param[in]  cpu the index of CPU which want to know
- * @param[out] cur_freq currently frequency value of CPU
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #DEVICE_ERROR_NONE                          Successful
- * @retval #DEVICE_ERROR_INVALID_PARAMETER     Invalid parameter
- * @retval #DEVICE_ERROR_OPERATION_FAILED      Operation failed
- */
-int device_cpu_get_current_freq(int cpu, unsigned int *cur_freq);
-
-/**
- * @brief Get max frequency of CPU
- *
- * @param[in]  cpu the index of CPU which want to know
- * @param[out] max_freq max frequency value of CPU
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #DEVICE_ERROR_NONE                          Successful
- * @retval #DEVICE_ERROR_INVALID_PARAMETER     Invalid parameter
- * @retval #DEVICE_ERROR_OPERATION_FAILED      Operation failed
- */
-int device_cpu_get_max_freq(int cpu, unsigned int *max_freq);
-
-/**
  * @}
  */
 
diff --git a/src/cpu.c b/src/cpu.c
deleted file mode 100644 (file)
index c4444e6..0000000
--- a/src/cpu.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * capi-system-device
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "device.h"
-#include "common.h"
-
-#define PROC_STAT              "/proc/stat"
-
-#define PROC_CPU_PRESENT                               "/sys/devices/system/cpu/present"
-#define PROC_SCALING_CUR_FREQ                  "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq"
-#define PROC_SCALING_MAX_FREQ                  "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq"
-
-//LCOV_EXCL_START Not used function
-int device_cpu_get_count(int *cpu_cnt)
-{
-       FILE *fp;
-       int ret;
-       int st, ed;
-
-       if (cpu_cnt == NULL)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       fp = fopen(PROC_CPU_PRESENT, "r");
-       if (!fp)
-               return DEVICE_ERROR_OPERATION_FAILED;
-
-       ret = fscanf(fp, "%u-%u", &st, &ed);
-       fclose(fp);
-       if (ret != 2)
-               return DEVICE_ERROR_OPERATION_FAILED;
-
-       *cpu_cnt = ed+1;
-       return DEVICE_ERROR_NONE;
-}
-
-static int _get_systime(device_system_time_s *st)
-{
-       FILE *fp;
-       char buf[4096];
-       char *s;
-
-       assert(st);
-
-       fp = fopen(PROC_STAT, "r");
-       if (!fp)
-               return -1;
-
-       s = fgets(buf, sizeof(buf), fp);
-       fclose(fp);
-       if (!s)
-               return -1;
-
-       s = strchr(buf, ' ');
-       if (!s)
-               return -1;
-
-       s++;
-       st->user = strtoull(s, &s, 10);
-       st->nice = strtoull(s, &s, 10);
-       st->system = strtoull(s, &s, 10);
-       st->idle = strtoull(s, &s, 10);
-       st->iowait = strtoull(s, &s, 10);
-       st->irq = strtoull(s, &s, 10);
-       st->softirq = strtoull(s, &s, 10);
-
-       return 0;
-}
-
-int device_cpu_get_system_time(device_system_time_s *time)
-{
-       int ret;
-       device_system_time_s st;
-
-       if (time == NULL)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       ret = _get_systime(&st);
-       if (ret < 0)
-               return DEVICE_ERROR_OPERATION_FAILED;
-
-       st.total = st.user+st.nice+st.system+st.idle+st.iowait+st.irq+st.softirq;
-       *time = st;
-       return DEVICE_ERROR_NONE;
-}
-
-static int _get_uint(const char *path, unsigned int *val)
-{
-       FILE *fp;
-       unsigned int num;
-       int ret;
-
-       assert(path);
-       assert(val);
-
-       fp = fopen(path, "r");
-       if (!fp)
-               return -1;
-
-       ret = fscanf(fp, "%u", &num);
-       fclose(fp);
-       if (ret != 1)
-               return -1;
-
-       *val = num;
-       return 0;
-}
-
-int device_cpu_get_current_freq(int cpu, unsigned int *cur_freq)
-{
-       char path[FILENAME_MAX];
-       int ret;
-       int count;
-       unsigned int cur;
-
-       if (cur_freq == NULL)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       ret = device_cpu_get_count(&count);
-       if (ret != DEVICE_ERROR_NONE || cpu < 0 || cpu >= count)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       snprintf(path, sizeof(path), PROC_SCALING_CUR_FREQ, cpu);
-       ret = _get_uint(path, &cur);
-       if (ret < 0)
-               cur = 0;
-
-       *cur_freq = cur;
-       return DEVICE_ERROR_NONE;
-}
-
-int device_cpu_get_max_freq(int cpu, unsigned int *max_freq)
-{
-       char path[FILENAME_MAX];
-       int ret;
-       int count;
-       unsigned int max;
-
-       if (max_freq == NULL)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       ret = device_cpu_get_count(&count);
-       if (ret != DEVICE_ERROR_NONE || cpu < 0 || cpu >= count)
-               return DEVICE_ERROR_INVALID_PARAMETER;
-
-       snprintf(path, sizeof(path), PROC_SCALING_MAX_FREQ, cpu);
-       ret = _get_uint(path, &max);
-       if (ret < 0)
-               max = 0;
-
-       *max_freq = max;
-       return DEVICE_ERROR_NONE;
-}
-//LCOV_EXCL_STOP Not used function