text stringlengths 0 2.2M |
|---|
const int NUM_DATA = sizeof(DATA)/sizeof(*DATA);
|
for (int ti = 0; ti < NUM_DATA; ++ti) {
|
const Uint64 LINE = DATA[ti].d_line;
|
const Uint64 S_RATE = DATA[ti].d_sustRate;
|
const Ti S_WND = DATA[ti].d_sustWindow;
|
const Uint64 P_RATE = DATA[ti].d_peakRate;
|
const Ti P_WND = DATA[ti].d_peakWindow;
|
const Ti CREATION_TIME = DATA[ti].d_creationTime;
|
const Uint64 N_SUBMITS = DATA[ti].d_nSubmits;
|
const Uint64 UNITS = DATA[ti].d_units;
|
const Ti SUBMIT_INTERVAL = DATA[ti].d_submitInterval;
|
const bool EXCEED_BW = DATA[ti].d_exceedBw;
|
Obj x(S_RATE, S_WND, P_RATE, P_WND, CREATION_TIME);
|
Ti curTime = CREATION_TIME;
|
for(unsigned int i = 0; i < N_SUBMITS; i++) {
|
curTime += SUBMIT_INTERVAL;
|
x.submit(UNITS);
|
}
|
LOOP_ASSERT(LINE,
|
EXCEED_BW == x.wouldExceedBandwidth(curTime));
|
if (true == EXCEED_BW) {
|
// C-4
|
LOOP_ASSERT(LINE,
|
Ti(0) < x.calculateTimeToSubmit(curTime));
|
}
|
else {
|
// C-5
|
LOOP_ASSERT(LINE,
|
Ti(0) == x.calculateTimeToSubmit(curTime));
|
}
|
// C-6
|
if (true == EXCEED_BW) {
|
const Ti TIME_TO_SUBMIT = x.calculateTimeToSubmit(curTime);
|
LOOP_ASSERT(LINE, Ti(0) == x.calculateTimeToSubmit(
|
curTime + TIME_TO_SUBMIT));
|
LOOP_ASSERT(LINE, false == x.wouldExceedBandwidth(
|
curTime + TIME_TO_SUBMIT));
|
}
|
}
|
} break;
|
case 6: {
|
// --------------------------------------------------------------------
|
// CLASS METHOD 'setRateLimits'
|
//
|
// Concerns:
|
//: 1 The method sets the specified time windows intervals for peak and
|
//: sustained rate.
|
//:
|
//: 2 The method sets the specified peak and sustained rate.
|
//:
|
//: 3 Specifying wrong parameters for 'setRateLimits' parameters causes
|
//: certain behavior in special build configuration.
|
//:
|
//: 4 The 'sustainedRateWindow' is set to the interval, it takes to
|
//: drain the rounded down number of units, that may be drained at
|
//: the 'sustainedRateLimit' during the 'sustainedRateWindow',
|
//: specified for the CTOR.
|
//:
|
//: 5 The 'sustainedRateWindow' is set to the interval, it takes to
|
//: drain the rounded down number of units, that may be drained at
|
//: the 'sustainedRateLimit' during the 'sustainedRateWindow',
|
//: specified for the CTOR.
|
//:
|
//: 6 If the 'sustainedRateWindow', specified for CTOR is less than the
|
//: interval, required to drain 1 unit at sustainedRateLimit',
|
//: 'sustainedRateWindow' is set to this interval.
|
//:
|
//: 7 The 'supportsRateLimitsExactly' method reports 'false' for
|
//: unsupported arguments and when a requested window cannot be
|
//: exactly supported.
|
//
|
// Testing:
|
// void setRateLimits(sR, sRW, pR, pRW, currentTime);
|
// --------------------------------------------------------------------
|
if (verbose) cout << endl
|
<< "TESTING: 'setRateLimits'" << endl
|
<< "========================" << endl;
|
const Uint64 BIG_VAL = 0xFFFFFFFFULL * 2;
|
const Uint64 MAX_RT = ULLONG_MAX/1000000;
|
const Ti CREATION_TIME = Ti(0);
|
struct {
|
int d_line;
|
Uint64 d_sustRate;
|
Ti d_sustWindow;
|
Uint64 d_peakRate;
|
Ti d_peakWindow;
|
Ti d_expSustWnd;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.