platform/core/system/pass.git
2 years agolib: resource-monitor: Add missing request for the readability 28/279428/4
Chanwoo Choi [Mon, 8 Aug 2022 19:41:13 +0000 (04:41 +0900)]
lib: resource-monitor: Add missing request for the readability

Add missing request for the readability to switch statement
to improve the readability when handling the request.

Change-Id: I1b322bd30d4db913fd438394089e95b4716133a6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Add pass_resource_monitor_is_resource_attr_set 27/279427/4
Chanwoo Choi [Wed, 20 Jul 2022 08:53:37 +0000 (17:53 +0900)]
lib: resource-monitor: Add pass_resource_monitor_is_resource_attr_set

Provide pass_resource_monitor_is_resource_attr_set function
to check whether some attributes are set or not.

And fix the comment of pass_resource_monitor_is_resource_attr_supported.

Change-Id: I3b1372ecc1138d2244da66e79745ca6454ff67eb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add resource flag to express the specific features 26/279426/4
Chanwoo Choi [Mon, 8 Aug 2022 18:46:42 +0000 (03:46 +0900)]
util: resource: Add resource flag to express the specific features

Each resource are able to have the non-common features.
The resource flag will be used to indicate the characteristics
of resource.

- RESOURCE_FLAG_COUNT_ONLY_ONE
  : Some resource's resource count is only one on all board such as system and
  memory resources. Add this flag when want to return 1 as resource count.
- RESOURCE_FLAG_PROCESS
  : process and process-group are not physical resource like CPU/GPU/Memory.
  Sometimes, it should be handled by the different handling. In order to
  separate out them, use this flag.

Change-Id: Ic7df2cae2105b14382c0f084c30fbbcde5efdac4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Change prototype of pass_resource_monitor_get_resource_count 47/279547/1
Chanwoo Choi [Fri, 5 Aug 2022 17:31:24 +0000 (02:31 +0900)]
lib: resource-monitor: Change prototype of pass_resource_monitor_get_resource_count

Almost get_value functions get the value by using l-value parameter.
In order to keep the consistent function prototype stule,
change the prototype of pass_resource_monitor_get_resource_count function
as following:

- before: int pass_resource_monitor_get_resource_count(int id, int resource_type);
- after : int pass_resource_monitor_get_resource_count(int id, int resource_type, int *resource_count);

Change-Id: Ic18f45a1ee4bbd4f9320751541cf00b3f4d9f5c8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: display: Add a display monitor thread to deal with multiple clients 18/279418/9
Sung-hun Kim [Tue, 9 Aug 2022 05:45:55 +0000 (14:45 +0900)]
resource: display: Add a display monitor thread to deal with multiple clients

When multiple clients request to get fps concurrently,
unacceptable delays (upto tens of seconds for hundred
clients) are incurred. I guess that the dbus function
g_dbus_connection_send_message_with_reply_sync() cannot
deal with multiple concurrent calls.

This patch added a monitor thread to read current fps
value via dbus. The thread shares read fps value to
clients. By doing so, multiple clients can get the fps
value without delays.

Change-Id: I726092658ef79af3610baa6fa356d8a54c6cf299
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoutil: thread: Use wait_for_completion without result
Sung-hun Kim [Tue, 9 Aug 2022 02:01:48 +0000 (11:01 +0900)]
util: thread: Use wait_for_completion without result

Change-Id: I3969491c2ce9d8ecccfdb064bc65274cb05cb53f
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoresource: Change bytes unit attributes to kilo-bytes
Dongwoo Lee [Tue, 9 Aug 2022 01:53:47 +0000 (18:53 -0700)]
resource: Change bytes unit attributes to kilo-bytes

In order to sync up with attributes of disk resource, the remaining
memory- and disk-related attributes are changed to use kilo-bytes unit
from now on. As following the unit changes, the name of attributes are
either changed as belows:
 - PROCESS_ATTR_DISK_READ_BPS -> PROCESS_ATTR_DISK_READ_PER_SEC
 - PROCESS_ATTR_DISK_WRITE_BPS -> PROCESS_ATTR_DISK_WRITE_PER_SEC
 - PROCESS_GROUP_ATTR_DISK_READ_BPS -> PROCESS_GROUP_ATTR_DISK_READ_PER_SEC
 - PROCESS_GROUP_ATTR_DISK_WRITE_BPS -> PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC

Change-Id: I2c09a6f4ef9511c2add3a559efa19f94d0253216
Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
2 years agolib: resource-monitor: Extract common function for readability and remove duplicate... submit/tizen/20220809.025855
Chanwoo Choi [Wed, 20 Jul 2022 08:52:13 +0000 (17:52 +0900)]
lib: resource-monitor: Extract common function for readability and remove duplicate code

Almost resource-monitor functions are composed with the following steps
to communicate with resource-monitor daemon. It means that there are
the many similiar code to support resource-monitor feature.
1. send request
2. recv response
3. parse data from response
4. validate the data

In order to reduece the duplicate code and improve the readability,
extract the common functions as handle_request with struct request_data.

Change-Id: I413e3dd157093507d099892b0d3123bcf0641f4b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Fix wrong data type of pass_resource_monitor_get_value_uint
Chanwoo Choi [Sun, 7 Aug 2022 20:05:12 +0000 (05:05 +0900)]
lib: resource-monitor: Fix wrong data type of pass_resource_monitor_get_value_uint

uint need to use '%u' instead of '%d'. Fix wrong data type format.

Change-Id: Ibec1b362cca3b1ad649ee1aedbf08368f1b1db24
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Fix pass_resource_monitor_get_resource_timestamp issue 48/279348/2
Chanwoo Choi [Sun, 7 Aug 2022 20:02:54 +0000 (05:02 +0900)]
lib: resource-monitor: Fix pass_resource_monitor_get_resource_timestamp issue

Change-Id: I6730f5451b335dd8a4759d528989d846bcf686e0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Fix get_value_string issue by allocating string buffer 95/279295/2
Chanwoo Choi [Tue, 2 Aug 2022 06:06:12 +0000 (15:06 +0900)]
lib: resource-monitor: Fix get_value_string issue by allocating string buffer

The resource-monitor has the following policy of getting sting value
1. resource-monitor allocate the meory for string value
2. user of resource-monitor have to free the allocated memory

But, pass_resource_monitor_get_value_string didn't allocate
the memory for string value until now. Allocate memory for getting
string value on pass_resource_monitor_get_value_string.

Change-Id: I1517ab4362d754cb75b54d1887c1d031de14787d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Check whether interest_mask is valid or not 17/278517/4
Chanwoo Choi [Thu, 21 Jul 2022 09:58:45 +0000 (18:58 +0900)]
util: resource: Check whether interest_mask is valid or not

unset_resource_attr_interest function is able to unset
the resource interest state when resource interest were already
interested. If wrong interest_mask is used, should return fail.
So that Check whether interest_mask is valid or not
before unsetting resource attribute interest.

Change-Id: I047a30ab1fa5c0cafd23327a7fbfabc9c3c9b274
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Check validation of resource control id 16/278516/4
Chanwoo Choi [Wed, 20 Jul 2022 03:56:22 +0000 (12:56 +0900)]
util: resource: Check validation of resource control id

When uses the wrong resource control id by client, crash happen
because the invalid array index is used. In order to prevent crash
issue, check the validation of resource control id.

Change-Id: I621757bb17b054dafb246ceac57d3eabf419fc31
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: resource-monitor-tests: Add all resource attributes for testing 15/278515/4
Chanwoo Choi [Wed, 20 Jul 2022 06:22:58 +0000 (15:22 +0900)]
tests: resource-monitor-tests: Add all resource attributes for testing

Add all defined resource and resources attributes for testing
and fix wrong usage of pass_resource_moniotor functions.

- PhysicalResourceMonitorTest's changes as following:
1. Add all resource types and resource attributes for testing
- memory / battery / system / display / disk / network resources and resource attributes
- the missing resource attributes for cpu/bus/gpu resources
2. Fix wrong usage of pass_resource_monitor_set_resource_attr function
3. Call pass_resource_monitor_update function to update resource attribute value

