Skip to content

Commit 87b7e95

Browse files
committed
Add burst_function
1 parent 835af3a commit 87b7e95

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

man/man2rwl/oltpsetup.2rwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,31 @@ To include a burst with higher arrival rate, include these parameters:
440440
\fBburst_length\fR
441441
\fBburst_factor\fR
442442
\fBburst_repeat\fR
443+
\fBburst_function\fR
443444
.fi
444445
.RS 4
445446
The two first parameters set the time to start and length of the burst, and
446447
the third parameter is the factor that is applied to the arrival rate during the burst.
447448
If burst_repeat is set to a value larger than the sum of burst_start and burst_length,
448449
the burst will be repeated very burst_repeat seconds.
449450
By default, the burst is not repeated.
451+
.P
452+
You can additionally declare a function named \fBburst_function\fR with the following
453+
shape:
454+
.P
455+
.nf
456+
function burst_function(double runsec)
457+
return double
458+
is
459+
# your code here
460+
return 1.0;
461+
end burst_function;
462+
.fi
463+
.P
464+
If the function is declared, it will be given runseconds() as its argument and it should
465+
return a factor that will be used as a multiplier to the ratefactor otherwise in use.
466+
The sample code shown here will have no impact as it always returns the value 1.0.
467+
Note that this is an experimental feature and that it may be changed in a later release.
450468
.RE
451469
.P
452470
To include a burst with extra worker threads, include these parameters:

oltp/parameters.rwl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,15 @@ if show_changed_values then
505505
else
506506
printf "arrival rate burst factor %.2f (to %.0f tps) from %.0fs until %.0fs\n"
507507
, burst_factor, xeqpsec * burst_factor, burst_start, burst_start+burst_length;
508+
if burst_repeat > 0.0 and burst_repeat <= burst_start + burst_length then
509+
printf "burst_repeat (%.0f) must be larger than %.0f to have effect\n"
510+
, burst_repeat, burst_start + burst_length;
511+
end if;
508512
end if;
509513
else
510514
printline "no arrival rate burst";
511515
end if;
516+
$if defined(burst_function) $then printline "Arrival rate bursts are defined by burst_function"; $endif
512517
if wburst_count > 0 then
513518
printf "%d extra workers (total %.0f tps), from %.0fs until %.0fs (possibly different period in different processes)\n"
514519
, wburst_count, xeqpsec *(1.0+1.0*wburst_count/threadcount), wburst_start, wburst_start + wburst_length;

oltp/run.rwl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ $if !simulatebatch $then
283283
$if rategradient is not null $then
284284
* (1.0+rategradient*(runseconds()-halfperiod)/halfperiod)
285285
$endif
286+
$if defined(burst_function) $then
287+
* burst_function(runseconds())
288+
$endif
286289
)
287290
)
288291
$else
@@ -310,6 +313,9 @@ $if !simulatebatch $then
310313
$if rategradient is not null $then
311314
* (1.0+rategradient*(runseconds()-halfperiod)/halfperiod)
312315
$endif
316+
$if defined(burst_function) $then
317+
* burst_function(runseconds())
318+
$endif
313319
)
314320
)
315321
# If before the time AND we are an inactive thread

0 commit comments

Comments
 (0)