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() { 
    string filepath = kProcDirectory + kStatFilename;
    std::ifstream file = GetStream(filepath);
    string key = "cpu";
    long sys_jiffies;
    string line;
    while(std::getline(file, line)) {
        if(line.compare(0, key.size(), key) == 0) {
            std::istringstream buf(line);
            std::istream_iterator<string> beg(buf), end;
            std::vector<string> values(beg, end);
            sys_jiffies = stol(values[3]);
            break;
        }
    }
    file.close();
    return sys_jiffies;
}
long LinuxParser :: Jiffies ( ) { string filepath = kProcDirectory + kStatFilename ; std :: ifstream file = GetStream ( filepath ) ; string key = " " ; long sys_jiffies ; string line ; while ( std :: getline ( file , line ) ) { if ( line . compare ( 0 , key . size ( ) , key ) == 0 ) { std :: istringstream buf ( line ) ; std :: istream_iterator < string > beg ( buf ) , end ; std :: vector < string > values ( beg , end ) ; sys_jiffies = stol ( values [ 3 ] ) ; break ; } } file . close ( ) ; return sys_jiffies ; }
Todo: Read and return the number of jiffies for the system
Todo : Read and return the number of jiffies for the system