Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea21eea

Browse files
committed
Change "tps" to "scale" to avoid confusion
Fix bug with handling default scaling factor in the defaultscenarios
1 parent500da22 commitea21eea

File tree

3 files changed

+56
-36
lines changed

3 files changed

+56
-36
lines changed

‎contrib/pgbench/README.pgbench

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ o -f option
184184

185185
example:
186186

187-
\set ntellers 10 * :tps
187+
\set ntellers 10 * :scale
188188

189189
\setrandom name min max
190190

@@ -206,9 +206,9 @@ o -f option
206206
Example, TPC-B like benchmark can be defined as follows(scaling
207207
factor = 1):
208208

209-
\set nbranches :tps
210-
\set ntellers 10 * :tps
211-
\set naccounts 100000 * :tps
209+
\set nbranches :scale
210+
\set ntellers 10 * :scale
211+
\set naccounts 100000 * :scale
212212
\setrandom aid 1 :naccounts
213213
\setrandom bid 1 :nbranches
214214
\setrandom tid 1 :ntellers
@@ -235,6 +235,12 @@ Basically it is same as BSD license. See pgbench.c for more details.
235235

236236
o History
237237

238+
2006/09/14
239+
* change "tps" to "scale" to avoid confusion
240+
241+
* fix bug with handling default scaling factor in the default
242+
scenarios
243+
238244
2006/07/26
239245
* New features contributed by Tomoaki Sato.
240246

