resource: Add a new property "flag" to attributes 71/280371/4
authorSung-hun Kim <sfoon.kim@samsung.com>
Tue, 23 Aug 2022 11:13:57 +0000 (20:13 +0900)
committerSung-hun Kim <sfoon.kim@samsung.com>
Wed, 31 Aug 2022 08:28:34 +0000 (17:28 +0900)
To distinguish visibility of resource attributes, a new property
is added to each attribute. The visibility of each attribute is
pre-defined. Pass allows or rejects user's request for setting
interested attributes depends on the combination of the
visibility of each resource and the visibility of each attribute.

We used a flag variable for representing the visibility of the
resource attribute. The flag variable can extend to represent
other properties of the resource attribute.

Change-Id: Ie48f00f89ec6095e05e9f8fcf395e1ea0da026bb
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
12 files changed:
include/util/resource.h
src/resource/resource-battery.c
src/resource/resource-bus.c
src/resource/resource-cpu.c
src/resource/resource-disk.c
src/resource/resource-display.c
src/resource/resource-gpu.c
src/resource/resource-memory.c
src/resource/resource-network.c
src/resource/resource-process-group.c
src/resource/resource-process.c
src/resource/resource-system.c

index 19a08ab56e575f43910c68ac85ab2ee08211611f..cd2deb33e6ba6ad496f1b253ce145a12cb9905d3 100644 (file)
  */
 #define RESOURCE_FLAG_PROCESS                          BIT(1)
 
+/* Flags for resource_attribute */
+#define RESOURCE_ATTR_FLAG_PRIVATE                     BIT(0)
+#define RESOURCE_ATTR_FLAG_PUBLIC                      BIT(1)
+
 struct resource;
 struct resource_attribute;
 
@@ -71,6 +75,7 @@ struct resource_attribute {
        const char name[BUFF_MAX];
        const u_int64_t id;
        const int type;
+       const u_int64_t flag;
        const struct resource_attribute_ops ops;
 };
 
index ed51d395f49b19e98aff369f1f8f17de348b9a90..07699b1df90d7923d57fe17469358bc667c404e5 100644 (file)
@@ -93,6 +93,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_CAPACITY",
                .id     = BATTERY_ATTR_CAPACITY,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
@@ -100,6 +101,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_STATUS",
                .id     = BATTERY_ATTR_STATUS,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_status,
                }
@@ -107,6 +109,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_TEMPERATURE",
                .id     = BATTERY_ATTR_TEMPERATURE,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
@@ -114,6 +117,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_VOLTAGE_NOW",
                .id     = BATTERY_ATTR_VOLTAGE_NOW,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
@@ -121,6 +125,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_CURRENT_NOW",
                .id     = BATTERY_ATTR_CURRENT_NOW,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
@@ -128,6 +133,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_PRESENT",
                .id     = BATTERY_ATTR_PRESENT,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
@@ -135,6 +141,7 @@ static const struct resource_attribute battery_attrs[] = {
                .name   = "BATTERY_ATTR_ONLINE",
                .id     = BATTERY_ATTR_ONLINE,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = battery_get_info,
                }
index 007d1f440dfb90af7958113dada9c86b7534b119..2cbba186146f71ad2d0d47dc10a681ba6b99063b 100644 (file)
@@ -130,6 +130,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_CUR_FREQ",
                .id     = BUS_ATTR_CUR_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_value_from_hal_power,
                },
@@ -137,6 +138,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_MIN_FREQ",
                .id     = BUS_ATTR_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_value_from_hal_power,
                },
@@ -144,6 +146,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_MAX_FREQ",
                .id     = BUS_ATTR_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_value_from_hal_power,
                }
@@ -151,6 +154,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_AVAILABLE_MIN_FREQ",
                .id     = BUS_ATTR_AVAILABLE_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_value_from_hal_power,
                }
@@ -158,6 +162,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_AVAILABLE_MAX_FREQ",
                .id     = BUS_ATTR_AVAILABLE_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_value_from_hal_power,
                }
@@ -165,6 +170,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_CUR_GOVERNOR",
                .id     = BUS_ATTR_CUR_GOVERNOR,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_string_value,
                }
@@ -172,6 +178,7 @@ static const struct resource_attribute bus_attrs[] = {
                .name   = "BUS_ATTR_NAME",
                .id     = BUS_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = bus_get_string_value,
                }
