コード例 #1
0
int64_t LoadEqualizer::_getTotalTime()
{
    const LBFrameData& frameData = _history.front();
    LBDatas items = frameData.second;
    _removeEmpty( items );

    int64_t totalTime = 0;
    for( LBDatas::const_iterator i = items.begin(); i != items.end(); ++i )
    {
        const Data& data = *i;
        totalTime += data.time;
    }
    return totalTime;
}
コード例 #2
0
int64_t LoadEqualizer::_getAssembleTime( )
{
    const LBFrameData& frameData = _history.front();
    LBDatas items( frameData.second );
    _removeEmpty( items );

    int64_t assembleTime = 0;
    for( LBDatas::const_iterator i = items.begin(); i != items.end(); ++i )
    {  
        const Data& data = *i;
        EQASSERT( assembleTime == 0 || data.assembleTime == 0 );
        assembleTime += data.assembleTime;
    }
    return assembleTime;
}
コード例 #3
0
void LoadEqualizer::_computeSplit()
{
    LBASSERT( !_history.empty( ));

    const LBFrameData& frameData = _history.front();
    const Compound* compound = getCompound();
    LBLOG( LOG_LB2 ) << "----- balance " << compound->getChannel()->getName()
                    << " using frame " << frameData.first << " tree "
                     << std::endl << _tree;

    // sort load items for each of the split directions
    LBDatas items( frameData.second );
    _removeEmpty( items );

    LBDatas sortedData[3] = { items, items, items };

    if( getMode() == MODE_DB )
    {
        LBDatas& rangeData = sortedData[ MODE_DB ];
        sort( rangeData.begin(), rangeData.end(), _compareRange );
    }
    else
    {
        LBDatas& xData = sortedData[ MODE_VERTICAL ];
        sort( xData.begin(), xData.end(), _compareX );

        LBDatas& yData = sortedData[ MODE_HORIZONTAL ];
        sort( yData.begin(), yData.end(), _compareY );

#ifndef NDEBUG
        for( LBDatas::const_iterator i = xData.begin(); i != xData.end();
             ++i )
        {
            const Data& data = *i;
            LBLOG( LOG_LB2 ) << "  " << data.vp << ", time " << data.time
                             << " (+" << data.assembleTime << ")" << std::endl;
        }
#endif
    }

    const float time = float( _getTotalTime( ));
    LBLOG( LOG_LB2 ) << "Render time " << time << " for "
                     << _tree->resources << " resources" << std::endl;
    if( _tree->resources > 0.f )
        _computeSplit( _tree, time, sortedData, Viewport(), Range( ));
}