op_dist_qwait_estimate()
摘要
返回估计区间结束时队列中剩余工作(work)量的估计值。
语法
op_dist_qwait_estimate (est_end_time, est_jobarr_rate, job_work_proc_state, new_work, outgoing_traffic, processed_work, qwait_hndl_ptr)
| 参数 | 类型 | 说明 |
|---|---|---|
est_end_time |
double |
表示估计区间结束的仿真时间 [该值通常是一个数据包到达时间。] |
est_jobarr_rate |
double |
估计作业到达的平均速率 |
job_work_proc_state |
void* |
要传递给句柄回调函数的状态值 |
new_work |
double |
在区间结束时刻到达队列的工作量 |
outgoing_traffic |
Boolean |
指定本内核过程是否因自动处理而处理并减少背景流量。有效值为 OPC_TRUE 和 OPC_FALSE。 |
processed_work |
double |
被视为已由外部进程处理、因而从待处理队列中移除的流出工作量 |
qwait_hndl_ptr |
Qwhandle* |
指向 Qwait 句柄的指针 |
返回类型
double
估计区间结束时队列中估计的(非显式的)工作量。该值不包括与显式建模的数据包相关的工作。
示例
摘自:外部源(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);
...
}
详情
本内核过程允许你通过传入指数到达间隔时间和作业大小作为参数来估计队列中的背景工作。你还必须提供一个 Qwait 句柄、估计区间结束时到达的新工作量,以及一个要传递给回调函数的任意状态指针。
本内核过程与 op_dist_qwait_est() 类似;主要区别在于它包含两个额外的参数。将 outgoing_traffic 设为 OPC_FALSE 可防止本内核过程因自动处理而减少背景流量;实际上,本内核过程的行为相当于流出速率为零。processed_work 指定要从待处理队列中移除的背景流量数量。op_dist_qwait_est() 的行为与 op_dist_qwait_est() 在 outgoing_traffic 设为 OPC_TRUE 且 processed_work 设为 0 时完全相同。
用途
提供一种机制,用于返回某个区间结束时队列中估计的工作量。返回的数值不反映由显式建模的数据包造成的队列工作。
错误
- 可恢复错误:Qwhandle 已损坏,或并非由 op_dist_qwait_mg1_handle_create() 创建。返回 0 等待。
- 可恢复错误:非法的负参数 pre_existing_work(
<work>)。 - 可恢复错误:非法的负参数 long_interval_ia_num(
<interval>)。 - 可恢复错误:非法的负参数 long_interval_single_job_num(
<job>)。 - 可恢复错误:估计出负的延迟(
<delay>)。返回 0 等待。
参考
- 使用内核过程 op_dist_qwait_gg1_handle_create() 获取用于创建 G/G/1 估计的句柄
- 使用内核过程 op_dist_qwait_mg1_handle_create() 获取用于创建 M/G/1 估计的句柄
- 使用内核过程 op_dist_qwait_estimate() 确定队列中剩余的工作量(减少背景流量但不从队列中移除流量)