2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #define LOADAVG_FILEPATH "/proc/loadavg"
24 int procfs_read_system_load_average(struct procfs_load_average_info *info)
28 FILE *loadavg_fp = fopen(LOADAVG_FILEPATH, "r");
30 ERR("failed to open " LOADAVG_FILEPATH);
34 if (fscanf(loadavg_fp, "%f %f %f", &a1, &a5, &a15) != 3) {
35 ERR("failed to read " LOADAVG_FILEPATH);
40 info->one_min_avg = a1;
41 info->five_min_avg = a5;
42 info->fifteen_min_avg = a15;
49 int profcs_read_system_cpu_usage(struct procfs_system_cpu_usage_info *usage)
54 int profcs_read_system_percpu_usage(struct procfs_system_percpu_usage_info **usage)
59 int procfs_read_system_memory_usage(struct procfs_system_memory_usage_info *usage)
64 int procfs_read_process_memory_usage(int pid, struct procfs_process_memory_usage_info *usage)
69 int procfs_read_process_cpu_usage(int pid, struct procfs_process_cpu_usage_info *usage)
74 int procfs_read_uptime(int *uptime)
79 int procfs_read_cpu_count(int *cpu_count)