index 82ac454bf7fd510b9e60ed5c64a511356f9ee651..2f316be376cb11e13bbd585eb5270ccaf723c846 100644 (file)
@@ -129,6 +129,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_CUR_FREQ",
                .id     = CPU_ATTR_CUR_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_value_from_hal_power,
                },
@@ -136,6 +137,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_MIN_FREQ",
                .id     = CPU_ATTR_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_value_from_hal_power,
                },
@@ -143,6 +145,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_MAX_FREQ",
                .id     = CPU_ATTR_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_value_from_hal_power,
                }
@@ -150,6 +153,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_AVAILABLE_MIN_FREQ",
                .id     = CPU_ATTR_AVAILABLE_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_value_from_hal_power,
                }
@@ -157,6 +161,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_AVAILABLE_MAX_FREQ",
                .id     = CPU_ATTR_AVAILABLE_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_value_from_hal_power,
                }
@@ -164,6 +169,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_CUR_GOVERNOR",
                .id     = CPU_ATTR_CUR_GOVERNOR,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_string_value,
                }
@@ -171,6 +177,7 @@ static const struct resource_attribute cpu_attrs[] = {
                .name   = "CPU_ATTR_NAME",
                .id     = CPU_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = cpu_get_string_value,
                }
index a28f2167d6e954d191ef61ac7f55a83e29666033..20fce27593ba51643fe35d4dafe5178c9b6ad19c 100644 (file)
@@ -121,6 +121,7 @@ static const struct resource_attribute disk_attrs[] = {
                .name   = "DISK_ATTR_NAME",
                .id     = DISK_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = disk_get_value,
                },
@@ -128,6 +129,7 @@ static const struct resource_attribute disk_attrs[] = {
                .name   = "DISK_ATTR_READ_PER_SEC",
                .id     = DISK_ATTR_READ_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = disk_get_value,
                },
@@ -135,6 +137,7 @@ static const struct resource_attribute disk_attrs[] = {
                .name   = "DISK_ATTR_WRITE_PER_SEC",
                .id     = DISK_ATTR_WRITE_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = disk_get_value,
                },
@@ -142,6 +145,7 @@ static const struct resource_attribute disk_attrs[] = {
                .name   = "DISK_ATTR_READ_TOTAL",
                .id     = DISK_ATTR_READ_TOTAL,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = disk_get_value,
                },
@@ -149,6 +153,7 @@ static const struct resource_attribute disk_attrs[] = {
                .name   = "DISK_ATTR_WRITE_TOTAL",
                .id     = DISK_ATTR_WRITE_TOTAL,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = disk_get_value,
                },
index dcba28bbc6c5b9ff737b4b59158d5d72c6905dc3..ed0f55e7ce74f2869d678f9e226e25458a527f92 100644 (file)
@@ -184,6 +184,7 @@ static const struct resource_attribute display_attrs[] = {
                .name   = "DISPLAY_ATTR_FPS",
                .id     = DISPLAY_ATTR_FPS,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = display_get_fps,
                },
@@ -191,6 +192,7 @@ static const struct resource_attribute display_attrs[] = {
                .name   = "DISPLAY_ATTR_NAME",
                .id     = DISPLAY_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = display_get_name,
                },
index 5deae1456389423dbbcc53342bac6ff4117d86da..8e6ac824ba3c22f92bc478cfb9f296e898eec48c 100644 (file)
@@ -130,6 +130,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_CUR_FREQ",
                .id     = GPU_ATTR_CUR_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_value_from_hal_power,
                },
@@ -137,6 +138,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_MIN_FREQ",
                .id     = GPU_ATTR_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_value_from_hal_power,
                },
@@ -144,6 +146,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_MAX_FREQ",
                .id     = GPU_ATTR_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_value_from_hal_power,
                }
@@ -151,6 +154,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_AVAILABLE_MIN_FREQ",
                .id     = GPU_ATTR_AVAILABLE_MIN_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_value_from_hal_power,
                }
@@ -158,6 +162,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_AVAILABLE_MAX_FREQ",
                .id     = GPU_ATTR_AVAILABLE_MAX_FREQ,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_value_from_hal_power,
                }
@@ -165,6 +170,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_CUR_GOVERNOR",
                .id     = GPU_ATTR_CUR_GOVERNOR,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_string_value,
                }
