virtual bool sample() { GLuint counterIndex, unused; UINT64 events, cycles; // Sample the GPU counters NVPMSample(NULL, &unused); // Retrieve the current sample values for (counterIndex = 0; counterIndex < m_counterIndexArrayCount; counterIndex++) { NVPMGetCounterValue(m_counterIndexArray[counterIndex], 0, &events, &cycles); m_counterValues[counterIndex][m_counterValuesRRIndex] = 100.0f * float(events) / float(cycles); } m_counterValuesRRIndex++; if (m_counterValuesRRIndex >= bufferEntryCount) { m_counterValuesRRIndex = 0; } return true; }
void app::perf::step(bool log) { if (val && avg) { // Sample the current counter values. NVPMSample(val, &num); // Accumulate running totals. for (UINT i = 0; i < num; ++i) { avg[i].ulValue += val[i].ulValue; avg[i].ulCycles += val[i].ulCycles; } // Dump averages. if (tot++ == lim) dump(log); } }