Re: Refactor calculations to use instr_time - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Refactor calculations to use instr_time
Date
Msg-id 20230220.120114.2218814506773492965.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: Refactor calculations to use instr_time  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: Refactor calculations to use instr_time
List pgsql-hackers
At Fri, 17 Feb 2023 13:53:36 +0300, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote in 
> Thanks for the review. I updated the patch.


     WalUsageAccumDiff(&diff, &pgWalUsage, &prevWalUsage);
-    PendingWalStats.wal_records = diff.wal_records;
-    PendingWalStats.wal_fpi = diff.wal_fpi;
-    PendingWalStats.wal_bytes = diff.wal_bytes;
...
+    WALSTAT_ACC(wal_records, diff);
+    WALSTAT_ACC(wal_fpi, diff);
+    WALSTAT_ACC(wal_bytes, diff);
+    WALSTAT_ACC(wal_buffers_full, PendingWalStats);


The lifetime of the variable "diff" seems to be longer now. Wouldn't
it be clearer if we renamed it to something more meaningful, like
wal_usage_diff, WalUsageDiff or PendingWalUsage?  Along those same
lines, it occurs to me that the new struct should be named
PgStat_PendingWalStats, instead of ..Usage. That change makes the name
of the type and the variable consistent.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Normalization of utility queries in pg_stat_statements
Next
From: David Rowley
Date:
Subject: Re: Make set_ps_display faster and easier to use