@@ -172,6 +178,7 @@ static const struct resource_attribute gpu_attrs[] = {
                .name   = "GPU_ATTR_NAME",
                .id     = GPU_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = gpu_get_string_value,
                }
index 5258cd8ae016c968af719ec5e38202ceaa05ab28..1ddfa145aba769fab3b189356445e63e5e94d75f 100644 (file)
@@ -127,6 +127,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_TOTAL",
                .id     = MEMORY_ATTR_TOTAL,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                },
@@ -134,6 +135,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_AVAILABLE",
                .id     = MEMORY_ATTR_AVAILABLE,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                },
@@ -141,6 +143,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_FREE",
                .id     = MEMORY_ATTR_FREE,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -148,6 +151,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_BUFFER",
                .id     = MEMORY_ATTR_BUFFER,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -155,6 +159,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_CACHED",
                .id     = MEMORY_ATTR_CACHED,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -162,6 +167,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_CMA_TOTAL",
                .id     = MEMORY_ATTR_CMA_TOTAL,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -169,6 +175,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_CMA_FREE",
                .id     = MEMORY_ATTR_CMA_FREE,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -176,6 +183,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_SWAP_TOTAL",
                .id     = MEMORY_ATTR_SWAP_TOTAL,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
@@ -183,6 +191,7 @@ static const struct resource_attribute memory_attrs[] = {
                .name   = "MEMORY_ATTR_SWAP_FREE",
                .id     = MEMORY_ATTR_SWAP_FREE,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = memory_get_memory_info,
                }
index b05f9ce65fe8803a390182b087346e2a4894eea3..016820a3f8bb822c4ac2656f2ae8b40792edc931 100644 (file)
@@ -67,6 +67,7 @@ static const struct resource_attribute network_attrs[] = {
                .name   = "NETWORK_ATTR_NAME",
                .id     = NETWORK_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = network_get_name,
                },
index 5bdbf52bd07151ac66a544335c875a9ec1a97433..3985ac6ab4a5d1e1efe3d9bfcc662b46d7c497fc 100644 (file)
@@ -257,6 +257,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_PID_LIST",
                .id     = PROCESS_GROUP_ATTR_PID_LIST,
                .type   = DATA_TYPE_ARRAY,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_pid_list,
                        .is_supported = process_group_check_taskstat_support,
@@ -265,6 +266,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_NAME_LIST",
                .id     = PROCESS_GROUP_ATTR_NAME_LIST,
                .type   = DATA_TYPE_ARRAY,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_name_list,
                        .is_supported = process_group_check_taskstat_support,
@@ -273,6 +275,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_CPU_UTIL",
                .id     = PROCESS_GROUP_ATTR_CPU_UTIL,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_cpu_util,
                        .is_supported = process_group_check_taskstat_support,
@@ -281,6 +284,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_DISK_READ_PER_SEC",
                .id     = PROCESS_GROUP_ATTR_DISK_READ_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_disk_attrs,
                        .is_supported = process_group_check_taskstat_support,
@@ -289,6 +293,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC",
                .id     = PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_disk_attrs,
                        .is_supported = process_group_check_taskstat_support,
@@ -297,6 +302,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_VIRT",
                .id     = PROCESS_GROUP_ATTR_MEM_VIRT,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_taskstat_support,
@@ -305,6 +311,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_RSS",
                .id     = PROCESS_GROUP_ATTR_MEM_RSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_taskstat_support,
@@ -313,6 +320,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_PSS",
                .id     = PROCESS_GROUP_ATTR_MEM_PSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_taskstat_support,
@@ -321,6 +329,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_SWAP",
                .id     = PROCESS_GROUP_ATTR_MEM_SWAP,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_taskstat_support,
@@ -329,6 +338,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_SWAP_PSS",
                .id     = PROCESS_GROUP_ATTR_MEM_SWAP_PSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_taskstat_support,
