Skip to content

Commit

Permalink
#57 Add process commands to per-process frequency collision error mes…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
MatejKafka committed Sep 10, 2021
1 parent 7e89ae5 commit 072ac9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/power_policy/imx8_per_process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,21 @@ class PowerPolicy_Imx8_PerProcess : public PmPowerPolicy
locking_processes[0]->requested_frequencies[i] != requested_freq) {
throw std::runtime_error(
fmt::format("Scheduled processes require different frequencies on the CPU "
"cluster '#{}': '{}', '{}'",
"cluster '#{}': '{}', '{}' (process 1: '{}', process 2: '{}')",
i,
locking_processes[0]->requested_frequencies[i].value(),
requested_freq.value()));
requested_freq.value(),
locking_processes[0]->argv,
proc.argv));
}
locking_processes.push_back(&proc);
policy.write_frequency(requested_freq.value());
}
}
}

void on_process_end(Process &process) override {
void on_process_end(Process &process) override
{
// remove the process from the list of locking processes
for (auto &lp : locking_process_for_policy) {
for (auto it = lp.begin(); it != lp.end(); it++) {
Expand Down
2 changes: 1 addition & 1 deletion src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Process::Process(ev::loop_ref loop,
bool has_initialization)
: part(partition)
, requested_frequencies{ a53_freq, a72_freq }
, argv(std::move(argv))
// budget +- (jitter / 2)
, jitter_distribution_ms(-budget_jitter.count() / 2,
budget_jitter.count() - budget_jitter.count() / 2)
Expand All @@ -38,7 +39,6 @@ Process::Process(ev::loop_ref loop,
name,
std::bind(&Process::populated_cb, this, _1)) // NOLINT(modernize-avoid-bind)
, cgf(partition.cgf, name)
, argv(std::move(argv))
, working_dir(std::move(working_dir))
, budget(budget)
, actual_budget(budget)
Expand Down
6 changes: 3 additions & 3 deletions src/process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include <fcntl.h>
#include <filesystem>
#include <iostream>
#include <random>
#include <unistd.h>
#include <vector>
#include <random>

#include "cgroup.hpp"
#include "cpufreq_policy.hpp"
#include "evfd.hpp"
#include "timerfd.hpp"
#include "cpufreq_policy.hpp"

class Partition;

Expand Down Expand Up @@ -81,6 +81,7 @@ class Process

Partition &part;
const std::array<std::optional<CpuFrequencyHz>, 2> requested_frequencies;
const std::string argv;

private:
std::uniform_int_distribution<long> jitter_distribution_ms;
Expand All @@ -93,7 +94,6 @@ class Process
CgroupEvents cge;
CgroupFreezer cgf;

const std::string argv;
const std::optional<std::filesystem::path> working_dir;
const std::chrono::milliseconds budget;
std::chrono::milliseconds actual_budget;
Expand Down

0 comments on commit 072ac9a

Please sign in to comment.