From c72abb413bd96a7742d79c5b7df6f8946024df83 Mon Sep 17 00:00:00 2001 From: "julian.speith" Date: Tue, 28 May 2024 19:54:55 +0200 Subject: [PATCH] cleaned up logs --- plugins/hawkeye/src/candidate_search.cpp | 59 +++++------------------- plugins/hawkeye/src/round_candidate.cpp | 18 ++------ plugins/hawkeye/src/sbox_lookup.cpp | 6 +-- 3 files changed, 17 insertions(+), 66 deletions(-) diff --git a/plugins/hawkeye/src/candidate_search.cpp b/plugins/hawkeye/src/candidate_search.cpp index 7f9d3aea9a8..f5e452cdd5e 100644 --- a/plugins/hawkeye/src/candidate_search.cpp +++ b/plugins/hawkeye/src/candidate_search.cpp @@ -314,9 +314,8 @@ namespace hal return ERR("netlist is a nullptr"); } - log_info("hawkeye", "start traversing netlist to determine flip-flop dependencies..."); - auto global_start = std::chrono::system_clock::now(); - auto start = global_start; + log_info("hawkeye", "start detecting state register candidates..."); + auto start = std::chrono::system_clock::now(); const auto nl_dec = NetlistTraversalDecorator(*nl); std::map> ff_map; @@ -336,12 +335,6 @@ namespace hal } } - auto duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully traversed netlist in {:.2f} seconds", duration_in_seconds); - - log_info("hawkeye", "start constructing empty netlist graph..."); - start = std::chrono::system_clock::now(); - auto res = graph_algorithm::NetlistGraph::from_netlist_no_edges(nl, start_gates); if (res.is_error()) { @@ -356,23 +349,9 @@ namespace hal } auto start_vertices = start_vertices_res.get(); - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully created empty netlist graph in {:.2f} seconds", duration_in_seconds); - - log_info("hawkeye", "start candidate identification using {} configurations...", configs.size()); - start = std::chrono::system_clock::now(); - std::set candidates; for (const auto& config : configs) { - log_info("hawkeye", - "start filling netlist graph with configuration [timeout={}, min_register_size={}, control={}, components={}]...", - config.timeout, - config.min_register_size, - enum_to_string(config.control), - enum_to_string(config.components)); - auto start_inner = std::chrono::system_clock::now(); - auto tmp_graph_res = base_graph->copy(); if (tmp_graph_res.is_error()) { @@ -479,17 +458,6 @@ namespace hal return ERR(edge_res.get_error()); } - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start_inner).count(); - log_info("hawkeye", "successfully filled netlist graph in {:.2f} seconds", duration_in_seconds); - - log_info("hawkeye", - "start neighborhood discovery with configuration [timeout={}, min_register_size={}, control={}, components={}]...", - config.timeout, - config.min_register_size, - enum_to_string(config.control), - enum_to_string(config.components)); - start_inner = std::chrono::system_clock::now(); - igraph_vector_int_t in_set, out_set; if (const auto res = igraph_vector_int_init(&in_set, 0); res != IGRAPH_SUCCESS) { @@ -618,17 +586,8 @@ namespace hal } } } - - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start_inner).count(); - log_info("hawkeye", "successfully completed neighborhood discovery in {:.2f} seconds", duration_in_seconds); } - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully completed candidate identification in {:.2f} seconds", duration_in_seconds); - - log_info("hawkeye", "start reducing candidates...", configs.size()); - start = std::chrono::system_clock::now(); - std::set candidates_to_delete; for (auto outer_it = candidates.begin(); outer_it != candidates.end(); outer_it++) { @@ -652,11 +611,15 @@ namespace hal candidates.erase(*c); } - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully completed reducing candidates in {:.2f} seconds", duration_in_seconds); - - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - global_start).count(); - log_info("hawkeye", "overall runtime: {} seconds", duration_in_seconds); + auto duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); + if (candidates.size() == 1) + { + log_info("hawkeye", "detected {} state register candidate in {} seconds", candidates.size(), duration_in_seconds); + } + else + { + log_info("hawkeye", "detected {} state register candidates in {} seconds", candidates.size(), duration_in_seconds); + } return OK(std::vector(candidates.begin(), candidates.end())); } diff --git a/plugins/hawkeye/src/round_candidate.cpp b/plugins/hawkeye/src/round_candidate.cpp index b0e7ae7e9bd..0ee0d32da65 100644 --- a/plugins/hawkeye/src/round_candidate.cpp +++ b/plugins/hawkeye/src/round_candidate.cpp @@ -55,7 +55,7 @@ namespace hal std::set state_logic; std::set state_inputs, state_outputs, control_inputs, other_inputs; - log_info("hawkeye", "start isolating state logic..."); + log_info("hawkeye", "start constructing round function candidate from state register candidate..."); auto start = std::chrono::system_clock::now(); const auto& state_input_reg = candidate->get_input_reg(); @@ -140,12 +140,6 @@ namespace hal } } - auto duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully isolated state logic in {:.2f} seconds", duration_in_seconds); - - log_info("hawkeye", "start identifying inputs..."); - start = std::chrono::system_clock::now(); - std::set visited; for (auto* gate : state_logic) { @@ -187,13 +181,7 @@ namespace hal } } - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully identified inputs in {:.2f} seconds", duration_in_seconds); - // copy partial netlist - log_info("hawkeye", "start creating sub-circuit netlist..."); - start = std::chrono::system_clock::now(); - auto round_cand = std::make_unique(); round_cand->m_netlist = std::move(netlist_factory::create_netlist(candidate->get_netlist()->get_gate_library())); auto* copied_nl = round_cand->m_netlist.get(); @@ -345,8 +333,8 @@ namespace hal round_cand->m_longest_distance_to_gate[distance].insert(gate); } - duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "successfully created sub-circuit netlist in {:.2f} seconds", duration_in_seconds); + auto duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); + log_info("hawkeye", "successfully constructed round function candidate from state register candidate in {:.2f} seconds", duration_in_seconds); return OK(std::move(round_cand)); } diff --git a/plugins/hawkeye/src/sbox_lookup.cpp b/plugins/hawkeye/src/sbox_lookup.cpp index 8f20f3b41e7..90d92fcf997 100644 --- a/plugins/hawkeye/src/sbox_lookup.cpp +++ b/plugins/hawkeye/src/sbox_lookup.cpp @@ -16,7 +16,7 @@ namespace hal { Result> locate_sboxes(const RoundCandidate* candidate) { - log_info("hawkeye", "start locating S-boxes within round candidate now..."); + log_info("hawkeye", "start locating S-boxes within round function candidate..."); auto start = std::chrono::system_clock::now(); const auto* nl = candidate->get_netlist(); @@ -268,14 +268,14 @@ namespace hal } auto duration_in_seconds = std::chrono::duration(std::chrono::system_clock::now() - start).count(); - log_info("hawkeye", "located {} S-box candidates within round candidate in {:.2f} seconds", res.size(), duration_in_seconds); + log_info("hawkeye", "located {} S-box candidates within round function candidate in {:.2f} seconds", res.size(), duration_in_seconds); return OK(res); } Result identify_sbox(const SBoxCandidate& sbox_candidate, const SBoxDatabase& db) { - log_info("hawkeye", "start identifying S-box candidate now..."); + log_info("hawkeye", "start identifying S-box candidate..."); auto start = std::chrono::system_clock::now(); std::string sbox_name;