pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedlog_checkpoints, microseconds
13+ messages / 7 participants
[nested] [flat]
* log_checkpoints, microseconds
@ 2014-04-10 05:47 Peter Geoghegan <pg@heroku.com>
0 siblings, 1 reply; 13+ messages in thread
From: Peter Geoghegan @ 2014-04-10 05:47 UTC (permalink / raw)
To: pgsql-bugs
The following code appears within md.c:
if (seg != NULL &&
FileSync(seg->mdfd_vfd) >= 0)
{
/* Success; update statistics about sync timing */
INSTR_TIME_SET_CURRENT(sync_end);
sync_diff = sync_end;
INSTR_TIME_SUBTRACT(sync_diff, sync_start);
elapsed = INSTR_TIME_GET_MICROSEC(sync_diff);
if (elapsed > longest)
longest = elapsed;
total_elapsed += elapsed;
processed++;
if (log_checkpoints)
elog(DEBUG1, "checkpoint sync: number=%d file=%s time=%.3f msec",
processed,
FilePathName(seg->mdfd_vfd),
(double) elapsed / 1000);
break; /* out of retry loop */
}
Did the author of this code really intend that "elapsed" microseconds
be divided by 1000 like this?
--
Peter Geoghegan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 06:03 John R Pierce <pierce@hogranch.com>
parent: Peter Geoghegan <pg@heroku.com>
0 siblings, 1 reply; 13+ messages in thread
From: John R Pierce @ 2014-04-10 06:03 UTC (permalink / raw)
To: pgsql-bugs; pg@heroku.com
On 4/9/2014 10:47 PM, Peter Geoghegan wrote:
> if (log_checkpoints)
> elog(DEBUG1, "checkpoint sync: number=%d file=%s time=%.3f msec",
> processed,
> FilePathName(seg->mdfd_vfd),
> (double) elapsed / 1000);
>
> break; /* out of retry loop */
> }
>
> Did the author of this code really intend that "elapsed" microseconds
> be divided by 1000 like this?
thats just for the log, and you'll note it says "%.3f msec" in the entry.
--
john r pierce 37N 122W
somewhere on the middle of the left coast
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 18:45 Greg Stark <stark@mit.edu>
parent: John R Pierce <pierce@hogranch.com>
0 siblings, 1 reply; 13+ messages in thread
From: Greg Stark @ 2014-04-10 18:45 UTC (permalink / raw)
To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-bugs; Peter Geoghegan <pg@heroku.com>
On Thu, Apr 10, 2014 at 2:03 AM, John R Pierce <pierce@hogranch.com> wrote:
> thats just for the log, and you'll note it says "%.3f msec" in the entry.
I think his point is that to go from microseconds to msec (which I
think should just be "ms" btw) you want to multiply by 1000 not
divide.
--
greg
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 19:10 Peter Geoghegan <pg@heroku.com>
parent: Greg Stark <stark@mit.edu>
0 siblings, 1 reply; 13+ messages in thread
From: Peter Geoghegan @ 2014-04-10 19:10 UTC (permalink / raw)
To: Greg Stark <stark@mit.edu>; +Cc: John R Pierce <pierce@hogranch.com>; pgsql-bugs
On Thu, Apr 10, 2014 at 11:45 AM, Greg Stark <stark@mit.edu> wrote:
> I think his point is that to go from microseconds to msec (which I
> think should just be "ms" btw) you want to multiply by 1000 not
> divide.
Right. Or just use the INSTR_TIME_GET_MILLISEC() macro to begin with,
and do neither.
--
Peter Geoghegan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 19:20 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter Geoghegan <pg@heroku.com>
0 siblings, 2 replies; 13+ messages in thread
From: Tom Lane @ 2014-04-10 19:20 UTC (permalink / raw)
To: Peter Geoghegan <pg@heroku.com>; +Cc: Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
Peter Geoghegan <pg@heroku.com> writes:
> On Thu, Apr 10, 2014 at 11:45 AM, Greg Stark <stark@mit.edu> wrote:
>> I think his point is that to go from microseconds to msec (which I
>> think should just be "ms" btw) you want to multiply by 1000 not
>> divide.
> Right.
I think you're both wrong. 1000 usec = 1 msec, not the other way round.
> Or just use the INSTR_TIME_GET_MILLISEC() macro to begin with,
> and do neither.
The code appears to be trying to track stats at the microsecond
level. The printout is following a policy decision that we prefer
to report units of msec, but that does not mean that we shouldn't
keep microsecond precision internally.
In short, I see nothing that needs fixed here.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 19:43 Peter Geoghegan <pg@heroku.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 2 replies; 13+ messages in thread
From: Peter Geoghegan @ 2014-04-10 19:43 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On Thu, Apr 10, 2014 at 12:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think you're both wrong. 1000 usec = 1 msec, not the other way round.
Yes, but why would you ever want to divide any number of microseconds
by 1000 like this, unless you were actually interested in nanoseconds?
The point is that we start out with microseconds "elapsed" here, not
milliseconds or seconds.
--
Peter Geoghegan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 19:56 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Peter Geoghegan <pg@heroku.com>
1 sibling, 0 replies; 13+ messages in thread
From: Gavin Flower @ 2014-04-10 19:56 UTC (permalink / raw)
To: Peter Geoghegan <pg@heroku.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On 11/04/14 07:43, Peter Geoghegan wrote:
> On Thu, Apr 10, 2014 at 12:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think you're both wrong. 1000 usec = 1 msec, not the other way round.
> Yes, but why would you ever want to divide any number of microseconds
> by 1000 like this, unless you were actually interested in nanoseconds?
> The point is that we start out with microseconds "elapsed" here, not
> milliseconds or seconds.
>
>
123456 microseconds = 123.456 milliseconds
So to get milliseconds you divide the number of microseconds by 1000.
Cheers,
Gavin
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 19:59 Greg Stark <stark@mit.edu>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 13+ messages in thread
From: Greg Stark @ 2014-04-10 19:59 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Geoghegan <pg@heroku.com>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On Thu, Apr 10, 2014 at 3:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think you're both wrong. 1000 usec = 1 msec, not the other way round.
er, right, sorry.
--
greg
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 20:00 Heikki Linnakangas <hlinnakangas@vmware.com>
parent: Peter Geoghegan <pg@heroku.com>
1 sibling, 1 reply; 13+ messages in thread
From: Heikki Linnakangas @ 2014-04-10 20:00 UTC (permalink / raw)
To: Peter Geoghegan <pg@heroku.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On 04/10/2014 10:43 PM, Peter Geoghegan wrote:
> On Thu, Apr 10, 2014 at 12:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think you're both wrong. 1000 usec = 1 msec, not the other way round.
>
> Yes, but why would you ever want to divide any number of microseconds
> by 1000 like this, unless you were actually interested in nanoseconds?
> The point is that we start out with microseconds "elapsed" here, not
> milliseconds or seconds.
Take a break, then take another look.
The code first gets the number of microseconds elapsed. It wants to
print it out in milliseconds. The question is: "How many milliseconds is
X microseconds"? The answer is X / 1000.
For comparison, imagine that you know that 180 minutes has elapsed, and
you want to print that out in hours. To do that, you divide 180 by 60.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 20:03 Peter Geoghegan <pg@heroku.com>
parent: Heikki Linnakangas <hlinnakangas@vmware.com>
0 siblings, 1 reply; 13+ messages in thread
From: Peter Geoghegan @ 2014-04-10 20:03 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On Thu, Apr 10, 2014 at 1:00 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> Take a break, then take another look.
Ugh, I can't believe I made such an elementary error. Sorry for the noise.
--
Peter Geoghegan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 21:36 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Peter Geoghegan <pg@heroku.com>
0 siblings, 1 reply; 13+ messages in thread
From: Gavin Flower @ 2014-04-10 21:36 UTC (permalink / raw)
To: Peter Geoghegan <pg@heroku.com>; Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On 11/04/14 08:03, Peter Geoghegan wrote:
> On Thu, Apr 10, 2014 at 1:00 PM, Heikki Linnakangas
> <hlinnakangas@vmware.com> wrote:
>> Take a break, then take another look.
> Ugh, I can't believe I made such an elementary error. Sorry for the noise.
>
>
No worries!
To be Really Stupid requires Great Intelligence and a High Degree of
Creativity!
Cheers,
Gavin
(Who aspires to being merely Stupid.)
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-10 23:38 Michael Paquier <michael.paquier@gmail.com>
parent: Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 1 reply; 13+ messages in thread
From: Michael Paquier @ 2014-04-10 23:38 UTC (permalink / raw)
To: Gavin Flower <GavinFlower@archidevsys.co.nz>; +Cc: Peter Geoghegan <pg@heroku.com>; Heikki Linnakangas <hlinnakangas@vmware.com>; Tom Lane <tgl@sss.pgh.pa.us>; Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On Fri, Apr 11, 2014 at 6:36 AM, Gavin Flower
<GavinFlower@archidevsys.co.nz> wrote:
> On 11/04/14 08:03, Peter Geoghegan wrote:
>>
>> On Thu, Apr 10, 2014 at 1:00 PM, Heikki Linnakangas
>> <hlinnakangas@vmware.com> wrote:
>>>
>>> Take a break, then take another look.
>>
>> Ugh, I can't believe I made such an elementary error. Sorry for the noise.
>>
>>
> No worries!
>
> To be Really Stupid requires Great Intelligence and a High Degree of
> Creativity!
+1. Your quote?
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: log_checkpoints, microseconds
@ 2014-04-11 03:22 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 13+ messages in thread
From: Gavin Flower @ 2014-04-11 03:22 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Peter Geoghegan <pg@heroku.com>; Heikki Linnakangas <hlinnakangas@vmware.com>; Tom Lane <tgl@sss.pgh.pa.us>; Greg Stark <stark@mit.edu>; John R Pierce <pierce@hogranch.com>; pgsql-bugs
On 11/04/14 11:38, Michael Paquier wrote:
> On Fri, Apr 11, 2014 at 6:36 AM, Gavin Flower
> <GavinFlower@archidevsys.co.nz> wrote:
>> On 11/04/14 08:03, Peter Geoghegan wrote:
>>> On Thu, Apr 10, 2014 at 1:00 PM, Heikki Linnakangas
>>> <hlinnakangas@vmware.com> wrote:
>>>> Take a break, then take another look.
>>> Ugh, I can't believe I made such an elementary error. Sorry for the noise.
>>>
>>>
>> No worries!
>>
>> To be Really Stupid requires Great Intelligence and a High Degree of
>> Creativity!
> +1. Your quote?
As far as I am aware, I made up the quote myself.
However, it would not surprise me to find someone else had said it years
before I was born!
Cheers,
Gavin
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2014-04-11 03:22 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 05:47 log_checkpoints, microseconds Peter Geoghegan <pg@heroku.com>
2014-04-10 06:03 ` John R Pierce <pierce@hogranch.com>
2014-04-10 18:45 ` Greg Stark <stark@mit.edu>
2014-04-10 19:10 ` Peter Geoghegan <pg@heroku.com>
2014-04-10 19:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-04-10 19:43 ` Peter Geoghegan <pg@heroku.com>
2014-04-10 19:56 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2014-04-10 20:00 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2014-04-10 20:03 ` Peter Geoghegan <pg@heroku.com>
2014-04-10 21:36 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2014-04-10 23:38 ` Michael Paquier <michael.paquier@gmail.com>
2014-04-11 03:22 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2014-04-10 19:59 ` Greg Stark <stark@mit.edu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox