Ejemplo n.º 1
0
// Cpuacct
TError TCpuacctSubsystem::Usage(TCgroup &cg, uint64_t &value) const {
    std::string s;
    TError error = cg.Get("cpuacct.usage", s);
    if (error)
        return error;
    return StringToUint64(s, value);
}
Ejemplo n.º 2
0
// Freezer
TError TFreezerSubsystem::WaitState(TCgroup &cg, const std::string &state) const {
    uint64_t deadline = GetCurrentTimeMs() + config().daemon().freezer_wait_timeout_s() * 1000;
    std::string cur;
    TError error;

    do {
        error = cg.Get("freezer.state", cur);
        if (error || StringTrim(cur) == state)
            return error;
    } while (!WaitDeadline(deadline));

    return TError(EError::Unknown, "Freezer " + cg.Name + " timeout waiting " + state);
}
Ejemplo n.º 3
0
bool TFreezerSubsystem::IsFrozen(TCgroup &cg) const {
    std::string state;
    return !cg.Get("freezer.state", state) && StringTrim(state) != "THAWED";
}