@@ -90,7 +90,7 @@ static intpthread_join(pthread_t th, void **thread_return);
9090#define LOG_STEP_SECONDS 5/* seconds between log messages */
9191#define DEFAULT_NXACTS 10/* default nxacts */
9292
93- #define MIN_GAUSSIAN_THRESHOLD 2.0/* minimumthreshold for gauss */
93+ #define MIN_GAUSSIAN_PARAM 2.0/* minimumparameter for gauss */
9494
9595int nxacts = 0 ;/* number of transactions per client */
9696int duration = 0 ;/* duration in seconds */
@@ -488,47 +488,47 @@ getrand(TState *thread, int64 min, int64 max)
488488
489489/*
490490 * random number generator: exponential distribution from min to max inclusive.
491- * thethreshold is so that the density of probability for the last cut-off max
492- * value is exp(-threshold ).
491+ * theparameter is so that the density of probability for the last cut-off max
492+ * value is exp(-parameter ).
493493 */
494494static int64
495- getExponentialRand (TState * thread ,int64 min ,int64 max ,double threshold )
495+ getExponentialRand (TState * thread ,int64 min ,int64 max ,double parameter )
496496{
497497double cut ,
498498uniform ,
499499rand ;
500500
501- Assert (threshold > 0.0 );
502- cut = exp (- threshold );
501+ Assert (parameter > 0.0 );
502+ cut = exp (- parameter );
503503/* erand in [0, 1), uniform in (0, 1] */
504504uniform = 1.0 - pg_erand48 (thread -> random_state );
505505
506506/*
507- * inner expresion in (cut, 1] (ifthreshold > 0), rand in [0, 1)
507+ * inner expresion in (cut, 1] (ifparameter > 0), rand in [0, 1)
508508 */
509509Assert ((1.0 - cut )!= 0.0 );
510- rand = - log (cut + (1.0 - cut )* uniform ) /threshold ;
510+ rand = - log (cut + (1.0 - cut )* uniform ) /parameter ;
511511/* return int64 random number within between min and max */
512512return min + (int64 ) ((max - min + 1 )* rand );
513513}
514514
515515/* random number generator: gaussian distribution from min to max inclusive */
516516static int64
517- getGaussianRand (TState * thread ,int64 min ,int64 max ,double threshold )
517+ getGaussianRand (TState * thread ,int64 min ,int64 max ,double parameter )
518518{
519519double stdev ;
520520double rand ;
521521
522522/*
523- * Get user specified random number from this loop, with -threshold <
524- * stdev <=threshold
523+ * Get user specified random number from this loop,
524+ *with -parameter < stdev <=parameter
525525 *
526526 * This loop is executed until the number is in the expected range.
527527 *
528- * As the minimumthreshold is 2.0, the probability of looping is low:
528+ * As the minimumparameter is 2.0, the probability of looping is low:
529529 * sqrt(-2 ln(r)) <= 2 => r >= e^{-2} ~ 0.135, then when taking the
530530 * average sinus multiplier as 2/pi, we have a 8.6% looping probability in
531- * the worst case. For a 5.0 threshold value , the looping probability is
531+ * the worst case. For aparameter value of 5.0, the looping probability is
532532 * about e^{-5} * 2 / pi ~ 0.43%.
533533 */
534534do
@@ -553,10 +553,10 @@ getGaussianRand(TState *thread, int64 min, int64 max, double threshold)
553553 * over.
554554 */
555555}
556- while (stdev < - threshold || stdev >=threshold );
556+ while (stdev < - parameter || stdev >=parameter );
557557
558- /* stdev is in [-threshold, threshold ), normalization to [0,1) */
559- rand = (stdev + threshold ) / (threshold * 2.0 );
558+ /* stdev is in [-parameter, parameter ), normalization to [0,1) */
559+ rand = (stdev + parameter ) / (parameter * 2.0 );
560560
561561/* return int64 random number within between min and max */
562562return min + (int64 ) ((max - min + 1 )* rand );
@@ -1483,7 +1483,7 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
14831483char * var ;
14841484int64 min ,
14851485max ;
1486- double threshold = 0 ;
1486+ double parameter = 0 ;
14871487char res [64 ];
14881488
14891489if (* argv [2 ]== ':' )
@@ -1554,41 +1554,49 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
15541554{
15551555if ((var = getVariable (st ,argv [5 ]+ 1 ))== NULL )
15561556{
1557- fprintf (stderr ,"%s: invalidthreshold number : \"%s\"\n" ,
1557+ fprintf (stderr ,"%s: invalidparameter : \"%s\"\n" ,
15581558argv [0 ],argv [5 ]);
15591559st -> ecnt ++ ;
15601560return true;
15611561}
1562- threshold = strtod (var ,NULL );
1562+ parameter = strtod (var ,NULL );
15631563}
15641564else
1565- threshold = strtod (argv [5 ],NULL );
1565+ parameter = strtod (argv [5 ],NULL );
15661566
15671567if (pg_strcasecmp (argv [4 ],"gaussian" )== 0 )
15681568{
1569- if (threshold < MIN_GAUSSIAN_THRESHOLD )
1569+ if (parameter < MIN_GAUSSIAN_PARAM )
15701570{
1571- fprintf (stderr ,"gaussianthreshold must be at least %f (not \"%s\")\n" ,MIN_GAUSSIAN_THRESHOLD ,argv [5 ]);
1571+ fprintf (stderr ,"gaussianparameter must be at least %f (not \"%s\")\n" ,MIN_GAUSSIAN_PARAM ,argv [5 ]);
15721572st -> ecnt ++ ;
15731573return true;
15741574}
15751575#ifdef DEBUG
1576- printf ("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n" ,min ,max ,getGaussianRand (thread ,min ,max ,threshold ));
1576+ printf ("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n" ,
1577+ min ,max ,
1578+ getGaussianRand (thread ,min ,max ,parameter ));
15771579#endif
1578- snprintf (res ,sizeof (res ),INT64_FORMAT ,getGaussianRand (thread ,min ,max ,threshold ));
1580+ snprintf (res ,sizeof (res ),INT64_FORMAT ,
1581+ getGaussianRand (thread ,min ,max ,parameter ));
15791582}
15801583else if (pg_strcasecmp (argv [4 ],"exponential" )== 0 )
15811584{
1582- if (threshold <=0.0 )
1585+ if (parameter <=0.0 )
15831586{
1584- fprintf (stderr ,"exponential threshold must be greater than zero (not \"%s\")\n" ,argv [5 ]);
1587+ fprintf (stderr ,
1588+ "exponential parameter must be greater than zero (not \"%s\")\n" ,
1589+ argv [5 ]);
15851590st -> ecnt ++ ;
15861591return true;
15871592}
15881593#ifdef DEBUG
1589- printf ("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n" ,min ,max ,getExponentialRand (thread ,min ,max ,threshold ));
1594+ printf ("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n" ,
1595+ min ,max ,
1596+ getExponentialRand (thread ,min ,max ,parameter ));
15901597#endif
1591- snprintf (res ,sizeof (res ),INT64_FORMAT ,getExponentialRand (thread ,min ,max ,threshold ));
1598+ snprintf (res ,sizeof (res ),INT64_FORMAT ,
1599+ getExponentialRand (thread ,min ,max ,parameter ));
15921600}
15931601}
15941602else /* this means an error somewhere in the parsing phase... */
@@ -2282,8 +2290,9 @@ process_commands(char *buf, const char *source, const int lineno)
22822290if (pg_strcasecmp (my_commands -> argv [0 ],"setrandom" )== 0 )
22832291{
22842292/*
2285- * parsing: \setrandom variable min max [uniform] \setrandom
2286- * variable min max (gaussian|exponential) threshold
2293+ * parsing:
2294+ * \setrandom variable min max [uniform]
2295+ * \setrandom variable min max (gaussian|exponential) parameter
22872296 */
22882297
22892298if (my_commands -> argc < 4 )
@@ -2308,7 +2317,7 @@ process_commands(char *buf, const char *source, const int lineno)
23082317if (my_commands -> argc < 6 )
23092318{
23102319syntax_error (source ,lineno ,my_commands -> line ,my_commands -> argv [0 ],
2311- "missingthreshold argument " ,my_commands -> argv [4 ],-1 );
2320+ "missingparameter " ,my_commands -> argv [4 ],-1 );
23122321}
23132322else if (my_commands -> argc > 6 )
23142323{