u_int64_t mem_virt;
u_int32_t disk_rbps;
u_int32_t disk_wbps;
+ u_int64_t mem_pss;
+ u_int64_t mem_swap;
+ u_int64_t mem_swap_pss;
} info;
u_int64_t prev_total_time;
};
switch (attr->id) {
case PROCESS_GROUP_ATTR_MEM_RSS:
- {
*mem = ctx->info.mem_rss;
break;
- }
case PROCESS_GROUP_ATTR_MEM_VIRT:
- {
*mem = ctx->info.mem_virt;
break;
- }
+ case PROCESS_GROUP_ATTR_MEM_PSS:
+ *mem = ctx->info.mem_pss;
+ break;
+ case PROCESS_GROUP_ATTR_MEM_SWAP:
+ *mem = ctx->info.mem_swap;
+ break;
+ case PROCESS_GROUP_ATTR_MEM_SWAP_PSS:
+ *mem = ctx->info.mem_swap_pss;
+ break;
default:
return -EINVAL;
}
.get = process_group_get_pid_list,
.is_supported = resource_attr_supported_always,
},
- },
- {
+ }, {
.name = "PROCESS_GROUP_ATTR_COMM_LIST",
.id = PROCESS_GROUP_ATTR_COMM_LIST,
.type = DATA_TYPE_ARRAY,
.get = process_group_get_comm_list,
.is_supported = resource_attr_supported_always,
},
- },
- {
+ }, {
.name = "PROCESS_GROUP_ATTR_CPU_UTIL",
.id = PROCESS_GROUP_ATTR_CPU_UTIL,
.type = DATA_TYPE_DOUBLE,
.get = process_group_get_mem,
.is_supported = resource_attr_supported_always,
},
+ }, {
+ .name = "PROCESS_GROUP_ATTR_MEM_PSS",
+ .id = PROCESS_GROUP_ATTR_MEM_PSS,
+ .type = DATA_TYPE_UINT64,
+ .ops = {
+ .get = process_group_get_mem,
+ .is_supported = resource_attr_supported_always,
+ },
+ }, {
+ .name = "PROCESS_GROUP_ATTR_MEM_SWAP",
+ .id = PROCESS_GROUP_ATTR_MEM_SWAP,
+ .type = DATA_TYPE_UINT64,
+ .ops = {
+ .get = process_group_get_mem,
+ .is_supported = resource_attr_supported_always,
+ },
+ }, {
+ .name = "PROCESS_GROUP_ATTR_MEM_SWAP_PSS",
+ .id = PROCESS_GROUP_ATTR_MEM_SWAP_PSS,
+ .type = DATA_TYPE_UINT64,
+ .ops = {
+ .get = process_group_get_mem,
+ .is_supported = resource_attr_supported_always,
+ },
},
};
{
struct process_info_node *node;
struct taskstats *prev, *curr;
+ struct proc_map_info map_info;
u_int64_t total_time;
int online, nproc;
double cpu_period;
continue;
}
+ ret = kernel_get_thread_group_map_info(&map_info, pid);
+ if (ret < 0) {
+ free(curr);
+ g_hash_table_iter_remove(&iter);
+ continue;
+ }
+
if (cpu_period >= 1E-6) {
double util;
/ (curr->ac_etime - prev->ac_etime);
ctx->info.disk_wbps += ((curr->write_bytes - prev->write_bytes) * 1000000)
/ (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;
+
free(prev);
node->prev = curr;
}