- ProcessResourceMonitorTest's changes as following:
1. Add process and process-group resources and resource attributes

Change-Id: I4820102c3c8f00bd73d751ce720f6162d682343a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotools: Add resource-monitor monitoring tool 76/278876/10 accepted/tizen/unified/20220805.131714 submit/tizen/20220805.024015
Chanwoo Choi [Fri, 25 Feb 2022 10:29:06 +0000 (19:29 +0900)]
tools: Add resource-monitor monitoring tool

The resource-monitor monitors the available all resource attribute
on device and print them.

- Monitoring sequence as following:
1. Get resource count of each resource type
2. Set resource attributes of each resource
3. Update resource attributes to get value
4. Get value from resources
5. Print value of resources

- Usage
resource-monitor -h | -d secs -n max -p pid -g ppid | --pid pid --ppid ppid

- For example on rpi4 board,
$ resource-monitor --pid 1 --ppid 1
-------------------------------------------------------------------------------------------------------------------------------
  :  |             Resource Attribute Name |                 Resource Attribute Value | Unit  | Resource Attribute Description
-------------------------------------------------------------------------------------------------------------------------------
 0: 0|                SYSTEM_ATTR_CPU_UTIL |                                     4.96 | %     | CPU average utilization
 0: 1|           SYSTEM_ATTR_CPU_USER_UTIL |                                     0.65 | %     | CPU average utilization on user
 0: 2|            SYSTEM_ATTR_CPU_SYS_UTIL |                                     4.31 | %     | CPU average utilization on system
 0: 3|            SYSTEM_ATTR_PER_CPU_UTIL |                    1.72 1.71 13.91 1.72  | %     | Per-CPU utilization
 0: 4|       SYSTEM_ATTR_PER_CPU_USER_UTIL |                     0.00 0.00 1.74 0.00  | %     | Per-CPU utilization on user
 0: 5|        SYSTEM_ATTR_PER_CPU_SYS_UTIL |                    1.72 1.71 12.17 1.72  | %     | Per-CPU utilization on system
 0: 6|            SYSTEM_ATTR_POSSIBLE_CPU |                                        4 | ea    | Number of possible CPU
 0: 7|              SYSTEM_ATTR_ONLINE_CPU |                                        4 | ea    | Number of online CPU

 1: 0|                   MEMORY_ATTR_TOTAL |                               3974103040 | byte  | Memory total size
 1: 1|               MEMORY_ATTR_AVAILABLE |                               3560730624 | byte  | Memory available size
 1: 2|                    MEMORY_ATTR_FREE |                               3405287424 | byte  | Memory free size
 1: 3|                  MEMORY_ATTR_BUFFER |                                 20500480 | byte  | Memorry buffer size
 1: 4|                  MEMORY_ATTR_CACHED |                                220078080 | byte  | Memory cached size
 1: 5|               MEMORY_ATTR_CMA_TOTAL |                                419430400 | byte  | CMA memory total size
 1: 6|                MEMORY_ATTR_CMA_FREE |                                381743104 | byte  | CMA memory free size
 1: 7|              MEMORY_ATTR_SWAP_TOTAL |                               1589637120 | byte  | Swap memory total size
 1: 8|               MEMORY_ATTR_SWAP_FREE |                               1495789568 | byte  | Swap memory free size

 2: 0|                   DISPLAY_ATTR_NAME |                                    hdmi0 |       | Display device name
 2: 1|                    DISPLAY_ATTR_FPS |                                     0.00 | fps   | Frame per second (fps)

 3: 0|                       CPU_ATTR_NAME |                                     cpu0 |       | CPU cluster name
 3: 1|                   CPU_ATTR_CUR_FREQ |                                   600000 | kHz   | Current CPU frequency
 3: 2|                   CPU_ATTR_MIN_FREQ |                                   600000 | kHz   | Current CPU minimum frequency
 3: 3|                   CPU_ATTR_MAX_FREQ |                                  1500000 | kHz   | Current CPU maximum frequency
 3: 4|         CPU_ATTR_AVAILABLE_MIN_FREQ |                                   600000 | kHz   | Available CPU minimum frequency
 3: 5|         CPU_ATTR_AVAILABLE_MAX_FREQ |                                  1500000 | kHz   | Available CPU maximum frequency
 3: 6|               CPU_ATTR_CUR_GOVERNOR |                                schedutil |       | Current CPU frequency governor name

 4: 0|                      DISK_ATTR_NAME |                                    zram0 |       | Disk device name
 4: 1|              DISK_ATTR_READ_PER_SEC |                                     0.00 | kB/s  | Disk read per second
 4: 2|             DISK_ATTR_WRITE_PER_SEC |                                     0.00 | kB/s  | Disk write per second
 4: 3|                DISK_ATTR_READ_TOTAL |                                    46496 | kB    | Disk read total size
 4: 4|               DISK_ATTR_WRITE_TOTAL |                                   230640 | kB    | Disk write total size

 5: 0|                      DISK_ATTR_NAME |                                  mmcblk0 |       | Disk device name
 5: 1|              DISK_ATTR_READ_PER_SEC |                                     0.00 | kB/s  | Disk read per second
 5: 2|             DISK_ATTR_WRITE_PER_SEC |                                     0.00 | kB/s  | Disk write per second
 5: 3|                DISK_ATTR_READ_TOTAL |                                  1041514 | kB    | Disk read total size
 5: 4|               DISK_ATTR_WRITE_TOTAL |                                   388458 | kB    | Disk write total size

 6: 0|                   NETWORK_ATTR_NAME |                                     eth0 |       | Network device name

 7: 0|                   PROCESS_ATTR_NAME |                                  systemd |       | Process name
 7: 1|               PROCESS_ATTR_CPU_UTIL |                                     0.00 | %     | Process CPU utilization
 7: 2|               PROCESS_ATTR_MEM_VIRT |                                 15183377 | byte  | Process VIRT memory size
 7: 3|                PROCESS_ATTR_MEM_RSS |                                  6216822 | byte  | Process RSS(Resident Set Size) memory size
 7: 4|        PROCESS_ATTR_MEM_RSS_PERCENT |                                     0.00 | %     | Process RSS(Resident Set Size) memory percent
 7: 5|          PROCESS_ATTR_DISK_READ_BPS |                                        0 | b/s   | Process disk read per second
 7: 6|         PROCESS_ATTR_DISK_WRITE_BPS |                                        0 | b/s   | Process disk write per second
 7: 7|                   PROCESS_ATTR_PGID |                                        1 |       | Process group ID
 7: 8|                   PROCESS_ATTR_PPID |                                        0 |       | Process parent PID(Process ID)
 7: 9|                PROCESS_ATTR_MEM_PSS |                                  3757056 | byte  | Process PSS(Propotional Set Size) memory size
 7:10|               PROCESS_ATTR_MEM_SWAP |                                   311296 | byte  | Process Swap memory size
 7:11|           PROCESS_ATTR_MEM_SWAP_PSS |                                   186368 | byte  | Process Swap PSS(Propotional Set Size) memory size
 7:12|                PROCESS_ATTR_MEM_GPU |                            Not Supported | byte  | Process GPU memory size

 8: 0|         PROCESS_GROUP_ATTR_PID_LIST |                          Not Implemented |       | Process-group PID(Process ID) list
 8: 1|        PROCESS_GROUP_ATTR_NAME_LIST |                          Not Implemented |       | Process-group name list
 8: 2|         PROCESS_GROUP_ATTR_CPU_UTIL |                                     0.23 | %     | Process-group CPU utilization
 8: 3|    PROCESS_GROUP_ATTR_DISK_READ_BPS |                                        0 | b/s   | Process-group disk read per second
 8: 4|   PROCESS_GROUP_ATTR_DISK_WRITE_BPS |                                    31743 | b/s   | Process-group disk write per second
 8: 5|         PROCESS_GROUP_ATTR_MEM_VIRT |                             140541707212 | byte  | Process-group VIRT memory size
 8: 6|          PROCESS_GROUP_ATTR_MEM_RSS |                               1378679318 | byte  | Process-group RSS(Resident Set Size) memory size
 8: 7|          PROCESS_GROUP_ATTR_MEM_PSS |                                188443648 | byte  | Process-group PSS(Propotional Set Size) memory size
 8: 8|         PROCESS_GROUP_ATTR_MEM_SWAP |                                 93335552 | byte  | Process-group Swap memory size
 8: 9|     PROCESS_GROUP_ATTR_MEM_SWAP_PSS |                                 92164096 | byte  | Process-group Swap PSS(Propotional Set Size) memory size
 8:10|          PROCESS_GROUP_ATTR_MEM_GPU |                            Not Supported | byte  | Process-group GPU memory size

