当前位置: 首页>>代码示例>>C++>>正文


C++ DataFrame::setTotalPacketsIn方法代码示例

本文整理汇总了C++中DataFrame::setTotalPacketsIn方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFrame::setTotalPacketsIn方法的具体用法?C++ DataFrame::setTotalPacketsIn怎么用?C++ DataFrame::setTotalPacketsIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataFrame的用法示例。


在下文中一共展示了DataFrame::setTotalPacketsIn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateMinMax

void Statistics::calculateMinMax(const DataFrame& dataFrame, DataFrame& min, DataFrame& max)
{
    if(dataFrame.getTotalDataIn() < min.getTotalDataIn())
        min.setTotalDataIn(dataFrame.getTotalDataIn());
    if(dataFrame.getTotalDataIn() > max.getTotalDataIn())
        max.setTotalDataIn(dataFrame.getTotalDataIn());
    if(dataFrame.getTotalDataOut() < min.getTotalDataOut())
        min.setTotalDataOut(dataFrame.getTotalDataOut());
    if(dataFrame.getTotalDataOut() > max.getTotalDataOut())
        max.setTotalDataOut(dataFrame.getTotalDataOut());

    if(dataFrame.getTotalPacketsIn() < min.getTotalPacketsIn())
        min.setTotalPacketsIn(dataFrame.getTotalPacketsIn());
    if(dataFrame.getTotalPacketsIn() > max.getTotalPacketsIn())
        max.setTotalPacketsIn(dataFrame.getTotalPacketsIn());
    if(dataFrame.getTotalPacketsOut() < min.getTotalPacketsOut())
        min.setTotalPacketsOut(dataFrame.getTotalPacketsOut());
    if(dataFrame.getTotalPacketsOut() > max.getTotalPacketsOut())
        max.setTotalPacketsOut(dataFrame.getTotalPacketsOut());

    if(dataFrame.getTotalErrorsIn() < min.getTotalErrorsIn())
        min.setTotalErrorsIn(dataFrame.getTotalErrorsIn());
    if(dataFrame.getTotalErrorsIn() > max.getTotalErrorsIn())
        max.setTotalErrorsIn(dataFrame.getTotalErrorsIn());
    if(dataFrame.getTotalErrorsOut() < min.getTotalErrorsOut())
        min.setTotalErrorsOut(dataFrame.getTotalErrorsOut());
    if(dataFrame.getTotalErrorsOut() > max.getTotalErrorsOut())
        max.setTotalErrorsOut(dataFrame.getTotalErrorsOut());

    if(dataFrame.getTotalDropsIn() < min.getTotalDropsIn())
        min.setTotalDropsIn(dataFrame.getTotalDropsIn());
    if(dataFrame.getTotalDropsIn() > max.getTotalDropsIn())
        max.setTotalDropsIn(dataFrame.getTotalDropsIn());
    if(dataFrame.getTotalDropsOut() < min.getTotalDropsOut())
        min.setTotalDropsOut(dataFrame.getTotalDropsOut());
    if(dataFrame.getTotalDropsOut() > max.getTotalDropsOut())
        max.setTotalDropsOut(dataFrame.getTotalDropsOut());
}
开发者ID:JackSzwergold,项目名称:nload-0.7.4-mac-os-x-10.9.3,代码行数:38,代码来源:statistics.cpp

示例2: fixOverflows

void Device::fixOverflows(DataFrame& dataFrame, const DataFrame& dataFrameOld)
{
    if(!dataFrame.isValid() || !dataFrameOld.isValid())
        return;

    dataFrame.setTotalDataIn(fixOverflow(dataFrame.getTotalDataIn(), dataFrameOld.getTotalDataIn()));
    dataFrame.setTotalDataOut(fixOverflow(dataFrame.getTotalDataOut(), dataFrameOld.getTotalDataOut()));
    dataFrame.setTotalPacketsIn(fixOverflow(dataFrame.getTotalPacketsIn(), dataFrameOld.getTotalPacketsIn()));
    dataFrame.setTotalPacketsOut(fixOverflow(dataFrame.getTotalPacketsOut(), dataFrameOld.getTotalPacketsOut()));
    dataFrame.setTotalErrorsIn(fixOverflow(dataFrame.getTotalErrorsIn(), dataFrameOld.getTotalErrorsIn()));
    dataFrame.setTotalErrorsOut(fixOverflow(dataFrame.getTotalErrorsOut(), dataFrameOld.getTotalErrorsOut()));
    dataFrame.setTotalDropsIn(fixOverflow(dataFrame.getTotalDropsIn(), dataFrameOld.getTotalDropsIn()));
    dataFrame.setTotalDropsOut(fixOverflow(dataFrame.getTotalDropsOut(), dataFrameOld.getTotalDropsOut()));
}
开发者ID:rsaxvc,项目名称:ioload,代码行数:14,代码来源:device.cpp

