From: Dongwoo Lee Date: Tue, 9 Aug 2022 01:53:47 +0000 (-0700) Subject: resource: Change bytes unit attributes to kilo-bytes X-Git-Tag: submit/tizen/20220812.041529~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f59279ad7f63ef7be148c2ac8f1baf64f02ddfae;p=platform%2Fcore%2Fsystem%2Fpass.git 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 --- diff --git a/lib/resource-monitor/resource-monitor.h b/lib/resource-monitor/resource-monitor.h index 1311975..647ad29 100644 --- a/lib/resource-monitor/resource-monitor.h +++ b/lib/resource-monitor/resource-monitor.h @@ -124,8 +124,8 @@ extern "C" { #define PROCESS_ATTR_MEM_VIRT BIT(1) /* DATA_TYPE_UINT64 */ #define PROCESS_ATTR_MEM_RSS BIT(2) /* DATA_TYPE_UINT64 */ #define PROCESS_ATTR_MEM_RSS_PERCENT BIT(3) /* DATA_TYPE_DOUBLE */ -#define PROCESS_ATTR_DISK_READ_BPS BIT(4) /* DATA_TYPE_UINT */ -#define PROCESS_ATTR_DISK_WRITE_BPS BIT(5) /* DATA_TYPE_UINT */ +#define PROCESS_ATTR_DISK_READ_PER_SEC BIT(4) /* DATA_TYPE_DOUBLE */ +#define PROCESS_ATTR_DISK_WRITE_PER_SEC BIT(5) /* DATA_TYPE_DOUBLE */ #define PROCESS_ATTR_NAME BIT(6) /* DATA_TYPE_STRING */ #define PROCESS_ATTR_PGID BIT(7) /* DATA_TYPE_INT */ #define PROCESS_ATTR_PPID BIT(8) /* DATA_TYPE_INT */ @@ -140,8 +140,8 @@ extern "C" { #define PROCESS_GROUP_ATTR_PID_LIST BIT(0) /* DATA_TYPE_ARRAY(INT) */ #define PROCESS_GROUP_ATTR_NAME_LIST BIT(1) /* DATA_TYPE_ARRAY(STRING) */ #define PROCESS_GROUP_ATTR_CPU_UTIL BIT(2) /* DATA_TYPE_DOUBLE */ -#define PROCESS_GROUP_ATTR_DISK_READ_BPS BIT(3) /* DATA_TYPE_UINT */ -#define PROCESS_GROUP_ATTR_DISK_WRITE_BPS BIT(4) /* DATA_TYPE_UINT */ +#define PROCESS_GROUP_ATTR_DISK_READ_PER_SEC BIT(3) /* DATA_TYPE_DOUBLE */ +#define PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC BIT(4) /* DATA_TYPE_DOUBLE */ #define PROCESS_GROUP_ATTR_MEM_VIRT BIT(5) /* DATA_TYPE_UINT64 */ #define PROCESS_GROUP_ATTR_MEM_RSS BIT(6) /* DATA_TYPE_UINT64 */ #define PROCESS_GROUP_ATTR_MEM_PSS BIT(7) /* DATA_TYPE_UINT64 */ diff --git a/src/resource/resource-process-group.c b/src/resource/resource-process-group.c index 754f5e4..a8a0f41 100644 --- a/src/resource/resource-process-group.c +++ b/src/resource/resource-process-group.c @@ -39,8 +39,8 @@ struct process_group_context { double cpu_util; u_int64_t mem_rss; u_int64_t mem_virt; - u_int32_t disk_rbps; - u_int32_t disk_wbps; + double disk_read_persec; + double disk_write_persec; u_int64_t mem_pss; u_int64_t mem_swap; u_int64_t mem_swap_pss; @@ -210,12 +210,11 @@ static int process_group_get_mem(struct resource *res, return 0; } -static int process_group_get_disk_bps(struct resource *res, +static int process_group_get_disk_attrs(struct resource *res, const struct resource_attribute *attr, void *data) { struct process_group_context *ctx; - u_int32_t *bps = (u_int32_t *)data; if (!res || !attr || !data) return -EINVAL; @@ -228,11 +227,11 @@ static int process_group_get_disk_bps(struct resource *res, return -EINVAL; switch (attr->id) { - case PROCESS_GROUP_ATTR_DISK_READ_BPS: - *bps = ctx->info.disk_rbps; + case PROCESS_GROUP_ATTR_DISK_READ_PER_SEC: + *(double *)data = ctx->info.disk_read_persec; break; - case PROCESS_GROUP_ATTR_DISK_WRITE_BPS: - *bps = ctx->info.disk_wbps; + case PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC: + *(double *)data = ctx->info.disk_write_persec; break; default: return -EINVAL; @@ -272,19 +271,19 @@ static const struct resource_attribute process_group_attrs[] = { .is_supported = resource_attr_supported_always, }, }, { - .name = "PROCESS_GROUP_ATTR_DISK_READ_BPS", - .id = PROCESS_GROUP_ATTR_DISK_READ_BPS, - .type = DATA_TYPE_UINT, + .name = "PROCESS_GROUP_ATTR_DISK_READ_PER_SEC", + .id = PROCESS_GROUP_ATTR_DISK_READ_PER_SEC, + .type = DATA_TYPE_DOUBLE, .ops = { - .get = process_group_get_disk_bps, + .get = process_group_get_disk_attrs, .is_supported = resource_attr_supported_always, }, }, { - .name = "PROCESS_GROUP_ATTR_DISK_WRITE_BPS", - .id = PROCESS_GROUP_ATTR_DISK_WRITE_BPS, - .type = DATA_TYPE_UINT, + .name = "PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC", + .id = PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC, + .type = DATA_TYPE_DOUBLE, .ops = { - .get = process_group_get_disk_bps, + .get = process_group_get_disk_attrs, .is_supported = resource_attr_supported_always, }, }, { @@ -479,19 +478,19 @@ static int update_aggr_taskstats(struct process_group_context *ctx, struct resou ctx->info.cpu_util += (util / nproc); } - ctx->info.mem_virt += (curr->virtmem * 1024 * 1024) / curr->ac_stime; - ctx->info.mem_rss += (curr->coremem * 1024 * 1024) / curr->ac_stime; - ctx->info.disk_rbps += ((curr->read_bytes - prev->read_bytes) * 1000000) + ctx->info.mem_virt += (curr->virtmem * 1024) / curr->ac_stime; + ctx->info.mem_rss += (curr->coremem * 1024) / curr->ac_stime; + ctx->info.disk_read_persec += (double)((curr->read_bytes - prev->read_bytes) * 1024) / (curr->ac_etime - prev->ac_etime); - ctx->info.disk_wbps += ((curr->write_bytes - prev->write_bytes) * 1000000) + ctx->info.disk_write_persec += (double)((curr->write_bytes - prev->write_bytes) * 1024) / (curr->ac_etime - prev->ac_etime); - ctx->info.mem_pss += (u_int64_t)map_info.pss * 1024; - ctx->info.mem_swap += (u_int64_t)map_info.swap * 1024; - ctx->info.mem_swap_pss += (u_int64_t)map_info.swap_pss * 1024; + ctx->info.mem_pss += (u_int64_t)map_info.pss; + ctx->info.mem_swap += (u_int64_t)map_info.swap; + ctx->info.mem_swap_pss += (u_int64_t)map_info.swap_pss; if (include_gpu_mem) - ctx->info.mem_gpu += (u_int64_t)map_info.gpu_mem * 1024; + ctx->info.mem_gpu += (u_int64_t)map_info.gpu_mem; free(prev); node->prev = curr; diff --git a/src/resource/resource-process.c b/src/resource/resource-process.c index 073b2eb..0c00e04 100644 --- a/src/resource/resource-process.c +++ b/src/resource/resource-process.c @@ -100,32 +100,32 @@ static int process_get_mem_attrs(struct resource *res, switch (attr->id) { case PROCESS_ATTR_MEM_VIRT: curr = &ctx->curr; - *mem = (curr->virtmem * 1024 * 1024) / curr->ac_stime; + *mem = (curr->virtmem * 1024) / curr->ac_stime; break; case PROCESS_ATTR_MEM_RSS: curr = &ctx->curr; - *mem = (curr->coremem * 1024 * 1024) / curr->ac_stime; + *mem = (curr->coremem * 1024) / curr->ac_stime; break; case PROCESS_ATTR_MEM_RSS_PERCENT: { double *percent = (double *)data; curr = &ctx->curr; - *percent = (curr->coremem * 1024 * 1024) / curr->ac_stime; + *percent = (curr->coremem * 1024) / curr->ac_stime; *percent /= ctx->total_memory * 100.0; break; } case PROCESS_ATTR_MEM_PSS: - *mem = (u_int64_t)ctx->map_info.pss * 1024; + *mem = (u_int64_t)ctx->map_info.pss; break; case PROCESS_ATTR_MEM_SWAP: - *mem = (u_int64_t)ctx->map_info.swap * 1024; + *mem = (u_int64_t)ctx->map_info.swap; break; case PROCESS_ATTR_MEM_SWAP_PSS: - *mem = (u_int64_t)ctx->map_info.swap_pss * 1024; + *mem = (u_int64_t)ctx->map_info.swap_pss; break; case PROCESS_ATTR_MEM_GPU: - *mem = (u_int64_t)ctx->map_info.gpu_mem * 1024; + *mem = (u_int64_t)ctx->map_info.gpu_mem; break; default: return -EINVAL; @@ -134,14 +134,13 @@ static int process_get_mem_attrs(struct resource *res, return 0; } -static int process_get_disk_bps(struct resource *res, +static int process_get_disk_attrs(struct resource *res, const struct resource_attribute *attr, void *data) { struct process_context *ctx; struct taskstats *prev, *curr; u_int64_t period; - u_int32_t *bps = (u_int32_t *)data; if (!res || !attr || !data) return -EINVAL; @@ -162,11 +161,11 @@ static int process_get_disk_bps(struct resource *res, period = curr->ac_etime - prev->ac_etime; switch (attr->id) { - case PROCESS_ATTR_DISK_READ_BPS: - *bps = (curr->read_bytes - prev->read_bytes) * 1000000 / period; + case PROCESS_ATTR_DISK_READ_PER_SEC: + *(double *)data = (double)((curr->read_bytes - prev->read_bytes) * 1024) / period; break; - case PROCESS_ATTR_DISK_WRITE_BPS: - *bps = (curr->write_bytes - prev->write_bytes) * 1000000 / period; + case PROCESS_ATTR_DISK_WRITE_PER_SEC: + *(double *)data = (double)((curr->write_bytes - prev->write_bytes) * 1024) / period; break; default: return -EINVAL; @@ -261,19 +260,19 @@ static const struct resource_attribute process_attrs[] = { .is_supported = resource_attr_supported_always, }, }, { - .name = "PROCESS_ATTR_DISK_READ_BPS", - .id = PROCESS_ATTR_DISK_READ_BPS, - .type = DATA_TYPE_UINT, + .name = "PROCESS_ATTR_DISK_READ_PER_SEC", + .id = PROCESS_ATTR_DISK_READ_PER_SEC, + .type = DATA_TYPE_DOUBLE, .ops = { - .get = process_get_disk_bps, + .get = process_get_disk_attrs, .is_supported = resource_attr_supported_always, }, }, { - .name = "PROCESS_ATTR_DISK_WRITE_BPS", - .id = PROCESS_ATTR_DISK_WRITE_BPS, - .type = DATA_TYPE_UINT, + .name = "PROCESS_ATTR_DISK_WRITE_PER_SEC", + .id = PROCESS_ATTR_DISK_WRITE_PER_SEC, + .type = DATA_TYPE_DOUBLE, .ops = { - .get = process_get_disk_bps, + .get = process_get_disk_attrs, .is_supported = resource_attr_supported_always, }, }, { diff --git a/src/util/kernel.c b/src/util/kernel.c index d9b1d19..0baaf4a 100644 --- a/src/util/kernel.c +++ b/src/util/kernel.c @@ -191,10 +191,6 @@ int kernel_get_memory_info(const char *key, u_int64_t *val) while (fgets(buf, BUFF_MAX, fp)) { if (!strncmp(buf, key, strlen(key))) { sscanf(buf, "%*s %"PRIu64, val); - if (strstr(buf, "kB")) { - *val &= GENMASK64(53, 0); - *val <<= 10; - } break; } } diff --git a/tests/integration-test/resource-monitor-tests.cpp b/tests/integration-test/resource-monitor-tests.cpp index 2b67de4..3f2bba1 100644 --- a/tests/integration-test/resource-monitor-tests.cpp +++ b/tests/integration-test/resource-monitor-tests.cpp @@ -822,8 +822,8 @@ INSTANTIATE_TEST_CASE_P (ResourceMonitorTest, ProcessResourceMonitorTest, { .attr_id = PROCESS_ATTR_MEM_VIRT, .attr_type = DATA_TYPE_UINT64, }, { .attr_id = PROCESS_ATTR_MEM_RSS, .attr_type = DATA_TYPE_UINT64, }, { .attr_id = PROCESS_ATTR_MEM_RSS_PERCENT, .attr_type = DATA_TYPE_DOUBLE, }, - { .attr_id = PROCESS_ATTR_DISK_READ_BPS, .attr_type = DATA_TYPE_UINT, }, - { .attr_id = PROCESS_ATTR_DISK_WRITE_BPS, .attr_type = DATA_TYPE_UINT, }, + { .attr_id = PROCESS_ATTR_DISK_READ_PER_SEC, .attr_type = DATA_TYPE_DOUBLE, }, + { .attr_id = PROCESS_ATTR_DISK_WRITE_PER_SEC, .attr_type = DATA_TYPE_DOUBLE, }, { .attr_id = PROCESS_ATTR_NAME, .attr_type = DATA_TYPE_STRING, }, { .attr_id = PROCESS_ATTR_PGID, .attr_type = DATA_TYPE_INT, }, { .attr_id = PROCESS_ATTR_PPID, .attr_type = DATA_TYPE_INT, }, @@ -845,8 +845,8 @@ INSTANTIATE_TEST_CASE_P (ResourceMonitorTest, ProcessResourceMonitorTest, { .attr_id = PROCESS_GROUP_ATTR_PID_LIST, .attr_type = DATA_TYPE_ARRAY, .array_type = DATA_TYPE_INT, }, { .attr_id = PROCESS_GROUP_ATTR_NAME_LIST, .attr_type = DATA_TYPE_ARRAY, .array_type = DATA_TYPE_STRING, }, { .attr_id = PROCESS_GROUP_ATTR_CPU_UTIL, .attr_type = DATA_TYPE_DOUBLE, }, - { .attr_id = PROCESS_GROUP_ATTR_DISK_READ_BPS, .attr_type = DATA_TYPE_UINT, }, - { .attr_id = PROCESS_GROUP_ATTR_DISK_WRITE_BPS, .attr_type = DATA_TYPE_UINT, }, + { .attr_id = PROCESS_GROUP_ATTR_DISK_READ_PER_SEC, .attr_type = DATA_TYPE_DOUBLE, }, + { .attr_id = PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC, .attr_type = DATA_TYPE_DOUBLE, }, { .attr_id = PROCESS_GROUP_ATTR_MEM_VIRT, .attr_type = DATA_TYPE_UINT64, }, { .attr_id = PROCESS_GROUP_ATTR_MEM_RSS, .attr_type = DATA_TYPE_UINT64, }, { .attr_id = PROCESS_GROUP_ATTR_MEM_PSS, .attr_type = DATA_TYPE_UINT64, }, diff --git a/tools/resource-monitor/resource-monitor.c b/tools/resource-monitor/resource-monitor.c index e454859..0147aaf 100644 --- a/tools/resource-monitor/resource-monitor.c +++ b/tools/resource-monitor/resource-monitor.c @@ -51,112 +51,112 @@ struct resource_attr_data { }; static struct resource_attr_data cpu_attrs[] = { - { .id = CPU_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "CPU_ATTR_NAME", .unit = "", .desc = "CPU cluster name", }, - { .id = CPU_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current CPU frequency", }, - { .id = CPU_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current CPU minimum frequency", }, - { .id = CPU_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current CPU maximum frequency", }, - { .id = CPU_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available CPU minimum frequency", }, - { .id = CPU_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available CPU maximum frequency", }, - { .id = CPU_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "CPU_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current CPU frequency governor name", }, + { .id = CPU_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "CPU_ATTR_NAME", .unit = "", .desc = "CPU cluster name", }, + { .id = CPU_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current CPU frequency", }, + { .id = CPU_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current CPU minimum frequency", }, + { .id = CPU_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current CPU maximum frequency", }, + { .id = CPU_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available CPU minimum frequency", }, + { .id = CPU_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "CPU_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available CPU maximum frequency", }, + { .id = CPU_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "CPU_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current CPU frequency governor name", }, }; static struct resource_attr_data bus_attrs[] = { - { .id = BUS_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "BUS_ATTR_NAME", .unit = "", .desc = "Bus device name", }, - { .id = BUS_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current bus frequency", }, - { .id = BUS_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current bus minimum frequency", }, - { .id = BUS_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current bus maximum frequency", }, - { .id = BUS_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available bus minimum frequency", }, - { .id = BUS_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available bus maximum frequency", }, - { .id = BUS_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "BUS_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current bus frequency governor name", }, + { .id = BUS_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "BUS_ATTR_NAME", .unit = "", .desc = "Bus device name", }, + { .id = BUS_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current bus frequency", }, + { .id = BUS_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current bus minimum frequency", }, + { .id = BUS_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current bus maximum frequency", }, + { .id = BUS_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available bus minimum frequency", }, + { .id = BUS_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "BUS_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available bus maximum frequency", }, + { .id = BUS_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "BUS_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current bus frequency governor name", }, }; static struct resource_attr_data gpu_attrs[] = { - { .id = GPU_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "GPU_ATTR_NAME", .unit = "", .desc = "GPU device name", }, - { .id = GPU_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current GPU frequency", }, - { .id = GPU_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current GPU minimum frequency", }, - { .id = GPU_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current GPU maximum frequency", }, - { .id = GPU_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available GPU minimum frequency", }, - { .id = GPU_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available GPU maximum frequency", }, - { .id = GPU_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "GPU_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current GPU frequency governor name", }, + { .id = GPU_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "GPU_ATTR_NAME", .unit = "", .desc = "GPU device name", }, + { .id = GPU_ATTR_CUR_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_CUR_FREQ", .unit = "kHz", .desc = "Current GPU frequency", }, + { .id = GPU_ATTR_MIN_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_MIN_FREQ", .unit = "kHz", .desc = "Current GPU minimum frequency", }, + { .id = GPU_ATTR_MAX_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_MAX_FREQ", .unit = "kHz", .desc = "Current GPU maximum frequency", }, + { .id = GPU_ATTR_AVAILABLE_MIN_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_AVAILABLE_MIN_FREQ", .unit = "kHz", .desc = "Available GPU minimum frequency", }, + { .id = GPU_ATTR_AVAILABLE_MAX_FREQ, .type = DATA_TYPE_INT, .name = "GPU_ATTR_AVAILABLE_MAX_FREQ", .unit = "kHz", .desc = "Available GPU maximum frequency", }, + { .id = GPU_ATTR_CUR_GOVERNOR, .type = DATA_TYPE_STRING, .name = "GPU_ATTR_CUR_GOVERNOR", .unit = "", .desc = "Current GPU frequency governor name", }, }; static struct resource_attr_data memory_attrs[] = { - { .id = MEMORY_ATTR_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_TOTAL", .unit = "byte", .desc = "Memory total size", }, - { .id = MEMORY_ATTR_AVAILABLE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_AVAILABLE", .unit = "byte", .desc = "Memory available size", }, - { .id = MEMORY_ATTR_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_FREE", .unit = "byte", .desc = "Memory free size", }, - { .id = MEMORY_ATTR_BUFFER, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_BUFFER", .unit = "byte", .desc = "Memorry buffer size", }, - { .id = MEMORY_ATTR_CACHED, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CACHED", .unit = "byte", .desc = "Memory cached size", }, - { .id = MEMORY_ATTR_CMA_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CMA_TOTAL", .unit = "byte", .desc = "CMA memory total size", }, - { .id = MEMORY_ATTR_CMA_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CMA_FREE", .unit = "byte", .desc = "CMA memory free size", }, - { .id = MEMORY_ATTR_SWAP_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_SWAP_TOTAL", .unit = "byte", .desc = "Swap memory total size", }, - { .id = MEMORY_ATTR_SWAP_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_SWAP_FREE", .unit = "byte", .desc = "Swap memory free size", }, + { .id = MEMORY_ATTR_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_TOTAL", .unit = "kB", .desc = "Memory total size", }, + { .id = MEMORY_ATTR_AVAILABLE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_AVAILABLE", .unit = "kB", .desc = "Memory available size", }, + { .id = MEMORY_ATTR_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_FREE", .unit = "kB", .desc = "Memory free size", }, + { .id = MEMORY_ATTR_BUFFER, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_BUFFER", .unit = "kB", .desc = "Memorry buffer size", }, + { .id = MEMORY_ATTR_CACHED, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CACHED", .unit = "kB", .desc = "Memory cached size", }, + { .id = MEMORY_ATTR_CMA_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CMA_TOTAL", .unit = "kB", .desc = "CMA memory total size", }, + { .id = MEMORY_ATTR_CMA_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_CMA_FREE", .unit = "kB", .desc = "CMA memory free size", }, + { .id = MEMORY_ATTR_SWAP_TOTAL, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_SWAP_TOTAL", .unit = "kB", .desc = "Swap memory total size", }, + { .id = MEMORY_ATTR_SWAP_FREE, .type = DATA_TYPE_UINT64, .name = "MEMORY_ATTR_SWAP_FREE", .unit = "kB", .desc = "Swap memory free size", }, }; static struct resource_attr_data battery_attrs[] = { - { .id = BATTERY_ATTR_CAPACITY, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_CAPACITY", .unit = "%", .desc = "Battery capacity", }, - { .id = BATTERY_ATTR_STATUS, .type = DATA_TYPE_STRING, .name = "BATTERY_ATTR_STATUS", .unit = "", .desc = "Battery status", }, - { .id = BATTERY_ATTR_TEMPERATURE, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_TEMPERATURE", .unit = "", .desc = "Battery temperature", }, - { .id = BATTERY_ATTR_VOLTAGE_NOW, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_VOLTAGE_NOW", .unit = "uV", .desc = "Battery voltage figure", }, - { .id = BATTERY_ATTR_CURRENT_NOW, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_CURRENT_NOW", .unit = "uA", .desc = "Battery current figure", }, - { .id = BATTERY_ATTR_PRESENT, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_PRESENT", .unit = "", .desc = "Battery connected status", }, + { .id = BATTERY_ATTR_CAPACITY, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_CAPACITY", .unit = "%", .desc = "Battery capacity", }, + { .id = BATTERY_ATTR_STATUS, .type = DATA_TYPE_STRING, .name = "BATTERY_ATTR_STATUS", .unit = "", .desc = "Battery status", }, + { .id = BATTERY_ATTR_TEMPERATURE, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_TEMPERATURE", .unit = "", .desc = "Battery temperature", }, + { .id = BATTERY_ATTR_VOLTAGE_NOW, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_VOLTAGE_NOW", .unit = "uV", .desc = "Battery voltage figure", }, + { .id = BATTERY_ATTR_CURRENT_NOW, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_CURRENT_NOW", .unit = "uA", .desc = "Battery current figure", }, + { .id = BATTERY_ATTR_PRESENT, .type = DATA_TYPE_INT, .name = "BATTERY_ATTR_PRESENT", .unit = "", .desc = "Battery connected status", }, }; static struct resource_attr_data display_attrs[] = { - { .id = DISPLAY_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "DISPLAY_ATTR_NAME", .unit = "", .desc = "Display device name", }, - { .id = DISPLAY_ATTR_FPS, .type = DATA_TYPE_DOUBLE, .name = "DISPLAY_ATTR_FPS", .unit = "fps", .desc = "Frame per second", }, + { .id = DISPLAY_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "DISPLAY_ATTR_NAME", .unit = "", .desc = "Display device name", }, + { .id = DISPLAY_ATTR_FPS, .type = DATA_TYPE_DOUBLE, .name = "DISPLAY_ATTR_FPS", .unit = "fps", .desc = "Frame per second", }, }; static struct resource_attr_data system_attrs[] = { - { .id = SYSTEM_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_UTIL", .unit = "%", .desc = "CPU average utilization", }, - { .id = SYSTEM_ATTR_CPU_USER_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_USER_UTIL", .unit = "%", .desc = "CPU average utilization on user", }, - { .id = SYSTEM_ATTR_CPU_SYS_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_SYS_UTIL", .unit = "%", .desc = "CPU average utilization on system", }, - { .id = SYSTEM_ATTR_PER_CPU_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_UTIL", .unit = "%", .desc = "Per-CPU utilization", .array_type = DATA_TYPE_DOUBLE, }, - { .id = SYSTEM_ATTR_PER_CPU_USER_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_USER_UTIL", .unit = "%", .desc = "Per-CPU utilization on user", .array_type = DATA_TYPE_DOUBLE, }, - { .id = SYSTEM_ATTR_PER_CPU_SYS_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_SYS_UTIL", .unit = "%", .desc = "Per-CPU utilization on system", .array_type = DATA_TYPE_DOUBLE, }, - { .id = SYSTEM_ATTR_POSSIBLE_CPU, .type = DATA_TYPE_INT, .name = "SYSTEM_ATTR_POSSIBLE_CPU", .unit = "ea", .desc = "Number of possible CPU", }, - { .id = SYSTEM_ATTR_ONLINE_CPU, .type = DATA_TYPE_INT, .name = "SYSTEM_ATTR_ONLINE_CPU", .unit = "ea", .desc = "Number of online CPU", }, + { .id = SYSTEM_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_UTIL", .unit = "%", .desc = "CPU average utilization", }, + { .id = SYSTEM_ATTR_CPU_USER_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_USER_UTIL", .unit = "%", .desc = "CPU average utilization on user", }, + { .id = SYSTEM_ATTR_CPU_SYS_UTIL, .type = DATA_TYPE_DOUBLE, .name = "SYSTEM_ATTR_CPU_SYS_UTIL", .unit = "%", .desc = "CPU average utilization on system", }, + { .id = SYSTEM_ATTR_PER_CPU_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_UTIL", .unit = "%", .desc = "Per-CPU utilization", .array_type = DATA_TYPE_DOUBLE, }, + { .id = SYSTEM_ATTR_PER_CPU_USER_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_USER_UTIL", .unit = "%", .desc = "Per-CPU utilization on user", .array_type = DATA_TYPE_DOUBLE, }, + { .id = SYSTEM_ATTR_PER_CPU_SYS_UTIL, .type = DATA_TYPE_ARRAY, .name = "SYSTEM_ATTR_PER_CPU_SYS_UTIL", .unit = "%", .desc = "Per-CPU utilization on system", .array_type = DATA_TYPE_DOUBLE, }, + { .id = SYSTEM_ATTR_POSSIBLE_CPU, .type = DATA_TYPE_INT, .name = "SYSTEM_ATTR_POSSIBLE_CPU", .unit = "ea", .desc = "Number of possible CPU", }, + { .id = SYSTEM_ATTR_ONLINE_CPU, .type = DATA_TYPE_INT, .name = "SYSTEM_ATTR_ONLINE_CPU", .unit = "ea", .desc = "Number of online CPU", }, }; struct resource_attr_data process_attrs[] = { - { .id = PROCESS_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "PROCESS_ATTR_NAME", .unit = "", .desc = "Process name", }, - { .id = PROCESS_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_CPU_UTIL", .unit = "%", .desc = "Process CPU utilization", }, - { .id = PROCESS_ATTR_MEM_VIRT, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_VIRT", .unit = "byte", .desc = "Process VIRT memory size", }, - { .id = PROCESS_ATTR_MEM_RSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_RSS", .unit = "byte", .desc = "Process RSS(Resident Set Size) memory size", }, - { .id = PROCESS_ATTR_MEM_RSS_PERCENT, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_MEM_RSS_PERCENT", .unit = "%", .desc = "Process RSS(Resident Set Size) memory percent", }, - { .id = PROCESS_ATTR_DISK_READ_BPS, .type = DATA_TYPE_UINT, .name = "PROCESS_ATTR_DISK_READ_BPS", .unit = "b/s", .desc = "Process disk read per second", }, - { .id = PROCESS_ATTR_DISK_WRITE_BPS, .type = DATA_TYPE_UINT, .name = "PROCESS_ATTR_DISK_WRITE_BPS", .unit = "b/s", .desc = "Process disk write per second", }, - { .id = PROCESS_ATTR_PGID, .type = DATA_TYPE_INT, .name = "PROCESS_ATTR_PGID", .unit = "", .desc = "Process group ID", }, - { .id = PROCESS_ATTR_PPID, .type = DATA_TYPE_INT, .name = "PROCESS_ATTR_PPID", .unit = "", .desc = "Process parent PID(Process ID)", }, - { .id = PROCESS_ATTR_MEM_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_PSS", .unit = "byte", .desc = "Process PSS(Propotional Set Size) memory size", }, - { .id = PROCESS_ATTR_MEM_SWAP, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_SWAP", .unit = "byte", .desc = "Process Swap memory size", }, - { .id = PROCESS_ATTR_MEM_SWAP_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_SWAP_PSS", .unit = "byte", .desc = "Process Swap PSS(Propotional Set Size) memory size", }, - { .id = PROCESS_ATTR_MEM_GPU, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_GPU", .unit = "byte", .desc = "Process GPU memory size", }, + { .id = PROCESS_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "PROCESS_ATTR_NAME", .unit = "", .desc = "Process name", }, + { .id = PROCESS_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_CPU_UTIL", .unit = "%", .desc = "Process CPU utilization", }, + { .id = PROCESS_ATTR_MEM_VIRT, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_VIRT", .unit = "kB", .desc = "Process VIRT memory size", }, + { .id = PROCESS_ATTR_MEM_RSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_RSS", .unit = "kB", .desc = "Process RSS(Resident Set Size) memory size", }, + { .id = PROCESS_ATTR_MEM_RSS_PERCENT, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_MEM_RSS_PERCENT", .unit = "%", .desc = "Process RSS(Resident Set Size) memory percent", }, + { .id = PROCESS_ATTR_DISK_READ_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_DISK_READ_PER_SEC", .unit = "kB/s", .desc = "Process disk read per second", }, + { .id = PROCESS_ATTR_DISK_WRITE_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_ATTR_DISK_WRITE_PER_SEC", .unit = "kB/s", .desc = "Process disk write per second", }, + { .id = PROCESS_ATTR_PGID, .type = DATA_TYPE_INT, .name = "PROCESS_ATTR_PGID", .unit = "", .desc = "Process group ID", }, + { .id = PROCESS_ATTR_PPID, .type = DATA_TYPE_INT, .name = "PROCESS_ATTR_PPID", .unit = "", .desc = "Process parent PID(Process ID)", }, + { .id = PROCESS_ATTR_MEM_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_PSS", .unit = "kB", .desc = "Process PSS(Propotional Set Size) memory size", }, + { .id = PROCESS_ATTR_MEM_SWAP, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_SWAP", .unit = "kB", .desc = "Process Swap memory size", }, + { .id = PROCESS_ATTR_MEM_SWAP_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_SWAP_PSS", .unit = "kB", .desc = "Process Swap PSS(Propotional Set Size) memory size", }, + { .id = PROCESS_ATTR_MEM_GPU, .type = DATA_TYPE_UINT64, .name = "PROCESS_ATTR_MEM_GPU", .unit = "kB", .desc = "Process GPU memory size", }, }; struct resource_attr_data process_group_attrs[] = { - { .id = PROCESS_GROUP_ATTR_PID_LIST, .type = DATA_TYPE_ARRAY, .name = "PROCESS_GROUP_ATTR_PID_LIST", .unit = "", .desc = "Process-group PID(Process ID) list", .array_type = DATA_TYPE_INT, }, - { .id = PROCESS_GROUP_ATTR_NAME_LIST, .type = DATA_TYPE_ARRAY, .name = "PROCESS_GROUP_ATTR_NAME_LIST", .unit = "", .desc = "Process-group name list", .array_type = DATA_TYPE_STRING, }, - { .id = PROCESS_GROUP_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_GROUP_ATTR_CPU_UTIL", .unit = "%", .desc = "Process-group CPU utilization", }, - { .id = PROCESS_GROUP_ATTR_DISK_READ_BPS, .type = DATA_TYPE_UINT, .name = "PROCESS_GROUP_ATTR_DISK_READ_BPS", .unit = "b/s", .desc = "Process-group disk read per second", }, - { .id = PROCESS_GROUP_ATTR_DISK_WRITE_BPS, .type = DATA_TYPE_UINT, .name = "PROCESS_GROUP_ATTR_DISK_WRITE_BPS", .unit = "b/s", .desc = "Process-group disk write per second", }, - { .id = PROCESS_GROUP_ATTR_MEM_VIRT, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_VIRT", .unit = "byte", .desc = "Process-group VIRT memory size", }, - { .id = PROCESS_GROUP_ATTR_MEM_RSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_RSS", .unit = "byte", .desc = "Process-group RSS(Resident Set Size) memory size", }, - { .id = PROCESS_GROUP_ATTR_MEM_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_PSS", .unit = "byte", .desc = "Process-group PSS(Propotional Set Size) memory size", }, - { .id = PROCESS_GROUP_ATTR_MEM_SWAP, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_SWAP", .unit = "byte", .desc = "Process-group Swap memory size", }, - { .id = PROCESS_GROUP_ATTR_MEM_SWAP_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_SWAP_PSS", .unit = "byte", .desc = "Process-group Swap PSS(Propotional Set Size) memory size", }, - { .id = PROCESS_GROUP_ATTR_MEM_GPU, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_GPU", .unit = "byte", .desc = "Process-group GPU memory size", }, + { .id = PROCESS_GROUP_ATTR_PID_LIST, .type = DATA_TYPE_ARRAY, .name = "PROCESS_GROUP_ATTR_PID_LIST", .unit = "", .desc = "Process-group PID(Process ID) list", .array_type = DATA_TYPE_INT, }, + { .id = PROCESS_GROUP_ATTR_NAME_LIST, .type = DATA_TYPE_ARRAY, .name = "PROCESS_GROUP_ATTR_NAME_LIST", .unit = "", .desc = "Process-group name list", .array_type = DATA_TYPE_STRING, }, + { .id = PROCESS_GROUP_ATTR_CPU_UTIL, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_GROUP_ATTR_CPU_UTIL", .unit = "%", .desc = "Process-group CPU utilization", }, + { .id = PROCESS_GROUP_ATTR_DISK_READ_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_GROUP_ATTR_DISK_READ_PER_SEC", .unit = "kB/s", .desc = "Process-group disk read per second", }, + { .id = PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "PROCESS_GROUP_ATTR_DISK_WRITE_PER_SEC", .unit = "kB/s", .desc = "Process-group disk write per second", }, + { .id = PROCESS_GROUP_ATTR_MEM_VIRT, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_VIRT", .unit = "kB", .desc = "Process-group VIRT memory size", }, + { .id = PROCESS_GROUP_ATTR_MEM_RSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_RSS", .unit = "kB", .desc = "Process-group RSS(Resident Set Size) memory size", }, + { .id = PROCESS_GROUP_ATTR_MEM_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_PSS", .unit = "kB", .desc = "Process-group PSS(Propotional Set Size) memory size", }, + { .id = PROCESS_GROUP_ATTR_MEM_SWAP, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_SWAP", .unit = "kB", .desc = "Process-group Swap memory size", }, + { .id = PROCESS_GROUP_ATTR_MEM_SWAP_PSS, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_SWAP_PSS", .unit = "kB", .desc = "Process-group Swap PSS(Propotional Set Size) memory size", }, + { .id = PROCESS_GROUP_ATTR_MEM_GPU, .type = DATA_TYPE_UINT64, .name = "PROCESS_GROUP_ATTR_MEM_GPU", .unit = "kB", .desc = "Process-group GPU memory size", }, }; struct resource_attr_data disk_attrs[] = { - { .id = DISK_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "DISK_ATTR_NAME", .unit = "", .desc = "Disk device name", }, - { .id = DISK_ATTR_READ_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "DISK_ATTR_READ_PER_SEC", .unit = "kB/s", .desc = "Disk read per second", }, - { .id = DISK_ATTR_WRITE_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "DISK_ATTR_WRITE_PER_SEC", .unit = "kB/s", .desc = "Disk write per second", }, - { .id = DISK_ATTR_READ_TOTAL, .type = DATA_TYPE_UINT64, .name = "DISK_ATTR_READ_TOTAL", .unit = "kB", .desc = "Disk read total size", }, - { .id = DISK_ATTR_WRITE_TOTAL, .type = DATA_TYPE_UINT64, .name = "DISK_ATTR_WRITE_TOTAL", .unit = "kB", .desc = "Disk write total size", }, + { .id = DISK_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "DISK_ATTR_NAME", .unit = "", .desc = "Disk device name", }, + { .id = DISK_ATTR_READ_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "DISK_ATTR_READ_PER_SEC", .unit = "kB/s", .desc = "Disk read per second", }, + { .id = DISK_ATTR_WRITE_PER_SEC, .type = DATA_TYPE_DOUBLE, .name = "DISK_ATTR_WRITE_PER_SEC", .unit = "kB/s", .desc = "Disk write per second", }, + { .id = DISK_ATTR_READ_TOTAL, .type = DATA_TYPE_UINT64, .name = "DISK_ATTR_READ_TOTAL", .unit = "kB", .desc = "Disk read total size", }, + { .id = DISK_ATTR_WRITE_TOTAL, .type = DATA_TYPE_UINT64, .name = "DISK_ATTR_WRITE_TOTAL", .unit = "kB", .desc = "Disk write total size", }, }; struct resource_attr_data network_attrs[] = { - { .id = NETWORK_ATTR_NAME, .type =DATA_TYPE_STRING, .name = "NETWORK_ATTR_NAME", .unit = "", .desc = "Network device name", }, + { .id = NETWORK_ATTR_NAME, .type = DATA_TYPE_STRING, .name = "NETWORK_ATTR_NAME", .unit = "", .desc = "Network device name", }, }; struct resource_data {