標(biāo)題:
c語言流池濾波法(瞎琢磨的,濾波效果灰常好)
[打印本頁]
作者:
xiaojuan
時(shí)間:
2014-9-17 22:35
標(biāo)題:
c語言流池濾波法(瞎琢磨的,濾波效果灰常好)
uint16 FlowPoolFilter(uint32 *Pool,uint16 Data,uint8 *PoolIndex,uint8 PoolSize)
{
(*Pool)+=Data;
if((*PoolIndex)< PoolSize )(*PoolIndex)++;
else (*Pool)-=((*Pool)/(*PoolIndex));
return (*Pool)/(*PoolIndex);
}
Eg: 獲取TOS CPU的使用率
void Tos_ComputeCPURate()
{
static uint8 Count,i;
static uint32 Pool;
static uint8 Use;
if(_Tos_TaskTotal-1!=Tos_TaskCurrent)Use++;
Count++;
if(Count>100){Count=0;Tos_CPUInfor.Userate_CPU=FlowPoolFilter(&Pool,Use,&i,100);Use=0;}
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1