예제 #1
0
//-------------------------------------------------------------------------
// FUNCTION     : NdpFinalize(Node* node)
//
// PURPOSE      : Printing the statisdics collected during simulation.
//
// PARAMETERS   : node - Node which is printing the statistics.
//
// RETURN VALUE : None
//-------------------------------------------------------------------------
void NdpFinalize(Node* node)
{
    NdpData* ndpData = NdpGetNdpData(node);
    char buf[MAX_STRING_LENGTH] = {0};

    if ((ndpData) && (ndpData->collectStats == TRUE) &&
        (ndpData->stats.isStatPrinted == FALSE))
    {
        // Print number of hello message send
        sprintf(buf, "Number of Hello Message Send = %u",
                ndpData->stats.numHelloSend);
        IO_PrintStat(node, "Network", "NDP", ANY_DEST,
            ANY_INTERFACE, buf);

        // Print number of hello message received
        sprintf(buf, "Number of Hello Message Reseived = %u",
                ndpData->stats.numHelloReceived);
        IO_PrintStat(node, "Network", "NDP", ANY_DEST,
            ANY_INTERFACE, buf);

        if (NDP_DEBUG)
        {
            // DEBUG statement.: print neignbor table
            NdpPrintNeighborTable(node, ndpData);
        }
        ndpData->stats.isStatPrinted = TRUE;
    }
}
예제 #2
0
void NetworkCoding::Printstat(Node* node, NetworkType networkType) {
    char statbuf[MAX_STRING_LENGTH];
    sprintf(statbuf, "DataObject Reconstructed = %d", m_stat.totalObjectReconstructed);
    IO_PrintStat(node, "NetworkCoding", "ICAN", ANY_DEST, 0, statbuf);

    sprintf(statbuf, "NetworkCoding blocks generated = %d", m_stat.totalBlockGenerated);
    IO_PrintStat(node, "NetworkCoding", "ICAN", ANY_DEST, 0, statbuf);

    sprintf(statbuf, "NetworkCoding blocks received = %d", m_stat.totalBlockReceived);
    IO_PrintStat(node, "NetworkCoding", "ICAN", ANY_DEST, 0, statbuf);
}
예제 #3
0
void FragmentationManager::Printstat(Node* node, NetworkType networkType) {

    char statbuf[MAX_STRING_LENGTH];
    sprintf(statbuf, "DataObject Reconstructed = %d", m_stat.totalObjectReconstructed);
    IO_PrintStat(m_node, "Fragmentation", "ICAN", ANY_DEST, 0, statbuf);

    sprintf(statbuf, "Fragment blocks generated = %d", m_stat.totalBlockGenerated);
    IO_PrintStat(m_node, "Fragmentation", "ICAN", ANY_DEST, 0, statbuf);

    sprintf(statbuf, "Fragment blocks received = %d", m_stat.totalBlockReceived);
    IO_PrintStat(m_node, "Fragmentation", "ICAN", ANY_DEST, 0, statbuf);
}   
예제 #4
0
파일: mac_aloha.cpp 프로젝트: LXiong/ccn
void AlohaPrintStats(Node* node, AlohaData* dataPtr, int interfaceIndex) {
    AlohaStatsType *stats = &(dataPtr->stats);
    char buf[MAX_STRING_LENGTH];

    char statProtocolName[MAX_STRING_LENGTH];
    strcpy(statProtocolName,"Aloha");
    sprintf(buf, "Packets Sent to Channel = %d", stats->pktsSent);
    IO_PrintStat(node, "Mac", statProtocolName, ANY_DEST, interfaceIndex, buf);
    sprintf(buf, "Packets Received from Channel = %d", stats->pktsReceived);
    IO_PrintStat(node, "Mac", statProtocolName, ANY_DEST, interfaceIndex, buf);
    sprintf(buf, "Packets Dropped = %d", stats->pktsDropped);
    IO_PrintStat(node, "Mac", statProtocolName, ANY_DEST, interfaceIndex, buf);
}
/*
 * Protocol finalization function.
 */
