Counter is a primitive to listen on events of a given memory pressure level for a cgroup and keep track of the number of occurrence of that event. Use the public 'create' function to create a new counter; see 'value' for how to use.
| 881 | // occurrence of that event. Use the public 'create' function to |
| 882 | // create a new counter; see 'value' for how to use. |
| 883 | class Counter |
| 884 | { |
| 885 | public: |
| 886 | // Create a memory pressure counter for the given cgroup on the |
| 887 | // specified level. This function assumes the given hierarchy and |
| 888 | // cgroup are valid. |
| 889 | static Try<process::Owned<Counter>> create( |
| 890 | const std::string& hierarchy, |
| 891 | const std::string& cgroup, |
| 892 | Level level); |
| 893 | |
| 894 | virtual ~Counter(); |
| 895 | |
| 896 | // Returns the current accumulated number of occurrences of the |
| 897 | // pressure event. Returns a failure if any error occurs while |
| 898 | // monitoring the pressure events, and any subsequent calls to |
| 899 | // 'value' will return the same failure. In such case, the user |
| 900 | // should consider creating a new Counter. |
| 901 | process::Future<uint64_t> value() const; |
| 902 | |
| 903 | private: |
| 904 | Counter(const std::string& hierarchy, |
| 905 | const std::string& cgroup, |
| 906 | Level level); |
| 907 | |
| 908 | process::Owned<CounterProcess> process; |
| 909 | }; |
| 910 | |
| 911 | } // namespace pressure { |
| 912 |
no outgoing calls
no test coverage detected