@@ -337,6 +347,7 @@ static const struct resource_attribute process_group_attrs[] = {
                .name   = "PROCESS_GROUP_ATTR_MEM_GPU",
                .id     = PROCESS_GROUP_ATTR_MEM_GPU,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_group_get_mem,
                        .is_supported = process_group_check_gpu_support,
index 4f68a7829f19bc877701d18c5bba763e94550930..f6c2a8bb3bef5e132378ac18ffd50e2b370ab24b 100644 (file)
@@ -266,6 +266,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_CPU_UTIL",
                .id     = PROCESS_ATTR_CPU_UTIL,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_cpu_util,
                        .is_supported = process_check_taskstat_support,
@@ -274,6 +275,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_VIRT",
                .id     = PROCESS_ATTR_MEM_VIRT,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = process_check_taskstat_support,
@@ -282,6 +284,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_RSS",
                .id     = PROCESS_ATTR_MEM_RSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = process_check_taskstat_support,
@@ -290,6 +293,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_RSS_PERCENT",
                .id     = PROCESS_ATTR_MEM_RSS_PERCENT,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = process_check_taskstat_support,
@@ -298,6 +302,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_DISK_READ_PER_SEC",
                .id     = PROCESS_ATTR_DISK_READ_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_disk_attrs,
                        .is_supported = process_check_taskstat_support,
@@ -306,6 +311,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_DISK_WRITE_PER_SEC",
                .id     = PROCESS_ATTR_DISK_WRITE_PER_SEC,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_disk_attrs,
                        .is_supported = process_check_taskstat_support,
@@ -314,6 +320,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_NAME",
                .id     = PROCESS_ATTR_NAME,
                .type   = DATA_TYPE_STRING,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_context_data,
                        .is_supported = resource_attr_supported_always,
@@ -322,6 +329,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_PGID",
                .id     = PROCESS_ATTR_PGID,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_context_data,
                        .is_supported = resource_attr_supported_always,
@@ -330,6 +338,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_PPID",
                .id     = PROCESS_ATTR_PPID,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_context_data,
                        .is_supported = resource_attr_supported_always,
@@ -338,6 +347,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_PSS",
                .id     = PROCESS_ATTR_MEM_PSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = resource_attr_supported_always,
@@ -346,6 +356,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_SWAP",
                .id     = PROCESS_ATTR_MEM_SWAP,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = resource_attr_supported_always,
@@ -354,6 +365,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_SWAP_PSS",
                .id     = PROCESS_ATTR_MEM_SWAP_PSS,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = resource_attr_supported_always,
@@ -362,6 +374,7 @@ static const struct resource_attribute process_attrs[] = {
                .name   = "PROCESS_ATTR_MEM_GPU",
                .id     = PROCESS_ATTR_MEM_GPU,
                .type   = DATA_TYPE_UINT64,
+               .flag   = RESOURCE_ATTR_FLAG_PRIVATE,
                .ops    = {
                        .get = process_get_mem_attrs,
                        .is_supported = process_check_gpu_support,
index 42c7d4383b14bc9e6c6e799f8a9253d736511758..010c9486f8f9e6738d39a922d295fe0ee228d169 100644 (file)
@@ -186,6 +186,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_CPU_UTIL",
                .id     = SYSTEM_ATTR_CPU_UTIL,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_avg_cpu_util,
                }
@@ -193,6 +194,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_CPU_USER_UTIL",
                .id     = SYSTEM_ATTR_CPU_USER_UTIL,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_avg_cpu_util,
                }
@@ -200,6 +202,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_CPU_SYS_UTIL",
                .id     = SYSTEM_ATTR_CPU_SYS_UTIL,
                .type   = DATA_TYPE_DOUBLE,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_avg_cpu_util,
                }
@@ -207,6 +210,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_PER_CPU_UTIL",
                .id     = SYSTEM_ATTR_PER_CPU_UTIL,
                .type   = DATA_TYPE_ARRAY,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_per_cpu_util,
                }
@@ -214,6 +218,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_PER_CPU_USER_UTIL",
                .id     = SYSTEM_ATTR_PER_CPU_USER_UTIL,
                .type   = DATA_TYPE_ARRAY,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_per_cpu_util,
                }
@@ -221,6 +226,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_PER_CPU_SYS_UTIL",
                .id     = SYSTEM_ATTR_PER_CPU_SYS_UTIL,
                .type   = DATA_TYPE_ARRAY,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_per_cpu_util,
                }
@@ -228,6 +234,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_POSSIBLE_CPU",
                .id     = SYSTEM_ATTR_POSSIBLE_CPU,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_cpu_num,
                }
@@ -235,6 +242,7 @@ static const struct resource_attribute system_attrs[] = {
                .name   = "SYSTEM_ATTR_ONLINE_CPU",
                .id     = SYSTEM_ATTR_ONLINE_CPU,
                .type   = DATA_TYPE_INT,
+               .flag   = RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_cpu_num,
                }