File: systemFunctions.cpp

package info (click to toggle)
rna-star 2.7.11b%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,492 kB
  • sloc: cpp: 21,951; awk: 827; ansic: 457; makefile: 192; sh: 31
file content (27 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// system functions
#include <string>
#include <fstream>
#include <sstream>

std::string linuxProcMemory()
{
    std::ifstream t("/proc/self/status");
    std::stringstream buffer;
    buffer << t.rdbuf();


    std::string outString;
    while (buffer.good()) {
        std::string str1;
        std::getline(buffer,str1);
        if ( (str1.rfind("VmPeak",0) == 0) || 
             (str1.rfind("VmSize",0) == 0) ||
             (str1.rfind("VmHWM",0) == 0)  ||
             (str1.rfind("VmRSS",0) == 0) ) {
                 outString += str1+"; ";
             };
    };
    outString += '\n';

    return outString;
};