void DearFinalize(Node *node) {
 char buf[MAX_STRING_LENGTH];
 
 // Obtain a pointer to the local variable space.
 DearData* dear = (DearData*)NetworkIpGetRoutingProtocol(node, ROUTING_PROTOCOL_DEAR);
 assert(dear != NULL);
 
 // Report statistics in stat file.
 // Direct transmissions.
 sprintf(buf, "Number of direct transmissions = %u", dear->numDirectTransmissions);
 IO_PrintStat(node, "Network", "DEAR", ANY_DEST, -1, buf);
 
 // Indirect transmissions.
 sprintf(buf, "Number of indirect transmissions = %u", dear->numIndirectTransmissions);
 IO_PrintStat(node, "Network", "DEAR", ANY_DEST, -1, buf);
}
예제 #6
0
파일: routing_brp.cpp 프로젝트: LXiong/ccn
void BrpPrintStats(Node* node)
{
    // Ha ha now this function is empty
    IerpData* ierpData = (IerpData*) IerpGetRoutingProtocol(
                            node,
                            ROUTING_PROTOCOL_IERP);

    BrpData* brpData = (BrpData*) ierpData->brpData;

    char buf[MAX_STRING_LENGTH];

    char statProtocolName[MAX_STRING_LENGTH];
    strcpy(statProtocolName,"BRP");
    sprintf(buf, "Number of query packets sent = %u",
                            brpData->stat.numQuerySent);
    IO_PrintStat(node, "Network", statProtocolName, ANY_DEST, -1, buf);
    sprintf(buf, "Number of query packets received = %u",
                            brpData->stat.numQueryReceived);
    IO_PrintStat(node, "Network", statProtocolName, ANY_DEST, -1, buf);
}
예제 #7
0
파일: mac_tdma.cpp 프로젝트: renjikari/ccn
/*
 * FUNCTION    MAC_Finalize
 * PURPOSE     Called at the end of simulation to collect the results of
 *             the simulation of the TDMA protocol of MAC Layer.
 *
 * Parameter:
 *     node:     node for which results are to be collected.
 */
void MacTdmaFinalize(Node *node, int interfaceIndex) {
    MacDataTdma* tdma = (MacDataTdma *)node->macData[interfaceIndex]->macVar;

    if (node->macData[interfaceIndex]->macStats == TRUE) {
        char buf[MAX_STRING_LENGTH];

        sprintf(buf, "UNICAST packets sent to the channel = %d",
                tdma->stats.pktsSentUnicast);
        IO_PrintStat(node, "MAC", "TDMA", ANY_DEST, interfaceIndex, buf);

        sprintf(buf, "BROADCAST packets sent to the channel = %d",
                tdma->stats.pktsSentBroadcast);
        IO_PrintStat(node, "MAC", "TDMA", ANY_DEST, interfaceIndex, buf);
        sprintf(buf, "UNICAST packets received = %d",
                tdma->stats.pktsGotUnicast);
        IO_PrintStat(node, "MAC", "TDMA", ANY_DEST, interfaceIndex, buf);

        sprintf(buf, "BROADCAST packets received = %d",
                tdma->stats.pktsGotBroadcast);
        IO_PrintStat(node, "MAC", "TDMA", ANY_DEST, interfaceIndex, buf);
    }
}
예제 #8
0
/*
 * NAME:        ZigbeeAppServerPrintStats.
 * PURPOSE:     Prints statistics of a ZigbeeAppServer session.
 * PARAMETERS:  node - pointer to this node.
 *              serverPtr - pointer to the zigbeeApp server data structure.
 * RETURN:      none.
 */
