From 0bb715a528359c01b6077f850ab0bc2e0f5e8c55 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 4 Apr 2003 22:15:58 +0000 Subject: [PATCH] Accumulate compress/uncompress times. CVS patchset: 6733 CVS date: 2003/04/04 22:15:58 --- lib/poptALL.c | 5 +++++ lib/psm.c | 7 +++++-- lib/rpmts.c | 25 +++++++++++++++++++++++++ lib/rpmts.h | 5 +++++ lib/transaction.c | 2 +- rpmio/rpmio_internal.h | 1 - rpmio/rpmsw.c | 2 +- 7 files changed, 42 insertions(+), 5 deletions(-) diff --git a/lib/poptALL.c b/lib/poptALL.c index 2bee3b8..de4c527 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -71,6 +71,9 @@ extern int _rpmte_debug; extern int _rpmts_debug; /*@unchecked@*/ +extern int _rpmts_stats; + +/*@unchecked@*/ extern int noLibio; /*@=exportheadervar@*/ @@ -309,6 +312,8 @@ struct poptOption rpmcliAllPoptTable[] = { NULL, NULL}, { "rpmtsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmts_debug, -1, NULL, NULL}, + { "stats", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmts_stats, -1, + NULL, NULL}, { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, N_("debug URL cache handling"), NULL}, diff --git a/lib/psm.c b/lib/psm.c index d637443..5a2a1cf 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -54,8 +54,7 @@ int rpmVersionCompare(Header first, Header second) if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL)) epochOne = NULL; - if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo, - NULL)) + if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo, NULL)) epochTwo = NULL; if (epochOne != NULL && epochTwo == NULL) @@ -1518,6 +1517,8 @@ psm->te->h = headerLink(fi->h); rc = fsmSetup(fi->fsm, FSM_PKGINSTALL, ts, fi, psm->cfd, NULL, &psm->failedFile); + if (psm->cfd->stats != NULL) + ts->ms_uncompress += psm->cfd->stats->ops[FDSTAT_READ].usecs/1000; xx = fsmTeardown(fi->fsm); saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ @@ -1597,6 +1598,8 @@ psm->te->h = headerLink(fi->h); rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, psm->cfd, NULL, &psm->failedFile); + if (psm->cfd->stats != NULL) + ts->ms_compress += psm->cfd->stats->ops[FDSTAT_WRITE].usecs/1000; xx = fsmTeardown(fi->fsm); saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ diff --git a/lib/rpmts.c b/lib/rpmts.c index 13710a5..529c555 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -63,6 +63,9 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf) /*@unchecked@*/ int _rpmts_debug = 0; +/*@unchecked@*/ +int _rpmts_stats = 0; + char * hGetNEVR(Header h, const char ** np) { const char * n, * v, * r; @@ -627,6 +630,24 @@ void rpmtsEmpty(rpmts ts) /*@=nullstate@*/ } +static void rpmtsPrintStats(rpmts ts) + /*@globals fileSystem @*/ + /*@modifies fileSystem @*/ +{ + rpmtime_t msecs = rpmswExit(&ts->create, -1)/1000; + + fprintf(stderr, " total: %4lu.%03lu sec\n", msecs/1000, msecs%1000); + fprintf(stderr, " check: %4lu.%03lu sec\n", ts->ms_check/1000, ts->ms_check%1000); + fprintf(stderr, " order: %4lu.%03lu sec\n", ts->ms_order/1000, ts->ms_order%1000); + fprintf(stderr, " fingerprint: %4lu.%03lu sec\n", ts->ms_fingerprint/1000, ts->ms_fingerprint%1000); + fprintf(stderr, " repackage: %4lu.%03lu sec\n", ts->ms_repackage/1000, ts->ms_repackage%1000); + fprintf(stderr, " install: %4lu.%03lu sec\n", ts->ms_install/1000, ts->ms_install%1000); + fprintf(stderr, " erase: %4lu.%03lu sec\n", ts->ms_erase/1000, ts->ms_erase%1000); + fprintf(stderr, " scriptlets: %4lu.%03lu sec\n", ts->ms_scriptlets/1000, ts->ms_scriptlets%1000); + fprintf(stderr, " compress: %4lu.%03lu sec\n", ts->ms_compress/1000, ts->ms_compress%1000); + fprintf(stderr, " uncompress: %4lu.%03lu sec\n", ts->ms_uncompress/1000, ts->ms_uncompress%1000); +} + rpmts rpmtsFree(rpmts ts) { if (ts == NULL) @@ -669,6 +690,9 @@ rpmts rpmtsFree(rpmts ts) (void) rpmtsUnlink(ts, "tsCreate"); + if (_rpmts_stats) + rpmtsPrintStats(ts); + /*@-refcounttrans -usereleased @*/ ts = _free(ts); /*@=refcounttrans =usereleased @*/ @@ -1222,6 +1246,7 @@ rpmts rpmtsCreate(void) rpmts ts; ts = xcalloc(1, sizeof(*ts)); + rpmswEnter(&ts->create, -1); ts->goal = TSM_UNKNOWN; ts->filesystemCount = 0; ts->filesystems = NULL; diff --git a/lib/rpmts.h b/lib/rpmts.h index 9e7ab76..fbdc88b 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -13,6 +13,8 @@ /*@unchecked@*/ extern int _rpmts_debug; /*@unchecked@*/ +extern int _rpmts_stats; +/*@unchecked@*/ extern int _fps_debug; /*@=exportlocal@*/ @@ -194,6 +196,7 @@ struct rpmts_s { size_t pkpktlen; /*!< Current pubkey packet length. */ unsigned char pksignid[8]; /*!< Current pubkey fingerprint. */ + struct rpmop_s create; struct rpmop_s op; /*!< Transaction operation time stamp. */ rpmtime_t ms_check; @@ -203,6 +206,8 @@ struct rpmts_s { rpmtime_t ms_install; rpmtime_t ms_erase; rpmtime_t ms_scriptlets; + rpmtime_t ms_compress; + rpmtime_t ms_uncompress; /*@null@*/ pgpDig dig; /*!< Current signature/pubkey parameters. */ diff --git a/lib/transaction.c b/lib/transaction.c index fc2b6ac..0e24d5d 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1367,7 +1367,7 @@ rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n")); NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->orderCount, NULL, ts->notifyData)); - ts->ms_fingerprint += rpmswExit(&ts->op, -1)/1000; + ts->ms_fingerprint += rpmswExit(&ts->op, totalFileCount)/1000; /* =============================================== * Free unused memory as soon as possible. diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index ec895af..26014d9 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -115,7 +115,6 @@ enum FDSTAT_e { * Cumulative statistics for a descriptor. */ typedef /*@abstract@*/ struct { - struct rpmsw_s begin; /*!< Operation start time. */ struct rpmop_s ops[4]; /*!< Cumulative statistics. */ } * FDSTAT_t; diff --git a/rpmio/rpmsw.c b/rpmio/rpmsw.c index 89333b0..d96954a 100644 --- a/rpmio/rpmsw.c +++ b/rpmio/rpmsw.c @@ -27,7 +27,7 @@ static int rpmsw_type = 0; /*@unchecked@*/ static int rpmsw_initialized = 0; -#if 1 /* XXX defined(__i386__) */ +#if 0 /* XXX defined(__i386__) */ /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */ #define HP_TIMING_ZERO(Var) (Var) = (0) -- 2.7.4