src/linux_parser.cpp
// TODO: Read and return the number of idle jiffies for the system
Read and return the number of idle jiffies for the system
Read and return the number of idle jiffies for the system
long LinuxParser::IdleJiffies() {
  std::string line;
  std::string cpu;
  long user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice;
  long idle_jiffies = 0;
  std::ifstream fileStream(kProcDirectory + kStatFilename);
  if(fileStream.is_open())
  {
    std::getline(fileStream,line);
    std::istringstream linestream(line);
    linestream >> cpu >> user >> nice >> system >> idle >> iowait >> irq >> softirq >> steal >> guest >> guest_nice;
    idle_jiffies = idle + iowait;
  }
  return idle_jiffies;
}
long LinuxParser :: IdleJiffies ( ) { std :: string line ; std :: string cpu ; long user , nice , system , idle , iowait , irq , softirq , steal , guest , guest_nice ; long idle_jiffies = 0 ; std :: ifstream fileStream ( kProcDirectory + kStatFilename ) ; if ( fileStream . is_open ( ) ) { std :: getline ( fileStream , line ) ; std :: istringstream linestream ( line ) ; linestream >> cpu >> user >> nice >> system >> idle >> iowait >> irq >> softirq >> steal >> guest >> guest_nice ; idle_jiffies = idle + iowait ; } return idle_jiffies ; }
TODO: Read and return the number of idle jiffies for the system
TODO : Read and return the number of idle jiffies for the system