From 05fa685402151ad86563a1b9d2ef9b7294cb2d75 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 1 Apr 2019 19:18:06 +0200 Subject: mg2d: extend stats logging --- ell_grid_solve.c | 2 ++ ell_grid_solve.h | 1 + mg2d.c | 11 ++++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ell_grid_solve.c b/ell_grid_solve.c index d597e58..6c8a863 100644 --- a/ell_grid_solve.c +++ b/ell_grid_solve.c @@ -586,6 +586,8 @@ static int solve_exact(EGSContext *ctx) start = gettime(); ret = mg2di_bicgstab_solve(e->bicgstab, e->mat, e->rhs, e->x); + if (ret >= 0) + ec->bicgstab_iterations += ret; ec->time_bicgstab_solve += gettime() - start; ec->count_bicgstab_solve++; diff --git a/ell_grid_solve.h b/ell_grid_solve.h index 0718b67..d46edd9 100644 --- a/ell_grid_solve.h +++ b/ell_grid_solve.h @@ -92,6 +92,7 @@ typedef struct EGSExactContext { int64_t count_mat_construct; int64_t time_mat_construct; int64_t count_bicgstab_solve; + int64_t bicgstab_iterations; int64_t time_bicgstab_solve; int64_t count_lu_solve; int64_t time_lu_solve; diff --git a/mg2d.c b/mg2d.c index 1326a38..d0469e1 100644 --- a/mg2d.c +++ b/mg2d.c @@ -754,8 +754,9 @@ void mg2d_print_stats(MG2DContext *ctx, const char *prefix) if (!prefix) prefix = ""; - mg2di_log(&priv->logger, MG2D_LOG_VERBOSE, "%s%ld solves; %g s total time; %g ms avg per call\n", - prefix, priv->count_solve, priv->time_solve / 1e6, priv->time_solve / 1e3 / priv->count_solve); + mg2di_log(&priv->logger, MG2D_LOG_VERBOSE, "%s%ld solves; %g s total time; %g ms avg per call; %g avg cycles per solve\n", + prefix, priv->count_solve, priv->time_solve / 1e6, priv->time_solve / 1e3 / priv->count_solve, + (double)level->count_cycles / priv->count_solve); while (level) { char buf[1024], *p; @@ -818,10 +819,10 @@ void mg2d_print_stats(MG2DContext *ctx, const char *prefix) p += ret; } else if (e) { ret = snprintf(p, sizeof(buf) - (p - buf), - " %2.2f%% const %2.2f%% bicgstab %2.2f%% lu %2.2f%% export", + " %2.2f%% const %2.2f%% bicgstab (%ld; %g it/slv) %2.2f%% lu (%ld) %2.2f%% export", e->time_mat_construct * 100.0 / level->solver->time_total, - e->time_bicgstab_solve * 100.0 / level->solver->time_total, - e->time_lu_solve * 100.0 / level->solver->time_total, + e->time_bicgstab_solve * 100.0 / level->solver->time_total, e->count_bicgstab_solve, (double)e->bicgstab_iterations / e->count_bicgstab_solve, + e->time_lu_solve * 100.0 / level->solver->time_total, e->count_lu_solve, e->time_export * 100.0 / level->solver->time_total); if (ret > 0) p += ret; -- cgit v1.2.3