aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/rusage.h
blob: 05d382b8caa1aae42f7855fbed7588dea73cbfd6 (plain) (blame)
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
#pragma once 

#include "defaults.h" 
#include <util/generic/utility.h>
#include <util/datetime/base.h>

/// portable getrusage

struct TRusage {
    // some fields may be zero if unsupported

    ui64 MaxRss = 0;
    ui64 MajorPageFaults = 0;
    TDuration Utime;
    TDuration Stime;

    void Fill();
 
    static size_t GetCurrentRSS();

    static TRusage Get() {
        TRusage r;
        r.Fill();
        return r;
    }
};