/* * get_cpuinfo() * opens the path to populate internal cpu values * * @pre-cond: path must be a valid string pointer * @post-cond: internal values for cpus are populated */ void numa_node::get_cpuinfo( const char *path) { if (path == NULL) return; std::string line; std::ifstream myfile(path); if (myfile.is_open()) { getline(myfile, line); /* format int[-int][,int[-int]...] */ parse_cpu_string(line); } }
/* * get_cpuinfo() * opens the path to populate internal cpu values * * @pre-cond: path must be a valid string pointer * @post-cond: internal values for cpus are populated */ void numa_node::get_cpuinfo( const char *path) { if (path == NULL) return; unsigned int total_cpus; unsigned long total_memory; unsigned long available_memory; unsigned int available_cpus; std::string line; std::ifstream myfile(path); if (myfile.is_open()) { getline(myfile, line); /* format int[-int][,int[-int]...] */ parse_cpu_string(line); } }