void SamplingTool::run() { while (m_running) { sleepForMicroseconds(hertz2us(m_hertz)); Sample sample(m_sample, m_codeBlock); ++m_sampleCount; if (sample.isNull()) continue; if (!sample.inHostFunction()) { unsigned opcodeID = m_interpreter->getOpcodeID(sample.vPC()[0].u.opcode); ++m_opcodeSampleCount; ++m_opcodeSamples[opcodeID]; if (sample.inCTIFunction()) m_opcodeSamplesInCTIFunctions[opcodeID]++; } #if ENABLE(CODEBLOCK_SAMPLING) MutexLocker locker(m_scopeSampleMapMutex); ScopeSampleRecord* record = m_scopeSampleMap->get(sample.codeBlock()->ownerNode); ASSERT(record); record->sample(sample.codeBlock(), sample.vPC()); #endif } }
void* SamplingThread::threadStartFunc(void*) { while (s_running) { sleepForMicroseconds(hertz2us(s_hertz)); #if ENABLE(SAMPLING_FLAGS) SamplingFlags::sample(); #endif #if ENABLE(OPCODE_SAMPLING) SamplingTool::sample(); #endif } return 0; }