‎contrib/pgbench/README.pgbench_jis

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pgbench $B$K$O$$$m$$$m$J%*%W%7%g%s$,$"$j$^$9!%(B
7373
$BBg$-$5$,(B 10$BK|(B x [$B%9%1!<%j%s%0%U%!%/%?!<(B]$B$K$J$j$^$9!%(B
7474
$B%G%U%)%k%H$N%9%1!<%j%s%0%U%!%/%?!<$O(B 1 $B$G$9!%(B
7575
-f $B%*%W%7%g%s$G;XDj$7$?%U%!%$%k$+$i%9%1!<%j%s%0%U%!%/(B
76-
$B%?!<$r;2>H$9$k$K$O(Btps $B$H$$$&JQ?tL>$r;HMQ$7$^$9!%(B
76+
$B%?!<$r;2>H$9$k$K$O(Bscale $B$H$$$&JQ?tL>$r;HMQ$7$^$9!%(B
7777

7878
-D varname=value
7979

@@ -223,7 +223,7 @@ pgbench $B$G$O!$0J2<$N%7!<%1%s%9$rA4It40N;$7$F(B1$B%H%i%s%6%/%7%g%s$H?t$($F(
223223
$BJQ?t$K1i;;$N7k2L$r@_Dj$9$k$K$O!$(B\set $B%a%?%3%^%s%I$r;HMQ$7$F0J(B
224224
$B2<$N$h$&$K5-=R$7$^$9!%(B
225225

226-
\set ntellers 10 * :tps
226+
\set ntellers 10 * :tp
227227

228228
$B$3$l$O!$JQ?t(B ntellers $B$K%9%1!<%j%s%0%U%!%/%?!<(B (-s $B%*%W%7%g%s(B
229229
$B$G;XDj$7$?(B) $B$r(B 10 $BG\$7$?7k2L$r@_Dj$7$^$9!%(B
@@ -253,9 +253,9 @@ SELECT abalance FROM accounts WHERE aid = :aid
253253
$B%6%/%7%g%s$NFbMF$r%U%!%$%k$K5-=R$7!$(B-f $B%*%W%7%g%s$K$h$C$F$=$N%U%!%$%k(B
254254
$B$r;XDj$7$F(B pgbench $B$r<B9T$7$^$9!%(B
255255

256-
\set nbranches :tps
257-
\set ntellers 10 * :tps
258-
\set naccounts 100000 * :tps
256+
\set nbranches :scale
257+
\set ntellers 10 * :scale
258+
\set naccounts 100000 * :scale
259259
\setrandom aid 1 :naccounts
260260
\setrandom bid 1 :nbranches
261261
\setrandom tid 1 :ntellers
@@ -285,6 +285,10 @@ pgbench $B$O@P0f(B $BC#IW$K$h$C$F=q$+$l$^$7$?!%%i%$%;%s%9>r7o$O(B pgbench.c
285285

286286
$B"#2~DjMzNr(B
287287

288+
2006/09/13
289+
* $BJQ?t(Btps$B$OJ6$i$o$7$$$N$G(Bscale$B$KJQ99!%%G%U%)%k%H%7%J%j%*$N;~$K!$(B
290+
$B%G%U%)%k%H$N%9%1!<%j%s%0%U%!%/%?$r(Bbranches$B$+$i<h$C$F$3$J$$%P%0$r=$@5!%(B
291+
288292
2006/07/26
289293
* $B:4F#$5$s$N%Q%C%A$rE,MQ!%0J2<$N5!G=DI2C!%(BPostgreSQL 8.2$B$K<h$j(B
290294
$B9~$^$l$^$9!%(B

‎contrib/pgbench/pgbench.c

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.53 2006/08/15 13:05:30 ishii Exp $
2+
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.54 2006/09/13 00:39:19 ishii Exp $
33
*
44
* pgbench: a simple benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
@@ -58,10 +58,10 @@ intnclients = 1;/* default number of simulated clients */
5858
intnxacts=10;/* default number of transactions per clients */
5959

6060
/*
61-
* scaling factor. for example,tps = 10 will make 1000000 tuples of
61+
* scaling factor. for example,scale = 10 will make 1000000 tuples of
6262
* accounts table.
6363
*/
64-
inttps=1;
64+
intscale=1;
6565

6666
/*
6767
* end of configurable parameters
@@ -134,9 +134,9 @@ intnum_files;/* its number */
134134

135135
/* default scenario */
136136
staticchar*tpc_b= {
137-
"\\set nbranches :tps\n"
138-
"\\set ntellers 10 * :tps\n"
139-
"\\set naccounts 100000 * :tps\n"
137+
"\\set nbranches :scale\n"
138+
"\\set ntellers 10 * :scale\n"
139+
"\\set naccounts 100000 * :scale\n"
140140
"\\setrandom aid 1 :naccounts\n"
141141
"\\setrandom bid 1 :nbranches\n"
142142
"\\setrandom tid 1 :ntellers\n"
@@ -152,9 +152,9 @@ static char *tpc_b = {
152152

153153
/* -N case */
154154
staticchar*simple_update= {
155-
"\\set nbranches :tps\n"
156-
"\\set ntellers 10 * :tps\n"
157-
"\\set naccounts 100000 * :tps\n"
155+
"\\set nbranches :scale\n"
156+
"\\set ntellers 10 * :scale\n"
157+
"\\set naccounts 100000 * :scale\n"
158158
"\\setrandom aid 1 :naccounts\n"
159159
"\\setrandom bid 1 :nbranches\n"
160160
"\\setrandom tid 1 :ntellers\n"
@@ -168,7 +168,7 @@ static char *simple_update = {
168168

169169
/* -S case */
170170
staticchar*select_only= {
171-
"\\set naccounts 100000 * :tps\n"
171+
"\\set naccounts 100000 * :scale\n"
172172
"\\setrandom aid 1 :naccounts\n"
173173
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
174174
};
@@ -338,10 +338,13 @@ putVariable(CState * st, char *name, char *value)
338338
}
339339
else
340340
{
341-
if ((value=strdup(value))==NULL)
341+
char*val;
342+
343+
if ((val=strdup(value))==NULL)
342344
return false;
345+
343346
free(var->value);
344-
var->value=value;
347+
var->value=val;
345348
}
346349

347350
return true;
@@ -755,7 +758,7 @@ init(void)
755758
}
756759
PQclear(res);
757760

758-
for (i=0;i<nbranches*tps;i++)
761+
for (i=0;i<nbranches*scale;i++)
759762
{
760763
snprintf(sql,256,"insert into branches(bid,bbalance) values(%d,0)",i+1);
761764
res=PQexec(con,sql);
@@ -767,7 +770,7 @@ init(void)
767770
PQclear(res);
768771
}
769772

770-
for (i=0;i<ntellers*tps;i++)
773+
for (i=0;i<ntellers*scale;i++)
771774
{
772775
snprintf(sql,256,"insert into tellers(tid,bid,tbalance) values (%d,%d,0)"
773776
,i+1,i /ntellers+1);
@@ -792,7 +795,7 @@ init(void)
792795
* occupy accounts table with some data
793796
*/
794797
fprintf(stderr,"creating tables...\n");
795-
for (i=0;i<naccounts*tps;i++)
798+
for (i=0;i<naccounts*scale;i++)
796799
{
797800
intj=i+1;
798801

@@ -1133,7 +1136,7 @@ printResults(
11331136
s="Custom query";
11341137

11351138
printf("transaction type: %s\n",s);
1136-
printf("scaling factor: %d\n",tps);
1139+
printf("scaling factor: %d\n",scale);
11371140
printf("number of clients: %d\n",nclients);
11381141
printf("number of transactions per client: %d\n",nxacts);
11391142
printf("number of transactions actually processed: %d/%d\n",normal_xacts,nxacts*nclients);
@@ -1175,6 +1178,8 @@ main(int argc, char **argv)
11751178
PGresult*res;
11761179
char*env;
11771180

1181+
charval[64];
1182+
11781183
if ((env=getenv("PGHOST"))!=NULL&&*env!='\0')
11791184
pghost=env;
11801185
if ((env=getenv("PGPORT"))!=NULL&&*env!='\0')
@@ -1248,10 +1253,10 @@ main(int argc, char **argv)
12481253
is_connect=1;
12491254
break;
12501255
case's':
1251-
tps=atoi(optarg);
1252-
if (tps <=0)
1256+
scale=atoi(optarg);
1257+
if (scale <=0)
12531258
{
1254-
fprintf(stderr,"invalid scaling factor: %d\n",tps);
1259+
fprintf(stderr,"invalid scaling factor: %d\n",scale);
12551260
exit(1);
12561261
}
12571262
break;
@@ -1323,12 +1328,10 @@ main(int argc, char **argv)
13231328

13241329
remains=nclients;
13251330

1326-
if (getVariable(&state[0],"tps")==NULL)
1331+
if (getVariable(&state[0],"scale")==NULL)
13271332
{
1328-
charval[64];
1329-
1330-
snprintf(val,sizeof(val),"%d",tps);
1331-
if (putVariable(&state[0],"tps",val)== false)
1333+
snprintf(val,sizeof(val),"%d",scale);
1334+
if (putVariable(&state[0],"scale",val)== false)
13321335
{
13331336
fprintf(stderr,"Couldn't allocate memory for variable\n");
13341337
exit(1);
@@ -1405,13 +1408,20 @@ main(int argc, char **argv)
14051408
fprintf(stderr,"%s",PQerrorMessage(con));
14061409
exit(1);
14071410
}
1408-
tps=atoi(PQgetvalue(res,0,0));
1409-
if (tps<0)
1411+
scale=atoi(PQgetvalue(res,0,0));
1412+
if (scale<0)
14101413
{
1411-
fprintf(stderr,"count(*) from branches invalid (%d)\n",tps);
1414+
fprintf(stderr,"count(*) from branches invalid (%d)\n",scale);
14121415
exit(1);
14131416
}
14141417
PQclear(res);
1418+
1419+
snprintf(val,sizeof(val),"%d",scale);
1420+
if (putVariable(&state[0],"scale",val)== false)
1421+
{
1422+
fprintf(stderr,"Couldn't allocate memory for variable\n");
1423+
exit(1);
1424+
}
14151425
}
14161426

14171427
if (!is_no_vacuum)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp