Src/GPUPerfAPICounterGenerator/GPAInternalCounter.h
void SetCounterIndex(unsigned int index)
    {
        // count the number of counters that belong to groups that do not include the desired index
        unsigned int prevGroupCounters = 0;
        unsigned int tmpSum = 0;

        m_isHW = false;
        m_isAdditionalHW = false;
        m_isSW = false;

        unsigned int internalCounters = 0;

        for (unsigned int i = 0; i < m_hardwareGroupCount; ++i)
        {
            internalCounters += (unsigned int)m_pHardwareGroups[i].m_numCounters;
        }

        for (unsigned int i = 0; i < m_hardwareGroupCount; ++i)
        {
            tmpSum = prevGroupCounters + (unsigned int)m_pHardwareGroups[i].m_numCounters;

            if (tmpSum > index)
            {
                // this group contains the desired counter index.
                // this is the right group, and we can calculate the right counter.
                m_groupIndex = i;
                m_counterIndex = index - prevGroupCounters;

                // This is a HW counter
                m_isHW = true;

                // break from the loop
                break;
            }
            else
            {
                // this group does not include the desired counter index.
                // update the count and let the loop continue.
                prevGroupCounters = tmpSum;
            }
        }

        if (m_isHW == true)
        {
            return;
        }

        for (unsigned int i = 0; i < m_hardwareAdditionalGroupCount; ++i)
        {
            tmpSum = prevGroupCounters + (unsigned int)m_pHardwareAdditionalGroups[i].m_numCounters;

            if (tmpSum > index)
            {
                // this group contains the desired counter index.
                // this is the right group, and we can calculate the right counter.
                m_groupIndex = i;
                m_counterIndex = index - prevGroupCounters;

                // This is an additional HW counter
                m_isAdditionalHW = true;

                // break from the loop
                break;
            }
            else
            {
                // this group does not include the desired counter index.
                // update the count and let the loop continue.
                prevGroupCounters = tmpSum;
            }
        }

        if (m_isAdditionalHW == true)
        {
            return;
        }

#if defined(WIN32)

        m_groupIndex = 0;
        m_isSW = true;

        if (index >= internalCounters)
        {
            m_counterIndex = index - internalCounters;
        }
        else
        {
            m_counterIndex = index;
        }

        return;

#endif // WIN32

    }
/// Sets the counter index of which to get the group and counter Id.
/// \param index The counter index.
Sets the counter index of which to get the group and counter Id.
\param index The counter index.
Sets the counter index of which to get the group and counter Id . \ param index The counter index .
void SetCounterIndex(unsigned int index)
    {
        unsigned int prevGroupCounters = 0;
        unsigned int tmpSum = 0;
        m_isHW = false;
        m_isAdditionalHW = false;
        m_isSW = false;
        unsigned int internalCounters = 0;
        for (unsigned int i = 0; i < m_hardwareGroupCount; ++i)
        {
            internalCounters += (unsigned int)m_pHardwareGroups[i].m_numCounters;
        }
        for (unsigned int i = 0; i < m_hardwareGroupCount; ++i)
        {
            tmpSum = prevGroupCounters + (unsigned int)m_pHardwareGroups[i].m_numCounters;
            if (tmpSum > index)
            {
                m_groupIndex = i;
                m_counterIndex = index - prevGroupCounters;
                m_isHW = true;
                break;
            }
            else
            {
                prevGroupCounters = tmpSum;
            }
        }
        if (m_isHW == true)
        {
            return;
        }
        for (unsigned int i = 0; i < m_hardwareAdditionalGroupCount; ++i)
        {
            tmpSum = prevGroupCounters + (unsigned int)m_pHardwareAdditionalGroups[i].m_numCounters;
            if (tmpSum > index)
            {
                m_groupIndex = i;
                m_counterIndex = index - prevGroupCounters;
                m_isAdditionalHW = true;
                break;
            }
            else
            {
                prevGroupCounters = tmpSum;
            }
        }
        if (m_isAdditionalHW == true)
        {
            return;
        }
#if defined(WIN32)
        m_groupIndex = 0;
        m_isSW = true;
        if (index >= internalCounters)
        {
            m_counterIndex = index - internalCounters;
        }
        else
        {
            m_counterIndex = index;
        }
        return;
#endif 
    }
void SetCounterIndex ( unsigned int index ) { unsigned int prevGroupCounters = 0 ; unsigned int tmpSum = 0 ; m_isHW = false ; m_isAdditionalHW = false ; m_isSW = false ; unsigned int internalCounters = 0 ; for ( unsigned int i = 0 ; i < m_hardwareGroupCount ; ++ i ) { internalCounters += ( unsigned int ) m_pHardwareGroups [ i ] . m_numCounters ; } for ( unsigned int i = 0 ; i < m_hardwareGroupCount ; ++ i ) { tmpSum = prevGroupCounters + ( unsigned int ) m_pHardwareGroups [ i ] . m_numCounters ; if ( tmpSum > index ) { m_groupIndex = i ; m_counterIndex = index - prevGroupCounters ; m_isHW = true ; break ; } else { prevGroupCounters = tmpSum ; } } if ( m_isHW == true ) { return ; } for ( unsigned int i = 0 ; i < m_hardwareAdditionalGroupCount ; ++ i ) { tmpSum = prevGroupCounters + ( unsigned int ) m_pHardwareAdditionalGroups [ i ] . m_numCounters ; if ( tmpSum > index ) { m_groupIndex = i ; m_counterIndex = index - prevGroupCounters ; m_isAdditionalHW = true ; break ; } else { prevGroupCounters = tmpSum ; } } if ( m_isAdditionalHW == true ) { return ; } #if defined ( WIN32 ) m_groupIndex = 0 ; m_isSW = true ; if ( index >= internalCounters ) { m_counterIndex = index - internalCounters ; } else { m_counterIndex = index ; } return ; #endif }
Sets the counter index of which to get the group and counter Id.
Sets the counter index of which to get the group and counter Id .
// count the number of counters that belong to groups that do not include the desired index // this group contains the desired counter index. // this is the right group, and we can calculate the right counter. // This is a HW counter // break from the loop // this group does not include the desired counter index. // update the count and let the loop continue. // this group contains the desired counter index. // this is the right group, and we can calculate the right counter. // This is an additional HW counter // break from the loop // this group does not include the desired counter index. // update the count and let the loop continue. // WIN32