Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Track both times in execution
Browse files Browse the repository at this point in the history
  • Loading branch information
tyi1025 committed Jun 8, 2023
1 parent a397089 commit a4e752f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
18 changes: 12 additions & 6 deletions src/AlternatingVerificationExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "executors/AlternatingVerificationExecutor.hpp"

json AlternatingVerificationExecutor::execute(const VerificationTask& task) {
json result;
auto start = std::chrono::steady_clock::now();
json result;
auto const constructionStart = std::chrono::steady_clock::now();

auto qc1 = task.getQc1()->clone();
auto qc2 = task.getQc2()->clone();
Expand All @@ -12,13 +12,19 @@ json AlternatingVerificationExecutor::execute(const VerificationTask& task) {
equivalenceCheckingManager->disableAllCheckers();
equivalenceCheckingManager->setAlternatingChecker(true);

auto const executionStart = std::chrono::steady_clock::now();

equivalenceCheckingManager->run();
result["check_results"] = equivalenceCheckingManager->getResults().json();
// Add memory usage
auto stop = std::chrono::steady_clock::now();
auto runtime =
std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
result["runtime"] = runtime.count();
auto const executionStop = std::chrono::steady_clock::now();
auto const constructionTime =
std::chrono::duration_cast<std::chrono::microseconds>(executionStart -
constructionStart);
auto const execTime = std::chrono::duration_cast<std::chrono::microseconds>(
executionStop - executionStart);
result["construction_time"] = constructionTime.count();
result["execution_time"] = execTime.count();

result["executor"] = getIdentifier();
result["task"] = task.getIdentifier();
Expand Down
19 changes: 13 additions & 6 deletions src/CircuitSimulatorExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
#include "executors/CircuitSimulatorExecutor.hpp"

json CircuitSimulatorExecutor::execute(const SimulationTask& task) {
json result;
auto start = std::chrono::steady_clock::now();
json result;
auto const constructionStart = std::chrono::steady_clock::now();

auto qc = std::make_unique<qc::QuantumComputation>(task.getQc()->clone());
auto circuitSimulator = std::make_unique<CircuitSimulator<>>(std::move(qc));

auto const executionStart = std::chrono::steady_clock::now();

result["measurement_results"] = circuitSimulator->simulate(1024U);
// Add memory usage

auto stop = std::chrono::steady_clock::now();
auto const runtime =
std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
result["runtime"] = runtime.count();
auto const executionStop = std::chrono::steady_clock::now();
auto const constructionTime =
std::chrono::duration_cast<std::chrono::microseconds>(executionStart -
constructionStart);
auto const execTime = std::chrono::duration_cast<std::chrono::microseconds>(
executionStop - executionStart);
result["construction_time"] = constructionTime.count();
result["execution_time"] = execTime.count();

result["executor"] = getIdentifier();
result["task"] = task.getIdentifier();

Expand Down

0 comments on commit a4e752f

Please sign in to comment.