From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2A5D31FAFA for ; Thu, 15 Dec 2022 20:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1671137578; bh=3AHbmk2tti3kpKWCVVVbBJqWVBe7En+ZPCjDO1SjLkI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=2rtdznvVgBDdxB4aSFPjVdmY1pZvGFTyK6zv2aiyOX+f79wMH3ZXM44k0E2zKzccT Vc36AbTlum5Od5zkvOebS3977VmeseJ+bottj+lnVKD4rTFH2ry2NzkEiXhbfs631B JuoQyUeXA72CFJoyf+Trzq1KTGJoLq2FaDvPk97g= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH 11/19] httpd: shrink `mean_life' field to `double' Date: Thu, 15 Dec 2022 20:52:47 +0000 Message-Id: <20221215205255.27840-12-e@80x24.org> In-Reply-To: <20221215205255.27840-1-e@80x24.org> References: <20221215205255.27840-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: `long double' is excessive, not necessary, and a waste of RAM and locality. --- mwrap_httpd.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mwrap_httpd.h b/mwrap_httpd.h index 606ae20..3d2bf99 100644 --- a/mwrap_httpd.h +++ b/mwrap_httpd.h @@ -96,7 +96,7 @@ static MWRAP_TSD struct mw_h1req *tsd_h1r; /* sortable snapshot version of struct src_loc */ struct h1_src_loc { - long double mean_life; + double mean_life; size_t bytes; size_t allocations; size_t frees; @@ -484,8 +484,8 @@ static struct h1_src_loc *accumulate(unsigned long min, size_t *hslc, FILE *lp) hsl.frees = uatomic_read(&l->frees); hsl.live = hsl.allocations - hsl.frees; hsl.mean_life = hsl.frees ? - ((long double)uatomic_read(&l->age_total) / - (long double)hsl.frees) : + ((double)uatomic_read(&l->age_total) / + (double)hsl.frees) : HUGE_VAL; hsl.max_life = uatomic_read(&l->max_lifespan); hsl.sl = l; @@ -630,7 +630,7 @@ static enum mw_qev each_gt(struct mw_h1 *h1, struct mw_h1req *h1r, struct h1_src_loc *hsl = &hslv[i]; fprintf(fp, "%zu%zu%zu" - "%zu%0.3Lf%zu", + "%zu%0.3f%zu", hsl->bytes, hsl->allocations, hsl->frees, hsl->live, hsl->mean_life, hsl->max_life); FPUTS("