Change-Id: I4e227fe451108b51f0a2371ad7104a54e36bb6a8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add disk and network resource driver 92/278692/4 submit/tizen/20220805.011932
Chanwoo Choi [Mon, 25 Jul 2022 03:44:02 +0000 (12:44 +0900)]
resource: Add disk and network resource driver

Add disk and network resource driver to provide monitoring data.

1. Add disk resource driver to provide the disk bandwidth
   and usage with following resource attributes:
- DISK_ATTR_NAME indicates the disk device name
- DISK_ATTR_READ_PER_SEC indicates read bandwidth of specific block like zram0
- DISK_ATTR_WRITE_PER_SEC indicates write bandwidth of specific block like mmcblk0
- DISK_ATTR_READ_TOTAL indicates read kB size of specific block
- DISK_ATTR_WRITE_TOTAL indicates write kB size of specific block

The detailed description[1] of data are from /proc/diskstats and
/sys/class/block/[block name]/stats:
[1] https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats

2. Add skeleton of network resource driver with resource name attribute.
- NETWORK_ATTR_NAME indicates the network device name

Change-Id: Ib440ab628ad1edc5a24378b9c18b80b7c9a8367e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: system: Fix typo 75/278875/3
Chanwoo Choi [Mon, 25 Jul 2022 14:57:51 +0000 (23:57 +0900)]
resource: system: Fix typo

Change-Id: I5c6fce73c5243e7f0a306584f07fcd7b47e03de0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Add attribute to get resource name 91/278691/3 submit/tizen/20220726.004630 submit/tizen/20220802.012548
Chanwoo Choi [Fri, 22 Jul 2022 07:54:33 +0000 (16:54 +0900)]
lib: resource-monitor: Add attribute to get resource name

[Newly added resource attributes]
- CPU_ATTR_NAME gets CPU resource name
- BUS_ATTR_NAME gets BUS resource name
- GPU_ATTR_NAME gets GPU resource name
- DISPLAY_ATTR_NAME gets Display resource name

[Renamed resource attributes]
- PROCESS_ATTR_COMM -> PROCESS_ATTR_NAME
- PROCESS_GROUP_ATTR_COMM_LIST -> PROCESS_GROUP_ATTR_NAME_LIST

Change-Id: I3f343b3aad2345bb4145fa85ed74d6764d9b43a1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: parser: Parse new resource type for display/disk/network 90/278690/2
Chanwoo Choi [Fri, 22 Jul 2022 04:59:21 +0000 (13:59 +0900)]
pass: parser: Parse new resource type for display/disk/network

Parse new resource type for display/disk/network.

Change-Id: Id5c1a110aa22a825e2f0d0bbcff99707032f2bed
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: resource-monitor-tests: Rename the test name to PhysicalResourceMonitorTest accepted/tizen/unified/20220728.044818 submit/tizen/20220727.085152
Chanwoo Choi [Thu, 21 Jul 2022 07:28:38 +0000 (16:28 +0900)]
tests: resource-monitor-tests: Rename the test name to PhysicalResourceMonitorTest

The resource-monitor provides the both physical resources like
CPU/BUS/Display etc and logical resources such as process and
process-group. In order to add the logical resource test,
Rename the previous test name to PhysicalResourceMonitorTest.

Change-Id: I49fc0a38cc73bdc0b3a00d23582a874ff72120e6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Check whether adding cpu e/u/stime for TGID taskstat
Dongwoo Lee [Tue, 26 Jul 2022 05:03:13 +0000 (14:03 +0900)]
util: kernel: Check whether adding cpu e/u/stime for TGID taskstat

There are difference with information on TGID taskstat among kernel
version, because e/u/stime for TGID taskstat is only summarized after
commit in mainline linux 8c733420bdd5 ("taskstats: add e/u/stime for TGID command")
is applied.
So, now check TGID taskstat has zero value for e/u/stime at the
initialization, and, if so, those time is calculated by adding values
in PID taskstats.

Change-Id: I8916e754465102a6643aefb8937e763fc5d1ee7a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Assign an unique resource id when a new resouce is created
Sung-hun Kim [Mon, 25 Jul 2022 05:45:59 +0000 (14:45 +0900)]
util: resource: Assign an unique resource id when a new resouce is created

When PASS-daemon restarted unexpectedly, a pass client which is
survived in spite of PASS-daemon's restart can access resources
by using its own resource id (which is valid for previous PASS
daemon).

To prevent this situation, PASS should assign a unique resource
id for each created resource even if PASS daemon is restarted.
To this end, PASS initializes a global resource id (g_resource_id)
by using the value of gettimeofday(). So, each resource will be
assigned time-reflected resource id, and uniqueness is ensured
unless the number of created resources crosses the time consumed
before restarted.

Change-Id: I0e30addf01a0ee21b1f18aca56010d39d2c90c99
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoutil: resource: Add detailed error log for debugging 80/278380/5 accepted/tizen/unified/20220722.031019 submit/tizen/20220721.102406
Chanwoo Choi [Tue, 19 Jul 2022 08:29:37 +0000 (17:29 +0900)]
util: resource: Add detailed error log for debugging

Change-Id: Id740972f6baf00b3675a414b336f7e62cc9a2b63
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: bus: Replace resource name with 'BUS' instead of 'Memory Bus' 79/278379/5
Chanwoo Choi [Tue, 19 Jul 2022 08:30:05 +0000 (17:30 +0900)]
resource: bus: Replace resource name with 'BUS' instead of 'Memory Bus'

Change-Id: I58cd357e5692149f6ab70b7cd97107ed5a0aa675
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: request-handler: Add debug log to catch the correct fail point 13/278313/8
Chanwoo Choi [Fri, 15 Jul 2022 09:26:01 +0000 (18:26 +0900)]
monitor: request-handler: Add debug log to catch the correct fail point

Add debug log to catch the correct fail point by printing
the correct resource name and resource attribute name.
And add missing error log.

The updated error log as following:
 handle_request_set_resource_ctrl(310) > failed to set resource control, client(10) | res:type(MEMORY)id(21) | ctrl:name((null))id(0)val(0)
 (snip)
 handle_request_get_value_uint64(526) > failed to get uint64 value, client(10) | res:type(MEMORY)id(21) | attr:name(MEMORY_ATTR_TOTAL)id(1)
 handle_request_get_value_uint64(526) > failed to get uint64 value, client(10) | res:type(MEMORY)id(21) | attr:name(MEMORY_ATTR_AVAILABLE)id(2)

Change-Id: I693c74f01f32954f4b828448aa3b8c2626fb2730
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add get_resource_attr_name and get_resource_controL_name function 12/278312/5
Chanwoo Choi [Tue, 19 Jul 2022 03:27:22 +0000 (12:27 +0900)]
util: resource: Add get_resource_attr_name and get_resource_controL_name function

Add get_resource_attr_name and get_resource_controL_name function
to get the attribute name and control name.

Function prototype as following:
- const char *get_resource_attr_name(struct resource *resource, u_int64_t attr_id)
- const char *get_resource_control_name(struct resource *resource, u_int64_t ctrl_id)

Change-Id: Id77a7f07f8129fc14d693b32f35f94e8b4c93f3a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: request-handler: Remove unneeded local variable 49/277449/4 accepted/tizen/unified/20220715.141323 submit/tizen/20220714.022316
Chanwoo Choi [Tue, 5 Jul 2022 11:17:48 +0000 (20:17 +0900)]
monitor: request-handler: Remove unneeded local variable

Change-Id: Iff69aa14a7aa97b4db8efa782dc845ba513f2648
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Discard const keyword of struct resource 48/277448/4
Chanwoo Choi [Mon, 4 Jul 2022 21:51:41 +0000 (06:51 +0900)]
util: resource: Discard const keyword of struct resource

Discard const keyword when accessing struct resource
by hiding the 'struct resource' from use of 'struct resource'.

Except for 'void *priv' field of struct resource,
the fields of struct resource should be accessed by getter/setter
functions.

Change-Id: I80fe2a7c9df8f6a5c273da9f222668a03ba8e62e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Use getter/setter of struct resource for encapsulation 47/277447/4
Chanwoo Choi [Mon, 4 Jul 2022 21:15:56 +0000 (06:15 +0900)]
resource: Use getter/setter of struct resource for encapsulation

Prevent the direct access of the fields of struct resource
by using getter/setter functiosn of struct resource.

By this change, keep the encapsulation of struct resource
and only communicate via getter/setter functions.

Change-Id: I4c7b92b79197ef67688773a5ef6b7db5e044bc09
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Encapsulate struct resource by hiding from user 46/277446/4
Chanwoo Choi [Mon, 4 Jul 2022 21:16:35 +0000 (06:16 +0900)]
util: resource: Encapsulate struct resource by hiding from user

Move 'struct resource' into src/util/resource.c for hiding it
and add missing getter/setter for encapsulation to access
the fiels of 'struct resource'.

Change-Id: Ib20b3de6f5ac68f20c14da82dedef38bbe26d2e8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: resource-monitor: Fix return value of pass_resource_monitor_is_resource_attr_sup... 67/277567/3
Chanwoo Choi [Fri, 8 Jul 2022 07:49:57 +0000 (16:49 +0900)]
lib: resource-monitor: Fix return value of pass_resource_monitor_is_resource_attr_supported

When return minus error value, it is converted to 1. It means that
return 'true' when error happen. So that change the return value
from minus integer value to false.

Fix following issue by this patch:
[  FAILED  ] ResourceMonitorTest.pass_resource_monitor_is_resource_attr_supported_invalid

Change-Id: I437644ffbc6b55f9ff0e539ab3af1ceda6878872
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: request-handler: Fix wrong hash function when using integer key 50/277450/4
Chanwoo Choi [Wed, 6 Jul 2022 09:16:29 +0000 (18:16 +0900)]
monitor: request-handler: Fix wrong hash function when using integer key

The glib hash supports the various hash type. The resource-monitor uses
the integer value of resource id as the key of hash. If want to use
the integer key value, have to use 'g_direct_hash'[1] function
and 'g_direct_equal' function to compare the integer key instead of
pointer key for finding the inserted data.

[1] https://docs.gtk.org/glib/func.direct_hash.html
[2] https://docs.gtk.org/glib/func.direct_equal.html

