pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: pgbench stats per script & other stuff
Date: Sat, 19 Mar 2016 15:34:30 -0300
Message-ID: <20160319183430.GA294957@alvherre.pgsql> (raw )
In-Reply-To: <CAMkU=1zx9m1baoHdfSEPTyMz6q9Lu=-SaRZr9VQzMHzdoo0KMw@mail.gmail.com >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Jeff Janes wrote:
> On Sat, Mar 19, 2016 at 8:41 AM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
> > I pushed your 25, with some additional minor tweaks. I hope I didn't
> > break anything; please test.
>
> I'm now getting compiler warnings:
>
> gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
>
>
> pgbench.c: In function 'process_builtin':
> pgbench.c:2765: warning: 'ps.stats.lag.sum2' is used uninitialized in
> this function
Fair complaints. I suppose the following should fix them?
--
Álvaro Herrera 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
Attachments:
[text/x-diff] pgbench-warns.patch (3.3K, ../20160319183430.GA294957@alvherre.pgsql/2-pgbench-warns.patch)
download | inline diff:
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index ecabff0..4606fb0 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -2649,11 +2649,23 @@ read_line_from_file(FILE *fd)
}
/*
+ * Initialize a ParsedScript
+ */
+static void
+initParsedScript(ParsedScript *ps, const char *desc, int alloc_num, int weight)
+{
+ ps->commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
+ ps->desc = desc;
+ ps->weight = weight;
+ initStats(&ps->stats, 0.0);
+}
+
+/*
* Given a file name, read it and return its ParsedScript representation. "-"
* means to read stdin.
*/
static ParsedScript
-process_file(char *filename)
+process_file(char *filename, int weight)
{
#define COMMANDS_ALLOC_NUM 128
ParsedScript ps;
@@ -2673,8 +2685,7 @@ process_file(char *filename)
}
alloc_num = COMMANDS_ALLOC_NUM;
- ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
- ps.desc = filename;
+ initParsedScript(&ps, filename, alloc_num, weight);
lineno = 0;
index = 0;
@@ -2710,7 +2721,7 @@ process_file(char *filename)
/* Parse the given builtin script and return the parsed representation */
static ParsedScript
-process_builtin(BuiltinScript *bi)
+process_builtin(BuiltinScript *bi, int weight)
{
int lineno,
index;
@@ -2720,8 +2731,7 @@ process_builtin(BuiltinScript *bi)
ParsedScript ps;
alloc_num = COMMANDS_ALLOC_NUM;
- ps.desc = bi->desc;
- ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
+ initParsedScript(&ps, bi->desc, alloc_num, weight);
lineno = 0;
index = 0;
@@ -2860,7 +2870,7 @@ parseScriptWeight(const char *option, char **script)
/* append a script to the list of scripts to process */
static void
-addScript(ParsedScript script, int weight)
+addScript(ParsedScript script)
{
if (script.commands == NULL || script.commands[0] == NULL)
{
@@ -2875,8 +2885,6 @@ addScript(ParsedScript script, int weight)
}
sql_script[num_scripts] = script;
- sql_script[num_scripts].weight = weight;
- initStats(&sql_script[num_scripts].stats, 0.0);
num_scripts++;
}
@@ -3251,24 +3259,24 @@ main(int argc, char **argv)
}
weight = parseScriptWeight(optarg, &script);
- addScript(process_builtin(findBuiltin(script)), weight);
+ addScript(process_builtin(findBuiltin(script), weight));
benchmarking_option_set = true;
internal_script_used = true;
break;
case 'S':
- addScript(process_builtin(findBuiltin("select-only")), 1);
+ addScript(process_builtin(findBuiltin("select-only"), 1));
benchmarking_option_set = true;
internal_script_used = true;
break;
case 'N':
- addScript(process_builtin(findBuiltin("simple-update")), 1);
+ addScript(process_builtin(findBuiltin("simple-update"), 1));
benchmarking_option_set = true;
internal_script_used = true;
break;
case 'f':
weight = parseScriptWeight(optarg, &script);
- addScript(process_file(script), weight);
+ addScript(process_file(script, weight));
benchmarking_option_set = true;
break;
case 'D':
@@ -3406,7 +3414,7 @@ main(int argc, char **argv)
/* set default script if none */
if (num_scripts == 0 && !is_init_mode)
{
- addScript(process_builtin(findBuiltin("tpcb-like")), 1);
+ addScript(process_builtin(findBuiltin("tpcb-like"), 1));
benchmarking_option_set = true;
internal_script_used = true;
}
view thread (92+ messages) latest in thread
Message-ID: <20160319183430.GA294957@alvherre.pgsql>
Permalink: ../20160319183430.GA294957@alvherre.pgsql/
Also on: postgresql.org/message-id/20160319183430.GA294957@alvherre.pgsql
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, jeff.janes@gmail.com, coelho@cri.ensmp.fr, michael.paquier@gmail.com
Subject: Re: pgbench stats per script & other stuff
In-Reply-To: <20160319183430.GA294957@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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