op_dist_qwait_estimate()
Abstract
Returns an estimate of the amount of work left in a queue at the end of the estimation interval.
Syntax
op_dist_qwait_estimate (est_end_time, est_jobarr_rate, job_work_proc_state, new_work, outgoing_traffic, processed_work, qwait_hndl_ptr)
| Argument | Type | Description |
|---|---|---|
est_end_time |
double |
simulation time representing end of estimation interval [This value is normally a packet arrival time.] |
est_jobarr_rate |
double |
mean rate of estimation job arrivals |
job_work_proc_state |
void* |
state value to pass to a handle’s callback function |
new_work |
double |
amount of work arriving at queue at the interval’s end time |
outgoing_traffic |
Boolean |
specifies whether this KP processes and decreases the background traffic due to automatic processing. Valid values are OPC_TRUE and OPC_FALSE. |
processed_work |
double |
amount of outgoing work considered processed by an outside process and thus removed from the pending queue |
qwait_hndl_ptr |
Qwhandle* |
pointer to a Qwait handle |
Return Type
double
Amount of estimated (not explicit) work in the queue at the end of the estimation interval. This value does not include work related to explicitly modeled packets.
Example
Excerpt from: external source (models/std/utilities/oms/oms_bgutil.ex.c).
/* The qwait_handle maintains state information about the queue */
/* and the background work in the queue. Part of the state */
/* in the qwait_handle concerns future events. If the utilization */
/* has increased sufficiently since the last time we used this qwait */
/* handle, we want to reset the state in the qwait handle concerning */
/* future events because the effects of the current utilization now */
/* dominate the effects of the previous utilization. */
/* We also peek inside the qwait handle to see if the planned start */
/* of the estimation interval is in the future with respect to this */
/* packet insertion, which is the end of the estimation interval. */
if (bgutil_routed_state_ptr->qwait_handle.est_start_time > cur_insertion_time
&& utilization > 2.0 * bgutil_routed_state_ptr->prev_utilization)
{
/* Our utilization at least doubled since the last time we had an */
/* update. Reset the state of the qwait_handle by calling */
/* op_dist_qwait_est with the est_job_arrival_rate parameter set to 0.0*/
op_dist_qwait_estimate
(bgutil_routed_state_ptr->qwait_handle.prev_est_end_time,
0.0, pk_work_proc_state_ptr, 0.0, bgutil_removal, 0.0,
&bgutil_routed_state_ptr->qwait_handle);
...
}
Details
This KP allows you to estimate the background work in a queue by passing the exponential interarrival time and job size as arguments. You must also provide a Qwait handle, the amount of new work arriving at the end of the estimation interval, and an arbitrary state pointer to be passed to a callback function.
This KP is similar to op_dist_qwait_est(); the primary difference is that it includes two extra arguments. Setting outgoing_traffic to OPC_FALSE prevents the KP from decreasing the background traffic due to automatic processing; in effect, the KP acts as if the outgoing rate is zero. processed_work specifies an amount of background traffic to remove from the pending queue. op_dist_qwait_est() behaves identically to op_dist_qwait_est() with outgoing_traffic set to OPC_TRUE and processed_work set to 0.
Purpose
Provides a mechanism for returning the estimated amount of work in a queue at the end of an interval. The figure returned does not reflect work in the queue resulting from explicitly modeled packets.
Errors
- Recoverable Error: Qwhandle is corrupted or was not created with op_dist_qwait_mg1_handle_create(). Returning 0 wait.
- Recoverable Error: Illegal negative argument pre_existing_work (
<work>). - Recoverable Error: Illegal negative argument long_interval_ia_num (
<interval>). - Recoverable Error: Illegal negative argument long_interval_single_job_num (
<job>). - Recoverable Error: Estimated negative delay (
<delay>). Returning 0 wait.
Reference
- Use the KP op_dist_qwait_gg1_handle_create() to obtain a handle for creating a G/G/1 estimation
- Use the KP op_dist_qwait_mg1_handle_create() to obtain a handle for creating a M/G/1 estimation
- Use the KP op_dist_qwait_estimate() to determine the remaining work in a queue (decreases background traffic but does not remove traffic from the queue)