aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-03-21 11:45:16 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-03-21 11:45:16 +0000
commit2ec354024a508eebc43c078d5339da6833b2ea5e (patch)
tree21daddd7dc0a962dfdf97e7d7049e1fb782391b1
parent8e8906f6945c022de9056bc6c84bbf2294261074 (diff)
parent70b969d89efa4d48644781ee79e10c301e3078e2 (diff)
downloaddittosuite-2ec354024a508eebc43c078d5339da6833b2ea5e.tar.gz
Merge "Use name instead of instruction id for spawned tasks" into main
-rw-r--r--src/instruction_factory.cpp6
-rw-r--r--src/multiprocessing.cpp4
-rw-r--r--src/multithreading.cpp3
3 files changed, 8 insertions, 5 deletions
diff --git a/src/instruction_factory.cpp b/src/instruction_factory.cpp
index 1ac4433..3112995 100644
--- a/src/instruction_factory.cpp
+++ b/src/instruction_factory.cpp
@@ -206,7 +206,9 @@ std::unique_ptr<Instruction> InstructionFactory::CreateFromProtoInstruction(
std::vector<MultithreadingParams> thread_params;
std::vector<std::unique_ptr<Instruction>> instructions;
- for (const auto& thread : options.threads()) {
+
+ for (int t = 0; t < options.threads().size(); t++) {
+ const auto& thread = options.threads()[t];
for (int i = 0; i < thread.spawn(); i++) {
auto thread_ids_copy = thread_ids;
thread_ids_copy.push_back(InstructionFactory::GenerateThreadId());
@@ -217,7 +219,7 @@ std::unique_ptr<Instruction> InstructionFactory::CreateFromProtoInstruction(
if (thread.has_name()) {
thread_name = thread.name() + "_" + std::to_string(i);
} else {
- thread_name = std::to_string(i);
+ thread_name = std::to_string(t) + "_" + std::to_string(i);
}
SchedAttr sched_attr(Syscall::GetSyscall());
diff --git a/src/multiprocessing.cpp b/src/multiprocessing.cpp
index 0b37b7a..6ab589f 100644
--- a/src/multiprocessing.cpp
+++ b/src/multiprocessing.cpp
@@ -179,8 +179,8 @@ std::unique_ptr<Result> Multiprocessing::CollectResults(const std::string& prefi
}
} else {
LOGD("Child writing... " + std::to_string(getpid()));
- result->AddSubResult(
- instructions_[instruction_id_]->CollectResults(std::to_string(instruction_id_) + "/"));
+ std::string child_name = thread_params_[instruction_id_].name_;
+ result->AddSubResult(instructions_[instruction_id_]->CollectResults(child_name + "/"));
result_pb = result->ToPb();
diff --git a/src/multithreading.cpp b/src/multithreading.cpp
index b696d5e..3f685dd 100644
--- a/src/multithreading.cpp
+++ b/src/multithreading.cpp
@@ -56,7 +56,8 @@ std::unique_ptr<Result> Multithreading::CollectResults(const std::string& prefix
auto result = std::make_unique<Result>(prefix + name_, repeat_);
result->AddMeasurement("duration", TimespecToDoubleNanos(time_sampler_.GetSamples()));
for (std::size_t i = 0; i < instructions_.size(); ++i) {
- result->AddSubResult(instructions_[i]->CollectResults(std::to_string(i) + "/"));
+ std::string child_name = thread_params_[i].name_;
+ result->AddSubResult(instructions_[i]->CollectResults(child_name + "/"));
}
return result;
}