示例3: calculateAverage

void Statistics::calculateAverage(const DataFrame& dataFrameFrom, const DataFrame& dataFrameTo, DataFrame& result)
{
    float timeSpan = (dataFrameTo.getTimeStampSeconds() + dataFrameTo.getTimeStampMicroseconds() / 1000000.0) -
                     (dataFrameFrom.getTimeStampSeconds() + dataFrameFrom.getTimeStampMicroseconds() / 1000000.0);

    if(timeSpan <= 0)
        return;

    result.setTotalDataIn((unsigned long long)((dataFrameTo.getTotalDataIn() - dataFrameFrom.getTotalDataIn()) / timeSpan));
    result.setTotalDataOut((unsigned long long)((dataFrameTo.getTotalDataOut() - dataFrameFrom.getTotalDataOut()) / timeSpan));
    result.setTotalPacketsIn((unsigned long long)((dataFrameTo.getTotalPacketsIn() - dataFrameFrom.getTotalPacketsIn()) / timeSpan));
    result.setTotalPacketsOut((unsigned long long)((dataFrameTo.getTotalPacketsOut() - dataFrameFrom.getTotalPacketsOut()) / timeSpan));
    result.setTotalErrorsIn((unsigned long long)((dataFrameTo.getTotalErrorsIn() - dataFrameFrom.getTotalErrorsIn()) / timeSpan));
    result.setTotalErrorsOut((unsigned long long)((dataFrameTo.getTotalErrorsOut() - dataFrameFrom.getTotalErrorsOut()) / timeSpan));
    result.setTotalDropsIn((unsigned long long)((dataFrameTo.getTotalDropsIn() - dataFrameFrom.getTotalDropsIn()) / timeSpan));
    result.setTotalDropsOut((unsigned long long)((dataFrameTo.getTotalDropsOut() - dataFrameFrom.getTotalDropsOut()) / timeSpan));
}
开发者ID:JackSzwergold,项目名称:nload-0.7.4-mac-os-x-10.9.3,代码行数:17,代码来源:statistics.cpp

示例4: readFromDevice

void DevReaderLinuxProc::readFromDevice(DataFrame& dataFrame)
{
    if(m_deviceName.empty())
        return;
    
    ifstream fin("/proc/net/dev");
    if(!fin.is_open())
        return;
    
    // skip the two header lines
    string line;
    getline(fin, line);
    getline(fin, line);

    if(!fin.good())
        return;

    // search for device
    while(fin.good())
    {
        getline(fin, line);
        if(line.empty())
            continue;

        string::size_type posEnd = line.find(':');
        if(posEnd == string::npos)
            continue;

        string interfaceName = trim(line.substr(0, posEnd));
        if(interfaceName.empty())
            continue;

        // check if it is the device we want
        if(m_deviceName != interfaceName)
            continue;

        // read device data
        unsigned long long bytesIn = 0;
        unsigned long long packetsIn = 0;
        unsigned long long errorsIn = 0;
        unsigned long long dropsIn = 0;
        unsigned long long bytesOut = 0;
        unsigned long long packetsOut = 0;
        unsigned long long errorsOut = 0;
        unsigned long long dropsOut = 0;
        unsigned long long dummy = 0;

        istringstream sin(trim(line.substr(posEnd + 1)));

        sin >> bytesIn
            >> packetsIn
            >> errorsIn
            >> dropsIn
            >> dummy
            >> dummy
            >> dummy
            >> dummy
            >> bytesOut
            >> packetsOut
            >> errorsOut
            >> dropsOut;

        if(sin.fail())
            break;
        
        dataFrame.setTotalDataIn(bytesIn);
        dataFrame.setTotalDataOut(bytesOut);

        dataFrame.setTotalPacketsIn(packetsIn);
        dataFrame.setTotalPacketsOut(packetsOut);

        dataFrame.setTotalErrorsIn(errorsIn);
        dataFrame.setTotalErrorsOut(errorsOut);
        
        dataFrame.setTotalDropsIn(dropsIn);
        dataFrame.setTotalDropsOut(dropsOut);
        
        dataFrame.setValid(true);
        
        break;
    }
}
开发者ID:duskCoder,项目名称:nload,代码行数:82,代码来源:devreader-linux-proc.cpp


注:本文中的DataFrame::setTotalPacketsIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。