コード例 #1
0
/*
 * 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);
    }
}
コード例 #2
0
ファイル: numa_node.cpp プロジェクト: jbarber/torque
/*
 * 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);
    }
  }