void
ZigbeeAppServerPrintStats(Node* node, AppDataZigbeeappServer* serverPtr)
{
    clocktype throughput = 0;
    clocktype avgJitter = 0;
    char addrStr[MAX_STRING_LENGTH];
    char jitterStr[MAX_STRING_LENGTH];
    char clockStr[MAX_STRING_LENGTH];
    char startStr[MAX_STRING_LENGTH];
    char closeStr[MAX_STRING_LENGTH];
    char sessionStatusStr[MAX_STRING_LENGTH];
    char throughputStr[MAX_STRING_LENGTH];
    char buf[MAX_STRING_LENGTH];
    char buf1[MAX_STRING_LENGTH];

    TIME_PrintClockInSecond(serverPtr->sessionStart, startStr, node);
    TIME_PrintClockInSecond(serverPtr->sessionLastReceived, closeStr, node);

    if (serverPtr->sessionIsClosed == FALSE)
    {
        serverPtr->sessionFinish = node->getNodeTime();
        sprintf(sessionStatusStr, "Not closed");
    }
    else
    {
        sprintf(sessionStatusStr, "Closed");
    }

    if (serverPtr->numPktsRecvd == 0)
    {
        TIME_PrintClockInSecond(0, clockStr);
    }
    else
    {
        TIME_PrintClockInSecond(
                    serverPtr->totalEndToEndDelay / serverPtr->numPktsRecvd,
                    clockStr);
    }

    if (serverPtr->sessionFinish <= serverPtr->sessionStart)
    {
        throughput = 0;
    }
    else
    {
        throughput = (clocktype)
                     ((serverPtr->numBytesRecvd * 8.0 * SECOND)
                      / (serverPtr->sessionFinish
                      - serverPtr->sessionStart));
    }

    ctoa(throughput, throughputStr);

    IO_ConvertIpAddressToString(&serverPtr->remoteAddr, addrStr);

    sprintf(buf, "Client address = %s", addrStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "First Packet Received at (s) = %s", startStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "Last Packet Received at (s) = %s", closeStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "Session Status = %s", sessionStatusStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);


    ctoa((Int64) serverPtr->numBytesRecvd, buf1);
    sprintf(buf, "Total Bytes Received = %s", buf1);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "Total Packets Received = %u", serverPtr->numPktsRecvd);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "Throughput (bits/s) = %s", throughputStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    sprintf(buf, "Average End-to-End Delay (s) = %s", clockStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);

    // Jitter can only be measured after receiving two packets.
    if (serverPtr->numPktsRecvd - 1 <= 0)
    {
        avgJitter = 0;
    }
    else
    {
        avgJitter = serverPtr->totalJitter / (serverPtr->numPktsRecvd-1) ;
    }

    TIME_PrintClockInSecond(avgJitter, jitterStr);

    sprintf(buf, "Average Jitter (s) = %s", jitterStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Server",
                 ANY_DEST,
                 serverPtr->sourcePort,
                 buf);
}
예제 #9
0
/*
 * NAME:        ZigbeeAppClientPrintStats.
 * PURPOSE:     Prints statistics of a zigbeeAppClient session.
 * PARAMETERS:  node - pointer to the this node.
 *              clientPtr - pointer to the zigbeeApp client data structure.
 * RETURN:      none.
 */
void ZigbeeAppClientPrintStats(Node* node,
                               AppDataZigbeeappClient* clientPtr)
{
    clocktype throughput = 0;
    char addrStr[MAX_STRING_LENGTH];
    char startStr[MAX_STRING_LENGTH];
    char closeStr[MAX_STRING_LENGTH];
    char sessionStatusStr[MAX_STRING_LENGTH];
    char throughputStr[MAX_STRING_LENGTH];

    char buf[MAX_STRING_LENGTH];
    char buf1[MAX_STRING_LENGTH];

    TIME_PrintClockInSecond(clientPtr->sessionStart, startStr, node);
    TIME_PrintClockInSecond(clientPtr->sessionLastSent, closeStr, node);

    if (clientPtr->sessionIsClosed == FALSE)
    {
        clientPtr->sessionFinish = node->getNodeTime();
        sprintf(sessionStatusStr, "Not closed");
    }
    else
    {
        sprintf(sessionStatusStr, "Closed");
    }

    if (clientPtr->sessionFinish <= clientPtr->sessionStart)
    {
        throughput = 0;
    }
    else
    {
        throughput = (clocktype)
                     ((clientPtr->numBytesSent * 8.0 * SECOND)
                      / (clientPtr->sessionFinish
                      - clientPtr->sessionStart));
    }

    ctoa(throughput, throughputStr);

    if (clientPtr->remoteAddr.networkType == NETWORK_ATM)
    {
        const LogicalSubnet* dstLogicalSubnet =
            AtmGetLogicalSubnetFromNodeId(
            node,
            clientPtr->remoteAddr.interfaceAddr.atm.ESI_pt1,
            0);
        IO_ConvertIpAddressToString(
            dstLogicalSubnet->ipAddress,
            addrStr);
    }
    else
    {
        IO_ConvertIpAddressToString(&clientPtr->remoteAddr, addrStr);

    }

    sprintf(buf, "Server Address = %s", addrStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    sprintf(buf, "First Packet Sent at (s) = %s", startStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    sprintf(buf, "Last Packet Sent at (s) = %s", closeStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    sprintf(buf, "Session Status = %s", sessionStatusStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    ctoa((Int64) clientPtr->numBytesSent, buf1);
    sprintf(buf, "Total Bytes Sent = %s", buf1);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    sprintf(buf, "Total Packets Sent = %u", clientPtr->numPktsSent);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);

    sprintf(buf, "Throughput (bits/s) = %s", throughputStr);
    IO_PrintStat(node,
                 "Application",
                 "ZIGBEEAPP Client",
                 ANY_DEST,
                 clientPtr->sourcePort,
                 buf);
}