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.
21 * @brief The process structure.
23 * @note Do not read fields directly, the struct
24 * is only available publicly to allow easy copy semantic
31 unsigned long long total_ticks_used;
32 unsigned long long frame_ticks_used;
35 float frame_time_inverted;
39 * @brief Initialize process module.
44 * @brief Gets last read process memory usage
46 * @param[in]: proc process
47 * @param[out]: used the memory usage in KiB
49 * @return 0 on success, other value on error.
51 int process_get_memory_usage(struct process *proc, int *used);
54 * @brief Gets last read process CPU usage
56 * @param[in]: proc process
57 * @param[out]: usage CPU usage in clock ticks
59 * @return 0 on success, other value on error.
61 int process_get_cpu_usage(struct process *proc, unsigned long long *usage);
64 * @brief Updates process memory & CPU usage data.
66 * @param[in]: proc process
68 * @return 0 on success, other value on error.
70 int process_update(struct process *proc);
73 * @brief Initializes process structure
76 * @param[in]: proc process
78 * @return 0 on success, other value on error.
80 void process_init_process(int pid, struct process *proc);
83 * @brief Shutdown process structure
85 * @param[in]: proc process
87 * @return 0 on success, other value on error.
89 * @note the structure should be initialized with @process_init, @process_move
91 void process_shutdown(struct process *proc);
94 * @brief Get process pid
96 * @param[in]: proc process
100 int process_get_pid(const struct process *proc);
103 * @brief Get process application id.
105 * @param[in]: proc process
107 * @return: appid or NULL if process is not an Tizen Application.
109 const char *process_get_appid(struct process *proc);
112 * @brief Pathname of executed command.
114 * @param[in]: proc process
116 * @return: exe file path or NULL in case of error.
118 const char *process_get_exe(struct process *proc);
121 * @brief Moves process data from one struct to another.
123 * @param[in]: dst destination process
124 * @param[in]: src source process
126 void process_move(struct process *dst, struct process *src);
129 * @brief Gets average CPU usage percentage since last update.
131 * @param[in]: proc process
132 * @param[out]: usage the cpu usage percentage
134 * @return 0 on success, other value on error.
136 int process_get_cpu_usage_percentage(struct process *proc, float *usage);
139 * @brief Gets average memory usage percentage on last update.
141 * @param[in]: proc process
142 * @param[out]: usage the memory usage percentage
144 * @return 0 on success, other value on error.
146 int process_get_memory_usage_percentage(struct process *dst, float *usage);