From 7e4b68c708ae523df8ce88a10ee22fff79a13f87 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 19 Aug 2018 15:00:46 +0200 Subject: [PATCH] update to the rusage command: print total analysis time, total elapsed time, and memory information (OS dependant) if rusage is given without parameters --- src/frontend/resource.c | 16 ++++++++++------ src/spicelib/analysis/cktsopt.c | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/frontend/resource.c b/src/frontend/resource.c index 2353da7c5..1cc5e63a1 100644 --- a/src/frontend/resource.c +++ b/src/frontend/resource.c @@ -124,7 +124,8 @@ com_rusage(wordlist *wl) (void) putc('\n', cp_out); } } else { - printres("cputime"); + printf("\n"); + printres("time"); (void) putc('\n', cp_out); printres("totalcputime"); (void) putc('\n', cp_out); @@ -189,6 +190,7 @@ printres(char *name) char *paramname = NULL; #endif bool yy = FALSE; + static bool called = FALSE; static long last_sec = 0, last_msec = 0; struct variable *v, *vfree = NULL; char *cpu_elapsed; @@ -237,7 +239,7 @@ printres(char *name) } if (!name || eq(name, "totalcputime")) { - fprintf(cp_out, "Total %s time: %u.%03u seconds.\n", + fprintf(cp_out, "Total %s time (seconds) = %u.%03u \n", cpu_elapsed, total_sec, total_msec); } @@ -248,12 +250,14 @@ printres(char *name) last_msec -= 1000; last_sec += 1; } -#ifndef HAVE_WIN32 - fprintf(cp_out, "%s time since last call: %lu.%03lu seconds.\n", - cpu_elapsed, last_sec, last_msec); -#endif + /* do not print it the first time, doubling totalcputime */ + if (called) + fprintf(cp_out, "%s time since last call seconds) = %lu.%03lu \n", + cpu_elapsed, last_sec, last_msec); + last_sec = total_sec; last_msec = total_msec; + called = TRUE; } #ifdef XSPICE diff --git a/src/spicelib/analysis/cktsopt.c b/src/spicelib/analysis/cktsopt.c index 88cb6fbc7..17db13d3b 100644 --- a/src/spicelib/analysis/cktsopt.c +++ b/src/spicelib/analysis/cktsopt.c @@ -292,7 +292,7 @@ static IFparm OPTtbl[] = { { "tranpoints", OPT_TRANPTS, IF_ASK|IF_INTEGER,"Transient timepoints" }, { "accept", OPT_TRANACCPT, IF_ASK|IF_INTEGER,"Accepted timepoints" }, { "rejected", OPT_TRANRJCT, IF_ASK|IF_INTEGER,"Rejected timepoints" }, - { "time", OPT_TOTANALTIME, IF_ASK|IF_REAL,"Total analysis time" }, + { "time", OPT_TOTANALTIME, IF_ASK|IF_REAL,"Total analysis time (seconds)" }, { "loadtime", OPT_LOADTIME, IF_ASK|IF_REAL,"Matrix load time" }, { "synctime", OPT_SYNCTIME, IF_ASK|IF_REAL,"Matrix synchronize time" }, { "reordertime", OPT_REORDTIME, IF_ASK|IF_REAL,"Matrix reorder time" }, @@ -305,7 +305,7 @@ static IFparm OPTtbl[] = { { "transolvetime", OPT_TRANSOLVE, IF_ASK|IF_REAL,"Transient solve time" }, { "trantrunctime", OPT_TRANTRUNC, IF_ASK|IF_REAL,"Transient trunc time" }, { "trancuriters", OPT_TRANCURITER, IF_ASK|IF_INTEGER, - "Transient iters per point" }, + "Transient iterations for the last time point" }, { "actime", OPT_ACTIME, IF_ASK|IF_REAL,"AC analysis time" }, { "acloadtime", OPT_ACLOAD, IF_ASK|IF_REAL,"AC load time" }, { "acsynctime", OPT_ACSYNC, IF_ASK|IF_REAL,"AC sync time" },