src/linux_parser.cpp
// TODO: Read and return the number of active jiffies for a PID
Read and return the number of active jiffies for a PID
Read and return the number of active jiffies for a PID
long LinuxParser::ActiveJiffies(int pid) {
  string line;
  string filePath = kProcDirectory + '/' + to_string(pid) + '/' + kStatFilename;
  std::ifstream filestream(filePath);
  if (filestream.is_open()) {
    while (std::getline(filestream, line)) {
      std::istringstream stringstream(line);
      std::vector<std::string> results(
          (std::istream_iterator<std::string>(stringstream)),
          std::istream_iterator<std::string>());
      return std::stol(results.at(22));  
    }
  }
  return 0;
}
long LinuxParser :: ActiveJiffies ( int pid ) { string line ; string filePath = kProcDirectory + ' ' + to_string ( pid ) + ' ' + kStatFilename ; std :: ifstream filestream ( filePath ) ; if ( filestream . is_open ( ) ) { while ( std :: getline ( filestream , line ) ) { std :: istringstream stringstream ( line ) ; std :: vector < std :: string > results ( ( std :: istream_iterator < std :: string > ( stringstream ) ) , std :: istream_iterator < std :: string > ( ) ) ; return std :: stol ( results . at ( 22 ) ) ; } } return 0 ; }
TODO: Read and return the number of active jiffies for a PID
TODO : Read and return the number of active jiffies for a PID
// /proc/[pid]/stat starttime 22th.