Skip to content

Commit

Permalink
Add new isolate meta values
Browse files Browse the repository at this point in the history
  • Loading branch information
SemaiCZE committed Mar 29, 2018
1 parent 0f827e2 commit 6ea8a0f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/config/task_results.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,23 @@ struct sandbox_results {
* Default: ""
*/
std::string message;
/**
* Number of voluntary context switches.
* Default: 0
*/
size_t csw_voluntary;
/**
* Number of forced context switches.
* Default: 0
*/
size_t csw_forced;

/**
* Constructor with default values initialization.
*/
sandbox_results()
: exitcode(0), time(0), wall_time(0), memory(0), max_rss(0), status(isolate_status::OK), exitsig(0),
killed(false), message()
killed(false), message(), csw_voluntary(0), csw_forced(0)
{
}

Expand Down
2 changes: 2 additions & 0 deletions src/job/job_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ void job_evaluator::push_result()
subnode["exitsig"] = sandbox->exitsig;
subnode["killed"] = sandbox->killed;
subnode["message"] = sandbox->message;
subnode["csw-voluntary"] = sandbox->csw_voluntary;
subnode["csw-forced"] = sandbox->csw_forced;

node["sandbox_results"] = subnode;
}
Expand Down
4 changes: 4 additions & 0 deletions src/sandbox/isolate_sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ sandbox_results isolate_sandbox::process_meta_file()
results.memory = std::stoul(second);
} else if (first == "max-rss") {
results.max_rss = std::stoul(second);
} else if (first == "csw-voluntary") {
results.csw_voluntary = std::stoul(second);
} else if (first == "csw-forced") {
results.csw_forced = std::stoul(second);
}
}
return results;
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/external_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::shared_ptr<task_results> external_task::run()
// check if binary is executable and set it otherwise
make_binary_executable(task_meta_->binary);

std::shared_ptr<task_results> res(new task_results());
auto res = std::make_shared<task_results>();
res->sandbox_status =
std::unique_ptr<sandbox_results>(new sandbox_results(sandbox_->run(task_meta_->binary, task_meta_->cmd_args)));

Expand Down

0 comments on commit 6ea8a0f

Please sign in to comment.