SeqLenAnalysis::SeqLenAnalysis(QWidget *parent) : QDialog(parent), ui(new Ui::SeqLenAnalysis), m_color(Qt::red) { ui->setupUi(this); connect(ui->seqLenTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(chooseItem(QTableWidgetItem*))); connect(ui->mark, SIGNAL(clicked()), this, SLOT(markDone())); connect(ui->changeColor, SIGNAL(clicked()), this, SLOT(changeColor())); m_chooseK[ui->k1] = 1; m_chooseK[ui->k2] = 2; m_chooseK[ui->k3] = 3; m_chooseK[ui->k4] = 4; m_chooseK[ui->k5] = 5; m_chooseK[ui->k6] = 6; for (auto c: m_chooseK) { connect(c.first, SIGNAL(pressed()), this, SLOT(chooseK())); if (c.first->isChecked()) { m_currentK = c.second; } } }
bool SamplerPeriodic::isItDone() { if (getTime()>=maxnsTime) { markDone(); return true; } return false; }
void SamplerGPUSpacial::queue(uint32_t insn, uint64_t pc, uint64_t addr, FlowID fid, char op, uint64_t icount, void *env) /* main qemu/gpu/tracer/... entry point */ { if(likely(!execute(fid, icount))) return; // QEMU can still send a few additional instructions (emul should stop soon) I(mode!=EmuInit); I(insn); if (mode == EmuRabbit || mode == EmuWarmup){ if (doPower && noActiveCPU()) { if (lastMode == EmuTiming) { #if 1 // For now GPU only, CPU side must be all rabbit! doPWTH(); #endif } } lastMode = mode; return; } if (mode == EmuDetail || mode == EmuTiming) { emul->queueInstruction(insn,pc,addr, (op&0xc0) /* thumb */ ,fid, env, getStatsFlag()); lastMode = mode; return; } // not happening for GPU, the CPU will decide! // We did enough //if (totalnInst >= nInstMax/* || endSimSiged*/) { if (totalnInst >= nInstMax) { markDone(); return; } }
void SamplerSMARTS::queue(uint32_t insn, uint64_t pc, uint64_t addr, FlowID fid, char op, uint64_t icount, void *env) /* main qemu/gpu/tracer/... entry point {{{1 */ { I(fid < emul->getNumEmuls()); if(likely(!execute(fid, icount))) return; // QEMU can still send a few additional instructions (emul should stop soon) I(mode!=EmuInit); I(insn); // process the current sample mode if (getNextSwitch()>totalnInst) { if (mode == EmuRabbit || mode == EmuInit) return; if (mode == EmuDetail || mode == EmuTiming) { emul->queueInstruction(insn,pc,addr, (op&0xc0) /* thumb */ ,fid, env, getStatsFlag()); return; } I(mode == EmuWarmup); doWarmupOpAddr(op, addr); return; } // Look for the new mode I(getNextSwitch() <= totalnInst); // I(mode != next_mode); pthread_mutex_lock (&mode_lock); // if (getNextSwitch() > totalnInst){//another thread just changed the mode pthread_mutex_unlock (&mode_lock); return; } lastMode = mode; nextMode(ROTATE, fid); if (lastMode == EmuTiming) { // timing is going to be over if (getTime()>=maxnsTime || totalnInst>=nInstMax) { markDone(); pthread_mutex_unlock (&mode_lock); return; } if (doPower) { uint64_t mytime = getTime(); int64_t ti = mytime - lastTime; I(ti > 0); ti = (static_cast<int64_t>(freq)*ti)/1e9; BootLoader::getPowerModelPtr()->setSamplingRatio(getSamplingRatio()); BootLoader::getPowerModelPtr()->calcStats(ti, !(lastMode == EmuTiming), fid); lastTime = mytime; updateCPI(fid); if (doTherm) { BootLoader::getPowerModelPtr()->updateSescTherm(ti); } } } pthread_mutex_unlock (&mode_lock); }
uint64_t SamplerSMARTS::queue(uint64_t pc, uint64_t addr, FlowID fid, char op, int src1, int src2, int dest, int dest2) /* main qemu/gpu/tracer/... entry point {{{1 */ { I(fid < emul->getNumEmuls()); if(likely(!execute(fid, 1))) return 0; // QEMU can still send a few additional instructions (emul should stop soon) I(mode!=EmuInit); // process the current sample mode if (getNextSwitch()>totalnInst) { if (mode == EmuRabbit || mode == EmuInit) { uint64_t rabbitInst = getNextSwitch() - totalnInst; execute(fid,rabbitInst); // Qemu is not going to return untill it has executed these many instructions // Or untill it hits a syscall that causes it to exit // Untill then, you are on your own. Sit back and relax! return rabbitInst; } if (mode == EmuDetail || mode == EmuTiming) { emul->queueInstruction(pc,addr, fid, op, src1, src2, dest, dest2, getStatsFlag()); return 0; } I(mode == EmuWarmup); #if 1 if ( op == iLALU_LD || op == iSALU_ST) // cache warmup fake inst, do not need SRC deps (faster) emul->queueInstruction(0,addr, fid, op, LREG_R0, LREG_R0, LREG_InvalidOutput, LREG_InvalidOutput, false); #else //doWarmupOpAddr(static_cast<InstOpcode>(op), addr); #endif return 0; } // Look for the new mode I(getNextSwitch() <= totalnInst); // I(mode != next_mode); pthread_mutex_lock (&mode_lock); // if (getNextSwitch() > totalnInst){//another thread just changed the mode pthread_mutex_unlock (&mode_lock); return 0; } lastMode = mode; nextMode(ROTATE, fid); if (lastMode == EmuTiming) { // timing is going to be over #if 0 static double last_timing = 0; static long long last_globalClock = 0; MSG("%f %lld" ,iusage[EmuTiming]->getDouble() ,globalClock-last_globalClock); last_timing = iusage[EmuTiming]->getDouble(); last_globalClock = globalClock; #endif BootLoader::reportSample(); if (getTime()>=maxnsTime || totalnInst>=nInstMax) { markDone(); pthread_mutex_unlock (&mode_lock); return 0; } if (doPower) { uint64_t mytime = getTime(); int64_t ti = mytime - lastTime; I(ti > 0); ti = (static_cast<int64_t>(freq)*ti)/1e9; BootLoader::getPowerModelPtr()->setSamplingRatio(getSamplingRatio()); BootLoader::getPowerModelPtr()->calcStats(ti, !(lastMode == EmuTiming), fid); lastTime = mytime; updateCPI(fid); if (doTherm) { BootLoader::getPowerModelPtr()->updateSescTherm(ti); } } } pthread_mutex_unlock (&mode_lock); return 0; }
void SamplerGPUSim::queue(uint32_t insn, uint64_t pc, uint64_t addr, uint32_t fid, char op) /* main qemu/gpu/tracer/... entry point {{{1 */ { if(!execute(fid,icount)) return; // QEMU can still send a few additional instructions (emul should stop soon) I(mode!=EmuInit); I(insn!=0); I(icount!=0); if (doPower){ uint64_t ti = 0; bool callpwr = callPowerModel(ti, fid); if (callpwr){ I(ti > 0); //printf("totalnInst:%ld, nPassedInst:%ld, interval:%ld\n", totalnInst, nPassedInst, interval); bool dummy = false; //std::cout<<"mode "<<mode<<" Timeinterval "<<ti<<" last time "<<lastTime<<"\n"; int simt = 0; if (ti > 0){ setMode(EmuTiming, fid); simt = BootLoader::pwrmodel.calcStats(ti, !(mode == EmuTiming), static_cast<float>(freq), dummy, dummy, dummy, dummy); endSimSiged = (simt==90)?1:0; BootLoader::pwrmodel.sescThermWrapper->sesctherm.updateMetrics(); } } }// doPower if (nInstMax < totalnInst || endSimSiged) { markDone(); return; } if (nInstSkip>totalnInst) { I(mode==EmuRabbit); return; } I(nInstSkip<=totalnInst); if (mode == EmuRabbit) { stop(); startTiming(fid); } #if 0 static std::set<AddrType> seenPC; static Time_t seenPC_last = 0; static Time_t seenPC_active = 0; static Time_t seenPC_total = 0; seenPC_total++; if (seenPC.find(pc^insn) == seenPC.end()) { seenPC.insert(pc^insn); seenPC_last = seenPC_total; } if ((seenPC_last+1000) > seenPC_total) seenPC_active++; /* if ((seenPC_total & 1048575) == 1) MSG("%5.3f",(100.0*seenPC_active)/(1.0+seenPC_total)); */ #endif emul->queueInstruction(insn,pc,addr, (op&0x80) /* thumb */, fid); }