Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2307e47e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "libprocessgroup: Remove SetClamps action" into main

parents b3c9db48 2a030efe
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
@@ -571,33 +571,6 @@
      ]
    },

    {
      "Name": "PerfBoost",
      "Actions": [
        {
          "Name": "SetClamps",
          "Params":
          {
            "Boost": "50%",
            "Clamp": "0"
          }
        }
      ]
    },
    {
      "Name": "PerfClamp",
      "Actions": [
        {
          "Name": "SetClamps",
          "Params":
          {
            "Boost": "0",
            "Clamp": "30%"
          }
        }
      ]
    },

    {
      "Name": "LowMemoryUsage",
      "Actions": [
+0 −29
Original line number Diff line number Diff line
@@ -188,18 +188,6 @@ bool ProfileAttribute::GetPathForUID(uid_t uid, std::string* path) const {
    return true;
}

bool SetClampsAction::ExecuteForProcess(uid_t, pid_t) const {
    // TODO: add support when kernel supports util_clamp
    LOG(WARNING) << "SetClampsAction::ExecuteForProcess is not supported";
    return false;
}

bool SetClampsAction::ExecuteForTask(int) const {
    // TODO: add support when kernel supports util_clamp
    LOG(WARNING) << "SetClampsAction::ExecuteForTask is not supported";
    return false;
}

// To avoid issues in sdk_mac build
#if defined(__ANDROID__)

@@ -958,23 +946,6 @@ bool TaskProfiles::Load(const CgroupMap& cg_map, const std::string& file_name) {
                } else {
                    LOG(WARNING) << "SetAttribute: unknown attribute: " << attr_name;
                }
            } else if (action_name == "SetClamps") {
                std::string boost_value = params_val["Boost"].asString();
                std::string clamp_value = params_val["Clamp"].asString();
                char* end;
                unsigned long boost;

                boost = strtoul(boost_value.c_str(), &end, 10);
                if (end > boost_value.c_str()) {
                    unsigned long clamp = strtoul(clamp_value.c_str(), &end, 10);
                    if (end > clamp_value.c_str()) {
                        profile->Add(std::make_unique<SetClampsAction>(boost, clamp));
                    } else {
                        LOG(WARNING) << "SetClamps: invalid parameter " << clamp_value;
                    }
                } else {
                    LOG(WARNING) << "SetClamps: invalid parameter: " << boost_value;
                }
            } else if (action_name == "WriteFile") {
                std::string attr_filepath = params_val["FilePath"].asString();
                std::string attr_procfilepath = params_val["ProcFilePath"].asString();
+0 −13
Original line number Diff line number Diff line
@@ -91,19 +91,6 @@ class ProfileAction {
};

// Profile actions
class SetClampsAction : public ProfileAction {
  public:
    SetClampsAction(int boost, int clamp) noexcept : boost_(boost), clamp_(clamp) {}

    const char* Name() const override { return "SetClamps"; }
    bool ExecuteForProcess(uid_t uid, pid_t pid) const override;
    bool ExecuteForTask(pid_t tid) const override;

  protected:
    int boost_;
    int clamp_;
};

class SetTimerSlackAction : public ProfileAction {
  public:
    SetTimerSlackAction(unsigned long slack) noexcept : slack_(slack) {}