?? statistic.c
字號:
return iReturnValue;
}
/* 處理服務元素的統計
* <0:返回錯誤, >=0:返回Pid
*/
int Process_Statistic_Cbse(CBEMESSAGE_t *LpCBEMessage)
{
MESSAGE_STATISTIC_t *LpMessageStatistic;
int iReturnValue;
PID_t s_Pid;
CBSE_STATISTIC_RESULT_t s_CBSEStatisticResult;
int Tid;
int i,j,k;
CELL_CBSE_STATISTIC_RESULT_t s_CellCBSEStatisticResult;
unsigned char bIfCellExist;
LpMessageStatistic=(MESSAGE_STATISTIC_t *)LpCBEMessage;
s_Pid.cFunctionId=MODULEID;
s_Pid.cFunctionId=FUNCTIONID;
switch(LpMessageStatistic->ParaId)
{
case CBCPROXY_CBSE_CNT: /* CBCProxy業務請求次數 */
{
/* 分配一個統計進程 */
s_Pid.cFunctionId=FUNCTIONID;
s_Pid.cModuleId=MODULEID;
s_Pid.iProcessId=alloc_pid((char *)&s_Pid);
if ( s_Pid.iProcessId < 0 )
{
printf("Creat Process Error\n");
return FAILURE;
}
memcpy(&LpMessageStatistic->s_StatMessageHead.s_ReceiverPid,
&s_Pid,sizeof(PID_t));
memset(&ProcessData[s_Pid.iProcessId][0],0,LPCB_DATA_SIZE);
memset(&s_CBSEStatisticResult,0,sizeof(CBSE_STATISTIC_RESULT_t));
memcpy(&ProcessData[s_Pid.iProcessId][0],LpCBEMessage,LpCBEMessage->iLen+2);
LpMessageStatistic=(MESSAGE_STATISTIC_t *)&ProcessData[s_Pid.iProcessId][0];
/* 有6種業務的統計 */
s_CBSEStatisticResult.cNumber=6;
i=0;
/* 寫入 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=WRITE_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyWriteReqCnt ;
i++;
/* 替換 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=REPLACE_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyReplaceReqCnt ;
i++;
/* 刪除 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=KILL_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyKillReqCnt;
i++;
/* 消息狀態查詢查詢 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=QUERY_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyMsgQueryCnt;
i++;
/* 小區信道負荷查詢 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=CBCH_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyCBCHReqCnt;
i++;
/* 小區重啟 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=RESET_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_CbcProxyReqCnt.iCBCProxyResetCnt;
i++;
memcpy(&ProcessData[s_Pid.iProcessId][sizeof(MESSAGE_STATISTIC_t)],&s_CBSEStatisticResult,s_CBSEStatisticResult.cNumber*sizeof(STATTYPE_COUNT_t)+1);
/* 創建統計定時器 */
iReturnValue=create_timer(LpMessageStatistic->StatTimeLength*1000,
STATISTIC_TIMER,(char *)&s_Pid,NULL);
/* 創建定時器失敗 */
if (iReturnValue<0)
{
printf("Create timer Error!\n");
/* 結束統計進程 */
free_pid((char *)&s_Pid);
return iReturnValue;
}
/* 保存統計定時器在進程區尾部 */
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-sizeof(int)],&iReturnValue,sizeof(int));
}
break;
case BSC_CBSE_CNT: /* 對各個BSC業務請求次數 */
{
/* 分配一個統計進程 */
s_Pid.cFunctionId=FUNCTIONID;
s_Pid.cModuleId=MODULEID;
s_Pid.iProcessId=alloc_pid((char *)&s_Pid);
if ( s_Pid.iProcessId < 0 )
{
printf("Creat Process Error\n");
return FAILURE;
}
memcpy(&LpMessageStatistic->s_StatMessageHead.s_ReceiverPid,
&s_Pid,sizeof(PID_t));
memset(&ProcessData[s_Pid.iProcessId][0],0,LPCB_DATA_SIZE);
memset(&s_CBSEStatisticResult,0,sizeof(CBSE_STATISTIC_RESULT_t));
memcpy(&ProcessData[s_Pid.iProcessId][0],LpCBEMessage,LpCBEMessage->iLen+2);
LpMessageStatistic=(MESSAGE_STATISTIC_t *)&ProcessData[s_Pid.iProcessId][0];
Tid=GetTid(&LpMessageStatistic->BSCIdentifier[0]);
if (Tid<0)
{
return UNRECOGNIZED_BSC;
}
/* 有6種業務的統計 */
s_CBSEStatisticResult.cNumber=6;
i=0;
/* 寫入 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=WRITE_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyWriteReqCnt ;
i++;
/* 替換 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=REPLACE_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyReplaceReqCnt ;
i++;
/* 刪除 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=KILL_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyKillReqCnt;
i++;
/* 消息狀態查詢查詢 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=QUERY_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyMsgQueryCnt;
i++;
/* 小區信道負荷查詢 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=CBCH_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyCBCHReqCnt;
i++;
/* 小區重啟 */
s_CBSEStatisticResult.s_StattypeCount[i].cStatisticType=RESET_STATISTIC;
s_CBSEStatisticResult.s_StattypeCount[i].iCount=
s_CBSECount.s_ReqBSCCnt[Tid].iCBCProxyResetCnt;
memcpy(&ProcessData[s_Pid.iProcessId][sizeof(MESSAGE_STATISTIC_t)],&s_CBSEStatisticResult,s_CBSEStatisticResult.cNumber*sizeof(STATTYPE_COUNT_t)+1);
/* 創建統計定時器 */
iReturnValue=create_timer(LpMessageStatistic->StatTimeLength*1000,
STATISTIC_TIMER,(char *)&s_Pid,NULL);
/* 創建定時器失敗 */
if (iReturnValue<0)
{
printf("Create timer Error!\n");
/* 釋放進程 */
free_pid((char *)&s_Pid);
return iReturnValue;
}
/* 保存統計定時器在進程區尾部 */
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-sizeof(int)],&iReturnValue,sizeof(int));
}
case CELL_CBSE_CNT: /* 小區服務元素的統計,包括成功和失敗 */
{
/* 分配一個統計進程 */
s_Pid.cFunctionId=FUNCTIONID;
s_Pid.cModuleId=MODULEID;
s_Pid.iProcessId=alloc_pid((char *)&s_Pid);
if ( s_Pid.iProcessId < 0 )
{
printf("Creat Process Error\n");
return FAILURE;
}
memcpy(&LpMessageStatistic->s_StatMessageHead.s_ReceiverPid,
&s_Pid,sizeof(PID_t));
memset(&ProcessData[s_Pid.iProcessId][0],0,LPCB_DATA_SIZE);
memset(&s_CBSEStatisticResult,0,sizeof(CBSE_STATISTIC_RESULT_t));
memcpy(&ProcessData[s_Pid.iProcessId][0],LpCBEMessage,LpCBEMessage->iLen+2);
LpMessageStatistic=(MESSAGE_STATISTIC_t *)&ProcessData[s_Pid.iProcessId][0];
/* 初始為不存在 */
bIfCellExist=0;
for(i=0;i<MAX_BSC_CONNECT;i++)
{
if (s_BSCCellInfo[i].bFlag==1)
{
for(j=0;j<s_BSCCellInfo[i].cNumberOfBTS;j++)
{
for(k=0;k<s_BSCCellInfo[i].s_BTSCellInfo[j].cNumberOfCell;k++)
{
if(memcmp(&LpMessageStatistic->cCellId[0],
&s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].cCellId[0],4)==0)
{
/* 記下小區在系統中的位置,記在進程尾部 */
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-16],&i,4);
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-12],&j,4);
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-8],&k,4);
bIfCellExist=EXIST;
/* 跳出循環 */
goto L_out;
}
}
}
}
}
L_out:
if(bIfCellExist==0)
{
return NO_RECOGNIZEABLE_CELL;
}
memset(&s_CellCBSEStatisticResult,0,sizeof(CELL_CBSE_STATISTIC_RESULT_t));
s_CellCBSEStatisticResult.cNumber=0;
/* 寫入 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].cStatisticType=WRITE_STATISTIC;
/* 發送總數 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSendCount=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.iSendCount;
/* 成功總數 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSuccessCount=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.iSuccessCount;
/* 基站系統負荷超載 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].ibsscapErr=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.ibsscapErr;
/* 小區內存溢出 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].icellmemErr=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.icellmemErr;
/* 基站系統內存溢出 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].ibssmemErr=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.ibssmemErr;
/* 其他錯誤 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iotherErr=
s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_WriteCount.iotherErr;
s_CellCBSEStatisticResult.cNumber++;
/* 替換 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].cStatisticType=REPLACE_STATISTIC;
memcpy(&s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSuccessCount
,&s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_ReplaceCount,sizeof(CELL_STAT_t));
s_CellCBSEStatisticResult.cNumber++;
/* 刪除 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].cStatisticType=KILL_STATISTIC;
memcpy(&s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSuccessCount
,&s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_KillCount,sizeof(CELL_STAT_t));
s_CellCBSEStatisticResult.cNumber++;
/* 消息狀態查詢查詢 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].cStatisticType=QUERY_STATISTIC;
memcpy(&s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSuccessCount
,&s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_QueryCount,sizeof(CELL_STAT_t));
s_CellCBSEStatisticResult.cNumber++;
/* 小區信道負荷查詢 */
s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].cStatisticType=CBCH_STATISTIC;
memcpy(&s_CellCBSEStatisticResult.s_StattypeCount[s_CellCBSEStatisticResult.cNumber].iSuccessCount
,&s_BSCCellInfo[i].s_BTSCellInfo[j].s_CellId[k].s_CBCHCount,sizeof(CELL_STAT_t));
s_CellCBSEStatisticResult.cNumber++;
memcpy(&ProcessData[s_Pid.iProcessId][sizeof(MESSAGE_STATISTIC_t)],&s_CellCBSEStatisticResult,s_CellCBSEStatisticResult.cNumber*sizeof(CELL_STATTYPE_COUNT_t)+1);
/* 創建統計定時器 */
iReturnValue=create_timer(LpMessageStatistic->StatTimeLength*1000,
STATISTIC_TIMER,(char *)&s_Pid,NULL);
/* 創建定時器失敗 */
if (iReturnValue<0)
{
printf("Create timer Error!\n");
/* 結束統計進程 */
free_pid((char *)&s_Pid);
return iReturnValue;
}
/* 保存統計定時器在進程區尾部 */
memcpy(&ProcessData[s_Pid.iProcessId][LPCB_DATA_SIZE-sizeof(int)],&iReturnValue,sizeof(int));
}
break;
default:
{
/* 無法識別的統計類型 */
return UNRECOGNIZED_STATISTIC_TYPE;
}
break;
}
return s_Pid.iProcessId;
}
/* 處理小區廣播失敗和重新復位的次數的統計
* <0:返回錯誤, >=0:返回Pid
*/
int Process_Statistic_FailAndReset(CBEMESSAGE_t *LpCBEMessage)
{
MESSAGE_STATISTIC_t *LpMessageStatistic;
int iReturnValue;
PID_t s_Pid;
int Tid;
int i,j,k;
// CELL_RESET_AND_FAIL_STAT_RESULT_t s_CellResetAndFailStatResult;
CELL_RESETFAIL_COUNT_t s_Cell_ResetFail_Count;
unsigned char bIfCellExist;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -