X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsn-markov.c;h=5de42846cba08e76b17f48be05e2f02d5944c9e4;hb=25d4accd732b929388c2cde4476b2c077ae1d235;hp=1fcc41dbb7f93487e5063d2227f85b824ceb16af;hpb=7113bfbc96eb65431bad9d9985ba04a18f4912cb;p=sort-networks.git diff --git a/src/sn-markov.c b/src/sn-markov.c index 1fcc41d..5de4284 100644 --- a/src/sn-markov.c +++ b/src/sn-markov.c @@ -43,6 +43,7 @@ #include "sn_network.h" #include "sn_random.h" +#include "histogram.h" #if !defined(__GNUC__) || !__GNUC__ # define __attribute__(x) /**/ @@ -59,6 +60,8 @@ static int best_rating = INT_MAX; static _Bool do_loop = 1; static uint64_t max_iterations = 0; +static histogram_t *histogram; + static void sigint_handler (int signal __attribute__((unused))) { do_loop = 0; @@ -204,6 +207,8 @@ static void random_walk (sn_network_t *n) best_solution = sn_network_clone (next); } + hist_account (histogram, sn_network_get_comparator_num (next)); + sn_network_destroy (n); n = next; iteration_counter++; @@ -224,6 +229,8 @@ int main (int argc, char **argv) struct sigaction sigint_action; struct sigaction sigterm_action; + histogram = hist_create (); + read_options (argc, argv); if (initial_input_file == NULL) exit_usage (argv[0], EXIT_FAILURE); @@ -254,6 +261,10 @@ int main (int argc, char **argv) random_walk (start_network); start_network = NULL; + hist_print (histogram); + hist_destroy (histogram); + histogram = NULL; + if (best_solution != NULL) { if (best_output_file != NULL)