Fix the following issues by this patch:
[  FAILED  ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/0
[  FAILED  ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/0
[  FAILED  ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/0

Change-Id: I128fd800d44e5709d55d0c7a44a80db94e6d83d8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotest: intergration-test: Add resource-monitor-tests 45/277445/3
Chanwoo Choi [Mon, 4 Jul 2022 22:37:38 +0000 (07:37 +0900)]
test: intergration-test: Add resource-monitor-tests

In order that test the resource-monitor library and internal logic,
add resource-monitor-tests.

[Example, the result of resource-monitor-tests]
root:~> resource-monitor-tests
[==========] Running 16 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 4 tests from ResourceMonitorTest
[ RUN      ] ResourceMonitorTest.pass_resource_monitor_init_and_exit
[       OK ] ResourceMonitorTest.pass_resource_monitor_init_and_exit (0 ms)
[ RUN      ] ResourceMonitorTest.pass_resource_monitor_get_resource_count_valid
[       OK ] ResourceMonitorTest.pass_resource_monitor_get_resource_count_valid (2 ms)
[ RUN      ] ResourceMonitorTest.pass_resource_monitor_get_resource_count_invalid
[       OK ] ResourceMonitorTest.pass_resource_monitor_get_resource_count_invalid (0 ms)
[ RUN      ] ResourceMonitorTest.pass_resource_monitor_is_resource_attr_supported_invalid
[       OK ] ResourceMonitorTest.pass_resource_monitor_is_resource_attr_supported_invalid (1 ms)
[----------] 4 tests from ResourceMonitorTest (6 ms total)

[----------] 12 tests from ResourceMonitorTest/EachResourceMonitorTest
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/0
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/0 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/1
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/1 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/2
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_create_resource_and_delete/2 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/0
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/0 (1 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/1
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/1 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/2
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_ctrl/2 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/0
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/0 (2 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/1
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/1 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/2
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_set_resource_attr/2 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/0
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/0 (3 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/1
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/1 (0 ms)
[ RUN      ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/2
[       OK ] ResourceMonitorTest/EachResourceMonitorTest.pass_resource_monitor_get_value/2 (0 ms)
[----------] 12 tests from ResourceMonitorTest/EachResourceMonitorTest (15 ms total)

[----------] Global test environment tear-down
[==========] 16 tests from 2 test suites ran. (21 ms total)
[  PASSED  ] 16 tests.

Change-Id: Id15d6948849decedcbe0f48bee083667afdc996b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Fix to check memory map info precisely 35/277435/1 accepted/tizen/unified/20220708.132851 submit/tizen/20220707.045609
Dongwoo Lee [Tue, 5 Jul 2022 10:09:51 +0000 (19:09 +0900)]
util: kernel: Fix to check memory map info precisely

Since both "Pss:" and "SwapPss:" nodes has "Pss:" as substring, so
just strstr() cannot distinguish them. To fix it, not just check
section including node name, but check section starting with node
name.

Change-Id: Ia113d57b84414b9483b098920634c7f9f4b7461d
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Add checking support for PROCESS_ATTR_GPU_MEM 60/277260/3
Dongwoo Lee [Mon, 4 Jul 2022 06:19:07 +0000 (15:19 +0900)]
resource: process: Add checking support for PROCESS_ATTR_GPU_MEM

Change-Id: Icc7f49ee785f668f8e6afc68c6960a4d4c81c438
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Add checking support for PROCESS_GROUP_ATTR_GPU_MEM 59/277259/3
Dongwoo Lee [Mon, 4 Jul 2022 02:41:38 +0000 (11:41 +0900)]
resource: process-group: Add checking support for PROCESS_GROUP_ATTR_GPU_MEM

Change-Id: Iefbaa9526f62fe1af5fb054f8cbacbe81863bb9b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: gpu-mem: Improve process for finding gpu node 58/277258/3
Dongwoo Lee [Mon, 4 Jul 2022 02:14:38 +0000 (11:14 +0900)]
util: kernel: gpu-mem: Improve process for finding gpu node

To get rid of redundant gpu node checking at every update, finding gpu
node will be proceeded at once as constructor.

Change-Id: I30c18784f578e224e812c9ee9e0d9a4704cf901a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: gpu-mem: Fix missing header file 57/277257/3
Dongwoo Lee [Fri, 1 Jul 2022 05:39:58 +0000 (14:39 +0900)]
util: kernel: gpu-mem: Fix missing header file

Change-Id: Iec6278b4a5cab50315b3f42f28cc12205d5d2ee7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Remove unused variable to fix build warning 95/277295/4 accepted/tizen/unified/20220707.133338 submit/tizen/20220707.024120
Chanwoo Choi [Mon, 4 Jul 2022 18:53:39 +0000 (03:53 +0900)]
util: kernel: Remove unused variable to fix build warning

Fix the following warning.

   /home/abuild/rpmbuild/BUILD/pass-1.2.0/src/util/kernel.c:
               In function 'get_gpu_mem_info':
   /home/abuild/rpmbuild/BUILD/pass-1.2.0/src/util/kernel.c:435:6:
               warning: variable 'n' set but not used [-Wunused-but-set-variable]
     |  int n;

Change-Id: Ie763f9bf4f2aa61aa22535ca0209871359306419
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: parser: Replace with bool data type to prevent mismatched type casting 51/277351/1
Chanwoo Choi [Tue, 5 Jul 2022 10:11:15 +0000 (19:11 +0900)]
pass: parser: Replace with bool data type to prevent mismatched type casting

Until now, even if use DATA_TYPE_BOOLEN, use 'int' variable type.
It might cause the unknown issue by mismatched type casting
on get_property() fucntion. In order to prevent the wrong type casting,
replace with bool data type instead of integer type.

Change-Id: I51791d72579afc97b73b6a67d9a9711c21c033f4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: common: Replace prototype of json helper functions to get correct value 49/277249/9
Chanwoo Choi [Mon, 4 Jul 2022 03:32:06 +0000 (12:32 +0900)]
util: common: Replace prototype of json helper functions to get correct value

The get_int_from_object() returns '-EINVAL' when json object doesn't
contain ' key'. But it isn't correct because 'int' value is able
to get the minus value. It means that when get_int_from_object() return -EINVAL,
it is not error on side of user. To fix them, return the error and then
get the value as the parameter. Also, get_double_from_object() has the same issue.

Also, in order that keep the consistent prototype of json helper functions,
changes the functiosn as following:
- int get_int_from_object(json_object *obj, const char *key, int *data);
- int get_double_from_object(json_object *obj, const char *key, double *data);
- int get_boolean_from_object(json_object *obj, const char *key, bool *data);

Change-Id: I0a9b9da36312a0d86920f259b1f702095f104da6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopmqos: parser: Distinguish mandatory property or optional with get_property 48/277248/8
Chanwoo Choi [Sun, 3 Jul 2022 17:20:04 +0000 (02:20 +0900)]
pmqos: parser: Distinguish mandatory property or optional with get_property

Change-Id: Ifef64ee85c00f4c7a2b695aa5edf80ac6e42c824
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agothermal: parser: Distinguish mandatory property or optional with get_property 47/277247/8
Chanwoo Choi [Sun, 3 Jul 2022 17:17:18 +0000 (02:17 +0900)]
thermal: parser: Distinguish mandatory property or optional with get_property

Change-Id: I301aefac2dd006b6ba4406b0e813947c949aa490
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: parser: Distinguish mandatory property or optional with get_property 27/276927/9
Chanwoo Choi [Fri, 24 Jun 2022 07:35:30 +0000 (16:35 +0900)]
pass: parser: Distinguish mandatory property or optional with get_property

Actually, it is difficult and complicated to specify
whether some property is mandatory or optional even if
it is requied.

Specify either mandatory or optional status of each property
with get_property() function. If some property is mandatory,
just pass the true into 3rd argument of get_property.

In case of mandatory property, get_property returns error
if property is absent. On the other hand, get_property
returns non-zero with debug level log about absent property.

And also, should print the error for non-existent mandatory properteis
in same section at the same time. It helps user to fix
the configuration.

For example,
- 'device_type' and 'device_name' properties are mandatory
   and 'thermal_device_name' property is optional property.

ret += get_property(obj, "device_type", DATA_TYPE_STRING,
true, (void *)device_type);
ret += get_property(obj, "device_name", DATA_TYPE_STRING,
true, (void *)device_name);
ret += get_property(obj, "thermal_device_name", DATA_TYPE_STRING,
false, (void *)thermal_device_name);

if (ret < 0) {
    _E("Failed to get mandatory properties in device_list\n");
    return ret;
}

- result of error log
Failed to get property of 'device_type'    (log for mandatory property)
Failed to get property of 'device_name'    (log for mandatory property)
There is no property of 'thermal_priority' (log for optional property)
Failed to get mandatory properties in device_list
cannot parse of 0th resource in 'device_list' section

Change-Id: I2e8a87788eadb7550369378af4adfec0774bdc8a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: common: Add get_property to simplify the property getting operation 26/276926/7
Chanwoo Choi [Fri, 24 Jun 2022 06:13:09 +0000 (15:13 +0900)]
util: common: Add get_property to simplify the property getting operation

There are already helper funciton to get value from json object.
In order to simpilfy the code getting value from json object,
add get_value_from_object function with data type arguemnt.

[Detailed description of get_property]
int get_property(json_object *obj, const char *key,
int type, bool mandatory, void *data)
- json_object *obj : json object
- const char *key : property key
- int type : data type of property
- bool mandatory : if property is mandatory, true.
- void *data : each data will be stored

Change-Id: Ifd217ae5773e11ccb1f2d74850ee1c68fb035ebe
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: common: Move enum data_type into common.h and rename it 25/276925/4
Chanwoo Choi [Fri, 24 Jun 2022 05:29:56 +0000 (14:29 +0900)]
util: common: Move enum data_type into common.h and rename it

The previous enum monitor_data_type will be used for all data.
So that move enum monitor_data_type into common.h
and then rename from enum monitor_data_type to enum data_type
with more generic enumeration name. And add new DATA_TYPE_BOOLEAN
for boolean type.

Change-Id: I38c459057fb4962af883fc5a043f0a4f1ffda8f2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add pass-parser test for each resource 24/276924/4
Chanwoo Choi [Wed, 22 Jun 2022 10:05:44 +0000 (19:05 +0900)]
tests: unittest: Add pass-parser test for each resource

Add the unittest of pass-parser features which parse the each resource
configurations.

Change-Id: I1eaacd4340d4d19d236285a98ef0c10772ca9a46
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add unittest of pass-parser module 23/276923/2
Chanwoo Choi [Thu, 23 Jun 2022 08:31:29 +0000 (17:31 +0900)]
tests: unittest: Add unittest of pass-parser module

PASS daemon requires the json configuration containing
the device-dependent information. The described information
of json configuration are used for PASS opeartion.

Add unittest of pass-parser module for both valid
and invalid case under 'device_list' property.

Change-Id: I63b650dc34ddefe9873f28e0a9c46fff21e90936
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: parser: Use const keyword for configuration file path 51/277251/1
Chanwoo Choi [Sun, 3 Jul 2022 14:48:41 +0000 (23:48 +0900)]
pass: parser: Use const keyword for configuration file path

In order to remove the chagnes of the file path of configuration
by internal logic of pass-parser module, use const keyword for them
as following:

- int pass_parser_get_resource_config(struct pass *pass, const char *path)
- int pass_parser_get_each_resource_config(struct pass_resource *res, const char *path)

Change-Id: Ie5440b9c86b26515db2236362e3518743769f565
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: parser: Change board name checking to be an optional 22/276922/2
Chanwoo Choi [Tue, 21 Jun 2022 18:37:49 +0000 (03:37 +0900)]
pass: parser: Change board name checking to be an optional

The board name checking was mandatory before.
But, the new requirement which supports the PASS daemon
without HAL configuration is requested.
Change board name checking to be an optional.

Change-Id: I64ff9296abc6537057b85a29e9984eefe4e9996a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Fix build warning of what const keyword is missing 50/277250/1
Chanwoo Choi [Sun, 3 Jul 2022 14:54:29 +0000 (23:54 +0900)]
util: kernel: Fix build warning of what const keyword is missing

Fix the following build warning:

  [   14s] /home/abuild/rpmbuild/BUILD/pass-1.2.0/src/resource/resource-process.c:347:53:
  warning: passing argument 1 of 'is_resource_attr_interested' discards 'const' qualifier
  from pointer target type [-Wdiscarded-qualifiers]
  [   14s]   347 |  bool include_gpu_mem = is_resource_attr_interested(res, PROCESS_GROUP_ATTR_MEM_GPU);

Change-Id: I5a39513e20158c02343eb7c1d644f80ea0cba973
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: process: Add PROCESS_ATTR_MEM_GPU attribute 96/276596/3 accepted/tizen/unified/20220701.055139 submit/tizen/20220630.063053
Dongwoo Lee [Tue, 21 Jun 2022 12:38:24 +0000 (21:38 +0900)]
resource: process: Add PROCESS_ATTR_MEM_GPU attribute

Change-Id: Ie614d613cd242dd8dfaf4d315a0e122e88a9ae43
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Add PROCESS_GROUP_ATTR_MEM_GPU attribute 95/276595/3
Dongwoo Lee [Mon, 20 Jun 2022 11:16:27 +0000 (20:16 +0900)]
resource: process-group: Add PROCESS_GROUP_ATTR_MEM_GPU attribute

Change-Id: If047337cb4efd57ae19fcfbf3a89be95542b7e84
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Add new is_resource_attr_interested function 85/276985/4
Chanwoo Choi [Wed, 29 Jun 2022 01:44:08 +0000 (10:44 +0900)]
util: resource: Add new is_resource_attr_interested function

Provide is_resource_attr_interested function to check whether
some attribute id is already interested or not. It will be
used as internal function for libpass-resource-monitor
and capi-resource-monitor.

Change-Id: I1cdac2eab2672869cfa98069fc7d958c4da4dc93
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Make getting further information from smaps files 94/276594/3
Dongwoo Lee [Mon, 20 Jun 2022 11:16:27 +0000 (20:16 +0900)]
util: kernel: Make getting further information from smaps files

Now, kernel_get_thread_group_map_info() function can get gpu memory
information by retrieving section has the name of gpu device.

If the gpu memory information is not required, using smaps rather
harms performance, callee must specified whether gpu memory is
required, unless smaps_rollup is used if it is supported.

Change-Id: Ibe17aea337645ca6312df9472c252d962f158762
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Add additional memory attributes 51/276451/3
Dongwoo Lee [Thu, 16 Jun 2022 04:52:37 +0000 (13:52 +0900)]
resource: process: Add additional memory attributes

This adds new memory attributes:
     - PROCESS_ATTR_MEM_PSS
     - PROCESS_ATTR_MEM_SWAP
     - PROCESS_ATTR_MEM_SWAP_PSS

Change-Id: Ie21ca0aedf9cb1175c2d49d89e7e0487e7460abc
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Consolidate memory attribute functions 50/276450/3
Dongwoo Lee [Thu, 16 Jun 2022 02:21:41 +0000 (11:21 +0900)]
resource: process: Consolidate memory attribute functions

To reduce the redundant code and make easy to add the new memory
attribute, this make use consolidate functions for memory attributes.

Change-Id: I551b8cf9dac43ae972ad9007c1c2791ed985367f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Add additional memory attributes 81/275981/5
Dongwoo Lee [Thu, 12 May 2022 05:45:29 +0000 (14:45 +0900)]
resource: process-group: Add additional memory attributes

This adds new memory attributes:
 - PROCESS_GROUP_ATTR_MEM_PSS
 - PROCESS_GROUP_ATTR_MEM_SWAP
 - PROCESS_GROUP_ATTR_MEM_SWAP_PSS

Change-Id: I78062afa487d186489e4b9a7eea479f7b5f1be72
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agopass: Add capability for procfs access 70/276470/3
Dongwoo Lee [Thu, 16 Jun 2022 07:40:34 +0000 (16:40 +0900)]
pass: Add capability for procfs access

Change-Id: I72c186afad13f4a21400ea96f09ad72e3a42a8a1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agopass: hal: Add missing parameter validation 75/276575/3 accepted/tizen/unified/20220628.133607 submit/tizen/20220623.085905
Chanwoo Choi [Tue, 21 Jun 2022 03:05:45 +0000 (12:05 +0900)]
pass: hal: Add missing parameter validation

If enter the wrong value, it cause the fault and wrong operation.
So that add the missing parameter validation checking
to prevent the wrong operation. Add missing parameter validation
by using the unittest result of pass-hal module.

- Detailed the unittest result of pass-hal module
[  FAILED  ] PassHalTest.pass_hal_set_online_state (7 ms)
[  FAILED  ] PassHalTest.pass_hal_set_cooling_device_state (1 ms)
[  FAILED  ] PassHalTest.pass_hal_set_battery_charging_status (1 ms)
[  FAILED  ] PassHalTest.pass_hal_set_battery_charging_current (1 ms)
[  FAILED  ] PassHalTest.pass_hal_set_fault_around_bytes (1 ms)

Change-Id: Id320b77188508d82bc68137c65bb5b7d81729c55
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add unittest of pass-hal module 74/276574/3
Chanwoo Choi [Mon, 20 Jun 2022 08:10:48 +0000 (17:10 +0900)]
tests: unittest: Add unittest of pass-hal module

The pass-hal module is in charge of communicating with hal-api-power
for writing the value to h/w resource such as CPU/GPU/Battery etc
and for reading the value from h/w resources.

Change-Id: Icc9b5d48b2a30771753afd241e39e67ddf86c62f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add hal-api-power mock class 73/276573/4
Chanwoo Choi [Mon, 20 Jun 2022 08:10:30 +0000 (17:10 +0900)]
tests: unittest: Add hal-api-power mock class

PASS comunicates with hal-api-power to read/write the h/w resources
such as CPU/Memory Bus/GPU/Memroy and so on. For the testing on build
time, it requires the mocking of hal-api-power. In result, add hal-api-power
mock class.

Change-Id: I75e7537d3a94059d586943810c502882d24a1517
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add pass-unittest skeleton for testing pass module 72/276572/4
Chanwoo Choi [Mon, 20 Jun 2022 04:38:01 +0000 (13:38 +0900)]
tests: unittest: Add pass-unittest skeleton for testing pass module

PASS daemon contains the modules such as pass-parser, pass-hal,
pass-rescon, pass-resmon and son on. It requires the testing
on building time. In order to support the unittest of pass module,
add pass-unittest skeleton code.

Change-Id: Ie4c8637b4c0b5045b59eb3a92495f132aeb0c6e3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: Move test code into tests directory and redefine the test role 71/276571/4
Chanwoo Choi [Fri, 17 Jun 2022 09:03:11 +0000 (18:03 +0900)]
tests: Move test code into tests directory and redefine the test role

 Move test code into tests directory and redefine the test role as
 following because unittest will be added for each module.
- intergraion test : Test the public interface of PASS daemon
- haltest : Test the HAL interface of PASS daemon

Change-Id: Ief0d07b38491454dc0dbb06a268e5c56de31a886
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Add functions for getting process smaps file 80/275980/3
Dongwoo Lee [Thu, 12 May 2022 05:44:33 +0000 (14:44 +0900)]
util: kernel: Add functions for getting process smaps file

Change-Id: Id8b9d677585ccc4381c33eb53373037c64540f59
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agopass: Remove unnecessary installed service files 77/276477/1
Seung-Woo Kim [Fri, 17 Jun 2022 06:15:15 +0000 (15:15 +0900)]
pass: Remove unnecessary installed service files

The dbus activation service files are not necessary in systemd
unitdir. Remove unnecessary installation of dbus activation
service files.

This removes below packaging warning message:
   warning: Installed (but unpackaged) file(s) found:
      /usr/lib/systemd/system/org.tizen.system.pass.service
      /usr/lib/systemd/system/org.tizen.system.thermal.service

Change-Id: I5c13e31032b07db7ac11271ad5f231737383b0f8
Fixes: commit d0b00031fc66 ("core: Add support for dbus activation for thermal")
Fixes: commit da1dc2ab2a66 ("core: Apply systemd-based dbus activation")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agopackaging: Remove unnecessary symlink in sockets.target.wants 76/276476/1
Seung-Woo Kim [Fri, 17 Jun 2022 06:04:56 +0000 (15:04 +0900)]
packaging: Remove unnecessary symlink in sockets.target.wants

After removing pass.socket, symlink to it in sockets.target.wants
remains. Remove unnecessary symlink.

This removes next packaging warning message:
   warning: Installed (but unpackaged) file(s) found:
      /usr/lib/systemd/system/sockets.target.wants/pass.socket

Change-Id: I8f02dc5d83d8ecd41cf4c3e440b8eeb917bb0aee
Fixes: commit 00a3aedc ("pass: Remove unused pass.socket file")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoresource: memory: Add MEMORY_ATTR_SWAP_TOTAL and MEMORY_ATTR_SWAP_FREE attributes 88/275688/3 submit/tizen/20220530.230210
Sung-hun Kim [Mon, 30 May 2022 06:59:21 +0000 (15:59 +0900)]
resource: memory: Add MEMORY_ATTR_SWAP_TOTAL and MEMORY_ATTR_SWAP_FREE attributes

Change-Id: I8f6e3ff274c429fe2e5d2f9378ea4e8ae18dccaf
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoutil: timer: Fix possible dangling pointer and memory leak 31/274931/1 accepted/tizen/unified/20220525.010040 submit/tizen/20220520.031909
Dongwoo Lee [Thu, 12 May 2022 07:09:32 +0000 (16:09 +0900)]
util: timer: Fix possible dangling pointer and memory leak

Change-Id: I466617b365e91108c0ed3cdf1d95c8a237feaad8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: resource: Add function for getting resource and its attributes list 54/273654/4 accepted/tizen/unified/20220413.133040 submit/tizen/20220413.052755
Dongwoo Lee [Fri, 8 Apr 2022 07:59:30 +0000 (16:59 +0900)]
monitor: resource: Add function for getting resource and its attributes list

To provide way to manage monitoring module without static list, now
json type information for resource and its attributes list can be
retrieved with following function:
 - pass_resource_monitor_get_resource_list_json()

Change-Id: Ib9c8787a081f674fc1d6bdf12d9d027cca4b0352
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: resource: Add timestamp support 53/273653/4
Dongwoo Lee [Fri, 8 Apr 2022 03:04:08 +0000 (12:04 +0900)]
monitor: resource: Add timestamp support

To provide timeline information of resource update, now provides
timestamp as start and end time of update. It is included in resource
json as "res_ts" with "start" and "end" object, and it also can be
retrieved with following new libpass function:
 - pass_resource_monitor_get_resource_timestamp()

Change-Id: Iad2cf8bb1d1100f4ded44ce5e19aeb119c65575e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Fix unnecessary assignment and meaningless code 55/273655/2
Dongwoo Lee [Mon, 11 Apr 2022 11:28:37 +0000 (20:28 +0900)]
resource: process-group: Fix unnecessary assignment and meaningless code

Change-Id: I600fc27afa7ecb95853bc492bd997ee8d99d1e9a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Add aggregated attributes for accounting stats 57/273457/2 accepted/tizen/unified/20220412.100309 submit/tizen/20220408.030842
Dongwoo Lee [Sun, 3 Apr 2022 14:14:22 +0000 (23:14 +0900)]
resource: process-group: Add aggregated attributes for accounting stats

To provide aggregated accounting information about the process group
which includes target process and its child at a driver level, the
structure managing the current process group is changed from list to
hash, and it is preserved until root target is changed or a prcess in
a group is terminated to maintain previous stats. Thus, the clients can
retrieved aggregated accounting stats without create the individual
process driver. Newly added attributes are as follows:
 - PROCESS_GROUP_ATTR_CPU_UTIL
 - PROCESS_GROUP_ATTR_DISK_READ_BPS
 - PROCESS_GROUP_ATTR_DISK_WRITE_BPS
 - PROCESS_GROUP_ATTR_MEM_VIRT
 - PROCESS_GROUP_ATTR_MEM_RSS

Change-Id: I967da6110fb8568383c2ba096d599f51ce8e54e2
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Use taskstats instead of reading procfs 56/273456/2
Dongwoo Lee [Thu, 31 Mar 2022 04:32:25 +0000 (13:32 +0900)]
resource: process-group: Use taskstats instead of reading procfs

To lower the overhead of getting information about process, use
taskstats instead of reading procfs while building group list.
Moreover, two advantages can be gained as using taskstats directly:
 1. Lower number of copy
 2. Using taskstats accounting information without process driver

Change-Id: I5242d25ab864b05674d9af01838d3401a356a1df
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Get initial stats of target process with taskstats 55/273455/1
Dongwoo Lee [Thu, 31 Mar 2022 04:16:49 +0000 (13:16 +0900)]
resource: process: Get initial stats of target process with taskstats

Since open and read procfs task stat often cause performance
degradation in the case that many process drivers are frequentyl
set control. To reduce this overhead, now initial stats are retrieved
by taskstats and 'pgid' which cannot be retrieved by taskstats is
get lazily once at the first reading.

Change-Id: I9bae9965a17192fbc0ab5789df45a782ab97ca9d
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Make query_taskstats() common kernel utility function 54/273454/1
Dongwoo Lee [Thu, 31 Mar 2022 03:14:56 +0000 (12:14 +0900)]
util: kernel: Make query_taskstats() common kernel utility function

To use taskstats in other drivers as well as process driver,
query_taskstat() now become common kernel utility function and
name is changed as following kernel util naming rules.

Change-Id: I64eff1892d908d22a0f8f831949b2c072cc0e68b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agolib: resource-monitor: Rename to libpass-resource-monitor from tmonitor 47/273247/3 accepted/tizen/unified/20220405.003743 submit/tizen/20220404.020528
Chanwoo Choi [Fri, 1 Apr 2022 05:34:13 +0000 (14:34 +0900)]
lib: resource-monitor: Rename to libpass-resource-monitor from tmonitor

Change-Id: If008aa6ab64b04226f97709ea48e13e459cc9a61
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add JSON format support 37/273037/3 accepted/tizen/unified/20220401.033556 submit/tizen/20220401.020712
Dongwoo Lee [Tue, 29 Mar 2022 02:41:54 +0000 (11:41 +0900)]
util: resource: Add JSON format support

To extend use of monitor resource, now all attributes in resource can
be retrieved as JSON type format at once with new api below:

 - tmonitor_get_value_json: get a attribute of resource as json format
 - tmonitor_get_resource_json: get all attributes of resource as json
                               format

Change-Id: I14b1f5e2474d101ff7149a3377b2ebc1890223c8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: Change delimiter for request/response tokenizing 36/273036/2
Dongwoo Lee [Tue, 29 Mar 2022 05:24:47 +0000 (14:24 +0900)]
monitor: Change delimiter for request/response tokenizing

Since JSON format use character ':' as its internal representation,
delimiter of API tokenizing is change into '$'.

Change-Id: I0705eeb4a860cd279e9ee7b1ab62db3318786fc6
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Unset attrs when resource is deleted 35/273035/2
Dongwoo Lee [Mon, 28 Mar 2022 11:47:14 +0000 (20:47 +0900)]
util: resource: Unset attrs when resource is deleted

To free memory allocated to data_value arrays of resource, unset attr
function is invoked while deleting resource.

Change-Id: Id5c87a7a5afb64c4bd94da1894ad8fca7ec1b272
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agolib: libpass: Rename to libpass.pc and add libpass.co to libpass-devel pkg 46/273046/1 accepted/tizen/unified/20220331.010053 submit/tizen/20220330.093017
Chanwoo Choi [Wed, 30 Mar 2022 05:07:04 +0000 (14:07 +0900)]
lib: libpass: Rename to libpass.pc and add libpass.co to libpass-devel pkg

Rename the pkgconfig file name from pass.pc to libpass.pc
and add libpass.so to libpass-devel package

Change-Id: I45fcb5546a72586c263d2727a30040545d96820c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: tmonitor: Add missing detailed value type if DATA_TYPE_ARRAY 88/272988/1
Chanwoo Choi [Tue, 29 Mar 2022 08:51:38 +0000 (17:51 +0900)]
lib: tmonitor: Add missing detailed value type if DATA_TYPE_ARRAY

Change-Id: I80882c06b2b91dfdc321a609de6af97a3bfc4b54
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: request: Use different size of buffer along with request type 15/272915/5
Dongwoo Lee [Fri, 25 Mar 2022 02:08:33 +0000 (11:08 +0900)]
util: request: Use different size of buffer along with request type

To exchange large size of array, size of response for array request
should be distingushed by others. So, instead of static buffer, nowa
buffer of response is dynamically allocated along with request type.

Change-Id: I845fe444c3736ee2fef8ea99482ede6d48262b3f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Add PROCESS_GROUP_ATTR_COMM_LIST attribute 14/272914/3
Dongwoo Lee [Wed, 23 Mar 2022 10:34:03 +0000 (19:34 +0900)]
resource: process-group: Add PROCESS_GROUP_ATTR_COMM_LIST attribute

Change-Id: I977281252290f1d92d028db3a38390f5feac0848
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process-group: Change update attributes method 13/272913/3
Dongwoo Lee [Wed, 23 Mar 2022 10:27:02 +0000 (19:27 +0900)]
resource: process-group: Change update attributes method

Instead of get process group list at individual callback,
prepare_update operation of resource is used now. Thus, all other
attributes can be retrieved at same sequence of group list.

Change-Id: I239380864cd05f5ac24017fbee6e02b069538bd0
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix overflow with bit operations 13/272713/2 accepted/tizen/unified/20220323.133748 submit/tizen/20220323.085026
Chanwoo Choi [Wed, 23 Mar 2022 04:59:10 +0000 (13:59 +0900)]
util: kernel: Fix overflow with bit operations

Drop 10 MSB bit and 10 left shift operation without multiply operation.

Change-Id: I9cc0d5a3f131686c49757edfc2565f25e6a1ecef
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoRevert "util: kernel: Fix overflow issue when multiply operation" 12/272712/1
Chanwoo Choi [Wed, 23 Mar 2022 04:54:39 +0000 (13:54 +0900)]
Revert "util: kernel: Fix overflow issue when multiply operation"

This reverts commit 8c98239629e4b49f934de535f881bff26cc52ae9.

Change-Id: I1757a90f63ed45ed6ee1c987f9bc7eb45b4e68fb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: request-handler: Fix build warning 33/272633/1 accepted/tizen/unified/20220322.082850 submit/tizen/20220322.064630
Dongwoo Lee [Tue, 22 Mar 2022 05:34:27 +0000 (14:34 +0900)]
monitor: request-handler: Fix build warning

Change-Id: If5b45861fe807d0c703baf8ae37dcc90ee307389
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agolib: tmonitor: Include mandatory header file for variable types 32/272632/2
Chanwoo Choi [Tue, 22 Mar 2022 05:53:22 +0000 (14:53 +0900)]
lib: tmonitor: Include mandatory header file for variable types

When the client refer to tmonitor.h header file, build error happen
because tmonitor.h doesn't include the 'sys/type.h' header file.
So that include mandatory header file for variable types such as u_int64_t.

Change-Id: I3b69e5a95e644ccc160da8aa2583674c91f3725e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: process: Set attributes as always supported 18/272618/1 submit/tizen/20220322.020653
Dongwoo Lee [Tue, 22 Mar 2022 01:22:46 +0000 (10:22 +0900)]
resource: process: Set attributes as always supported

To support skeleton process resource driver which is representing
process on demand, it should be possible to set interesting attributes
list before set controls. To this end, all attributes in process is
now set to always supported.

Change-Id: Ib595d9093b90c860d9f8fb3922d1d295a9957af8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: request-handler: Fix to delete resource properly 96/272596/1 accepted/tizen/unified/20220322.015107 submit/tizen/20220321.101126
Dongwoo Lee [Mon, 21 Mar 2022 08:21:21 +0000 (17:21 +0900)]
monitor: request-handler: Fix to delete resource properly

Since resources are managed by hash table, it should be removed from
hash table before removing resource. Otherwise, it can cause
double-free when the client is disconnected. So, this fixes create and
remove procedures to handle hash table properly.

Change-Id: I466e5cc6c289c20cd827964aae0c191b85356938
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Fix memory leak issue 66/272566/3 accepted/tizen/unified/20220321.141108 submit/tizen/20220321.051718
Chanwoo Choi [Mon, 21 Mar 2022 05:03:21 +0000 (14:03 +0900)]
resource: process: Fix memory leak issue

Change-Id: I15674f225da17e339493327b6ec870c86ad826a7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: request-handler: Replace with strerror_r to fix vulnerability issue 63/272563/2
Chanwoo Choi [Mon, 21 Mar 2022 04:16:50 +0000 (13:16 +0900)]
monitor: request-handler: Replace with strerror_r to fix vulnerability issue

Change-Id: I399fe56e8305df1ed3aef2b7e55677ea2b463313
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add process group resource driver 24/272424/5
Dongwoo Lee [Mon, 14 Mar 2022 01:43:38 +0000 (10:43 +0900)]
resource: Add process group resource driver

This resource is pseudo-device driver which provides information of
related process group.

Controls:
 - PROCESS_GROUP_CTRL_ROOT_PID: pid of top-level process in a group
  what we want to see.
Atrributes:
 - PROCESS_GROUP_ATTR_LIST: array of pid which includes all processes
      related with root pid. if root pid is
    negative, list contains all processes.

Change-Id: I0b7a85dd7d8f2bd4628e17c8db923dd4abd112a8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix to close files after use 64/272564/1
Dongwoo Lee [Mon, 21 Mar 2022 04:10:15 +0000 (13:10 +0900)]
util: kernel: Fix to close files after use

Change-Id: I91c2869f4c8bcf9ff80bf9691d357088d80dce88
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agolib: tmonitor: Add get APIs for array type attributes 23/272423/2
Dongwoo Lee [Tue, 15 Mar 2022 03:45:22 +0000 (12:45 +0900)]
lib: tmonitor: Add get APIs for array type attributes

This adds internal API for getting array type attributes as below:

 - tmonitor_get_array_int
 - tmonitor_get_array_int64
 - tmonitor_get_array_uint
 - tmonitor_get_array_uint64
 - tmonitor_get_array_double
 - tmonitor_get_array_string

Since users get dynamically allocated array with length by just
passing pointer of pointer for each data type, it should be freed
after use.

Change-Id: I8f72ff5c6ceebcc4eda8998f2ad4fed47f71e3d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Add PGID and PPID attributes 21/272421/2
Dongwoo Lee [Fri, 11 Mar 2022 10:11:48 +0000 (19:11 +0900)]
resource: process: Add PGID and PPID attributes

Change-Id: I6516546b9e1603095070e02b299f8e904e1aa63f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Add functions for getting procfs stat fields 20/272420/2
Dongwoo Lee [Mon, 14 Mar 2022 09:33:54 +0000 (02:33 -0700)]
util: kernel: Add functions for getting procfs stat fields

This adds new functions for getting procfs stat fields of certain
process id as like below prototype:

int kernel_get_process_stat_fields(pid_t pid, char *buffer, int buf_len, char **stat_fields)
 - pid: target process id
 - buffer: string buffer for retrieving procfs stat, each field of
           stat_fileds points out some index within this buffer area.
   Thus, life time of stat_fields are determined by this.
 - buf_len: length of provided buffer
 - stat_fields: string array of retrieved fields, this should be
  declared as (char *)[PROCESS_STAT_FIELD_MAX] type.

Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
Change-Id: I23008751fdd17ddd17d9e756e1f0d7394bee5f98

2 years agoutil: Add resource_attr_supported_always() function 19/272419/1
Dongwoo Lee [Tue, 15 Mar 2022 11:19:20 +0000 (20:19 +0900)]
util: Add resource_attr_supported_always() function

This provides common callback to is_supported operation of attribute
for supporting always available attributes.

Change-Id: Iba5058e03cf583693a897684093cf5d35573be33
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix overflow issue when multiply operation 95/272295/1 accepted/tizen/unified/20220315.065607 submit/tizen/20220315.010333
Chanwoo Choi [Mon, 14 Mar 2022 07:46:05 +0000 (16:46 +0900)]
util: kernel: Fix overflow issue when multiply operation

Change-Id: Ia9bce7fbc4adabafa76e788d78450ce38866d7cf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>