add debug code

This commit is contained in:
Fabian Posch 2025-01-03 12:56:21 +01:00
parent 127074f85e
commit af9343ac49

View file

@ -23,6 +23,7 @@
************************************************************************** **************************************************************************
*/ */
#include "util.h"
#include <cstdio> #include <cstdio>
#include "task_interface.hpp" #include "task_interface.hpp"
@ -41,6 +42,8 @@ TaskInterface::~TaskInterface() {
void TaskInterface::push_fresh(std::unique_ptr<InputType> task) { void TaskInterface::push_fresh(std::unique_ptr<InputType> task) {
DEBUG_PRINT("New task in the queue!");
// lock the queue and insert into it // lock the queue and insert into it
std::lock_guard<std::mutex> lock(this->fresh_queue_mutex); std::lock_guard<std::mutex> lock(this->fresh_queue_mutex);
this->fresh_queue.push(std::move(task)); this->fresh_queue.push(std::move(task));
@ -86,6 +89,8 @@ void TaskInterface::wait_for_fresh() {
// we will be notified either when there is new data or the program has been stopped // we will be notified either when there is new data or the program has been stopped
this->fresh_queue_empty_condition.wait(lock, [&] { return !this->fresh_queue_empty() || !running(); }); this->fresh_queue_empty_condition.wait(lock, [&] { return !this->fresh_queue_empty() || !running(); });
DEBUG_PRINT("Worker released from block");
} }
void TaskInterface::wait_for_finished() { void TaskInterface::wait_for_finished() {
@ -265,7 +270,7 @@ std::shared_ptr<pl::SimOutputArtifact> TaskInterface::get_reference(const db::uu
void TaskInterface::store_reference(const db::uuid_t& id, std::shared_ptr<pl::SimOutputArtifact> reference) { void TaskInterface::store_reference(const db::uuid_t& id, std::shared_ptr<pl::SimOutputArtifact> reference) {
std::lock_guard<std::mutex> lock (this->references_mutex); std::lock_guard<std::mutex> lock (this->references_mutex);
DEBUG_PRINT("Storing new design with ID " + db::to_string(id)); DEBUG_PRINT("Storing new reference with ID " + db::to_string(id));
// make sure the reference run isn't already in the list of reference runs // make sure the reference run isn't already in the list of reference runs
// if it is, just increment its reference counter // if it is, just increment its reference counter