pgbench - compute & show latency consistently

Started by Fabien COELHOover 9 years ago4 messages
#1Fabien COELHO
coelho@cri.ensmp.fr
1 attachment(s)

Currently the latency is not computed and displayed consistently:

- the computation is wrong under -t (duration is zero...)

- depending on the conditions it is shown with a ":" syntax or
a "=" syntax.

The attached minor patch makes the computation & display more consistent.

--
Fabien.

Attachments:

pgbench-latency-t-1.patchtext/x-diff; name=pgbench-latency-t-1.patchDownload
diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index f3afedb..26c030e 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -1254,8 +1254,8 @@ number of clients: 10
 number of threads: 1
 number of transactions per client: 1000
 number of transactions actually processed: 10000/10000
-latency average = 15.844 ms
-latency stddev = 2.715 ms
+latency average: 15.844 ms
+latency stddev: 2.715 ms
 tps = 618.764555 (including connections establishing)
 tps = 622.977698 (excluding connections establishing)
 script statistics:
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 87fb006..6eb9f28 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3237,8 +3237,8 @@ printSimpleStats(char *prefix, SimpleStats *ss)
 	double		latency = ss->sum / ss->count;
 	double		stddev = sqrt(ss->sum2 / ss->count - latency * latency);
 
-	printf("%s average = %.3f ms\n", prefix, 0.001 * latency);
-	printf("%s stddev = %.3f ms\n", prefix, 0.001 * stddev);
+	printf("%s average: %.3f ms\n", prefix, 0.001 * latency);
+	printf("%s stddev: %.3f ms\n", prefix, 0.001 * stddev);
 }
 
 /* print out results */
@@ -3291,9 +3291,9 @@ printResults(TState *threads, StatsData *total, instr_time total_time,
 	if (throttle_delay || progress || latency_limit)
 		printSimpleStats("latency", &total->latency);
 	else
-		/* only an average latency computed from the duration is available */
+		/* no measure, show average latency computed from run time */
 		printf("latency average: %.3f ms\n",
-			   1000.0 * duration * nclients / total->cnt);
+			   1000.0 * time_include * nclients / total->cnt);
 
 	if (throttle_delay)
 	{
#2Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Fabien COELHO (#1)
Re: pgbench - compute & show latency consistently

On 7/9/16 4:42 AM, Fabien COELHO wrote:

number of transactions per client: 1000
number of transactions actually processed: 10000/10000
-latency average = 15.844 ms
-latency stddev = 2.715 ms
+latency average: 15.844 ms
+latency stddev: 2.715 ms
tps = 618.764555 (including connections establishing)
tps = 622.977698 (excluding connections establishing)

I think what you have here is that colons separate input parameters and
equal signs separate result output. So I think it's OK the way it is.

Maybe a better improvement would be introducing section headings like
"test parameters" and "test results".

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Peter Eisentraut (#2)
1 attachment(s)
Re: pgbench - compute & show latency consistently

Hello Peter,

number of transactions per client: 1000
-latency average = 15.844 ms
+latency average: 15.844 ms
tps = 618.764555 (including connections establishing)

I think what you have here is that colons separate input parameters and
equal signs separate result output. So I think it's OK the way it is.

Hmmm... Then other measures displayed are not all consistent with this
theory.

Also there is still the bug under -t which displays a 0 latency.

The attached patch still fixes that and make it consistent the other way
around, i.e. by using "=" for latency. I switched to use ":" for weight
which is an input parameter. I let ":" when there is a long sentence to
describe the figure displayed, more on aesthetical grounds.

Maybe a better improvement would be introducing section headings like
"test parameters" and "test results".

This would add more lines to the report, to sure how desirable it is.

--
Fabien.

Attachments:

pgbench-latency-t-2.patchtext/x-diff; name=pgbench-latency-t-2.patchDownload
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 87fb006..af1169a 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3291,9 +3291,9 @@ printResults(TState *threads, StatsData *total, instr_time total_time,
 	if (throttle_delay || progress || latency_limit)
 		printSimpleStats("latency", &total->latency);
 	else
-		/* only an average latency computed from the duration is available */
-		printf("latency average: %.3f ms\n",
-			   1000.0 * duration * nclients / total->cnt);
+		/* no measure, show average latency computed from run time */
+		printf("latency average = %.3f ms\n",
+			   1000.0 * time_include * nclients / total->cnt);
 
 	if (throttle_delay)
 	{
@@ -3319,7 +3319,7 @@ printResults(TState *threads, StatsData *total, instr_time total_time,
 		{
 			if (num_scripts > 1)
 				printf("SQL script %d: %s\n"
-					   " - weight = %d (targets %.1f%% of total)\n"
+					   " - weight: %d (targets %.1f%% of total)\n"
 					   " - " INT64_FORMAT " transactions (%.1f%% of total, tps = %f)\n",
 					   i + 1, sql_script[i].desc,
 					   sql_script[i].weight,
#4Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Fabien COELHO (#3)
Re: pgbench - compute & show latency consistently

On 07/13/2016 11:39 AM, Fabien COELHO wrote:

number of transactions per client: 1000
-latency average = 15.844 ms
+latency average: 15.844 ms
tps = 618.764555 (including connections establishing)

I think what you have here is that colons separate input parameters and
equal signs separate result output. So I think it's OK the way it is.

Hmmm... Then other measures displayed are not all consistent with this
theory.

Also there is still the bug under -t which displays a 0 latency.

The attached patch still fixes that and make it consistent the other way
around, i.e. by using "=" for latency. I switched to use ":" for weight
which is an input parameter. I let ":" when there is a long sentence to
describe the figure displayed, more on aesthetical grounds.

Committed, thanks!

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers