src/linux_parser.cpp
// TODO: Read and return the number of jiffies for the system
Read and return the number of jiffies for the system
Read and return the number of jiffies for the system
long LinuxParser::Jiffies() {
  std::string line;
  std::string cpu;
  long user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice;
  long 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;
    jiffies = user + nice + system + idle + iowait + irq + softirq + steal;
  }
  return jiffies;
}
long LinuxParser :: Jiffies ( ) { std :: string line ; std :: string cpu ; long user , nice , system , idle , iowait , irq , softirq , steal , guest , guest_nice ; long 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 ; jiffies = user + nice + system + idle + iowait + irq + softirq + steal ; } return jiffies ; }
TODO: Read and return the number of jiffies for the system
TODO : Read and return the number of jiffies for the system