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