函数
Algorithm_Calculation_Create
功能
创建一个计算函数
语法
XHANDLE Algorithm_Calculation_Create(int nTraceTime =
0)
参数
参数.一:nTraceTime
In/Out:In
类型:整数型
可空:N
意思:输入追溯时间范围,单位:秒
返回值
类型:句柄
意思:返回句柄数据,失败,返回NULL
备注
追溯模式可以计算多少秒内的平均次数或者流量
示例
int
Test_Calulation()
{
XHANDLE xhToken =
Algorithm_Calculation_Create(3);
if (NULL ==
xhToken)
{
return 0;
}
for (int i = 0; i <
10;
i++)
{
Algorithm_Calculation_SetTime(xhToken);
}
std::this_thread::sleep_for(std::chrono::seconds(2));
__int64u nTime =
0;
Algorithm_Calculation_GetTime(xhToken,
&nTime);
printf("%llu\n",
nTime);
Algorithm_Calculation_ResetTime(xhToken);
for (int i = 0; i <
10;
i++)
{
__int64u
nFlow = 0;
Algorithm_Calculation_ADDRVFlow(xhToken,
rand());
Algorithm_Calculation_ADDRVFlow(xhToken,
rand());
std::this_thread::sleep_for(std::chrono::seconds(2));
Algorithm_Calculation_GetRVFlow(xhToken,
&nFlow);
printf("%llu\n",
nFlow);
Algorithm_Calculation_GetRVFlow(xhToken,
&nFlow, TRUE);
printf("%llu\n",
nFlow);
}
Algorithm_Calculation_Close(xhToken);
return 0;
}