MainScreen::MainScreen() : eventPeriodIndexTransmission(-1), editScreenMode(SEMInit) { readOptionsFormDevice(); applyOptions(); Styler::update(); mass = this; screenOptions = new ScreenOptions(this); waitMsg = new WaitMessage(); waitMsg->setTitle(Lang::getString(GS_WAIT)); screenEditEvent = new EditEventScreen(this); dbgPopup = new PopupMessage(); dbgPopup->setTitle(Lang::getString(GS_WAIT)); popProgress = new PopupProgress(Lang::getString(GS_WAITPB)); pmAlarmContextMenuClick = new PopupMenu(this); eventsList.regCallback(updateParseEventInfo); fontOverload(); createUI(); initLoad(); }
Load *createLoad(void *data) { Load *l = allocLoad(); initLoad(l); l->data = data; return l; }
VOID resizePDF(VOID *hwnd) { HAB habT; HMQ hmqT; CHAR errMsg1[80]; CHAR sizeStr[15]; ULONG totalSpace, allocated, available; ULONG drvNum, drvNumOrg, ulDriveMap; struct find_t ffblk; struct Smp { SHORT indx; CHAR noteName[NAMESIZE]; }tplate; habT = WinInitialize(0); hmqT = WinCreateMsgQueue(habT, 0); WinCancelShutdown(hmqT, TRUE); subClassWin(); disableButtons(); /* WinEnableMenuItem(hwndMenu, ID_MISC , FALSE); WinEnableMenuItem(hwndMenu, ID_OPTIONS , FALSE); WinEnableMenuItem(hwndMenu, ID_HELPME , FALSE); WinEnableMenuItem(hwndMenu, ID_SETMODULES , FALSE); WinEnableMenuItem(WinWindowFromID(hwndFrame, FID_SYSMENU), SC_CLOSE , FALSE); */ _dos_findfirst(datFile, _A_NORMAL, &ffblk); DosQueryCurrentDisk(&drvNumOrg, &ulDriveMap); drvNum = pdf[0].noteText[0] - '@'; DosSetDefaultDisk(drvNum); QueryDiskSpace (drvNum, &totalSpace, &allocated, &available); if( ((ffblk.size*2)+44000) >= available ) { strcpy(errMsg1, "You need at least "); ultoa((ffblk.size*2)+44000, sizeStr, 10); strcat(errMsg1, sizeStr); strcat(errMsg1, " bytes free and possibly more to resize this file."); WinMessageBox(HWND_DESKTOP, (HWND)hwnd, errMsg1, "Not enough disk space to accomplish task!", 0, MB_ICONEXCLAMATION | MB_OK); } else { INT LRECSIZE; INT xx, i; FILE *rHan, *hanTMP; div_t dvt; INT origFL; origFL = FIXEDLEN; rHan = fopen(datFile, MRW); fseek(rHan, 0L, SEEK_SET); fread(&recIndex, sizeof(recIndex), 1, rHan); xx = WinQueryLboxCount(WinWindowFromID((HWND)hwnd, ID_LISTBOX1)); LRECSIZE = 0; for(i=0;i<xx;i++) { fread(&tplate, sizeof(tplate), 1, rHan); fread(&dataRecs.noteText, FIXEDLEN, 1, rHan); if( strlen(dataRecs.noteText) > LRECSIZE ) LRECSIZE = strlen(dataRecs.noteText); } fclose(rHan); if( LRECSIZE < 1000 ) sModSize = 1; if( LRECSIZE > 28999 ) sModSize = 30; if( (LRECSIZE > 999) && (LRECSIZE < 29000) ) { dvt = div(LRECSIZE, 1000); if( dvt.rem == 0 ) sModSize = dvt.quot; else sModSize = dvt.quot + 1; } if( newSizePrompt((HWND)hwnd) ) { rHan = fopen(datFile, MRW); fseek(rHan, 0L, SEEK_SET); fread(&recIndex, sizeof(recIndex), 1, rHan); recIndex[0].alIndex = sModSize; hanTMP = fopen("TMP$$$$$.PDF", "w+b" ); fwrite(&recIndex, sizeof(recIndex), 1, hanTMP); for(i=0;i<xx;i++) { fread(&tplate, sizeof(tplate), 1, rHan); fread(&dataRecs.noteText, FIXEDLEN, 1, rHan); fwrite(&tplate, sizeof(tplate), 1, hanTMP); fwrite(&dataRecs.noteText, sModSize, 1, hanTMP); } fclose(rHan); fclose(hanTMP); if( rename(datFile, "X$X$$$$$.PDF") != 0 ) { FIXEDLEN = origFL; recIndex[0].alIndex = FIXEDLEN; sModSize = FIXEDLEN; } if( rename("TMP$$$$$.PDF", datFile) != 0 ) { FIXEDLEN = origFL; recIndex[0].alIndex = FIXEDLEN; rename("X$X$$$$$.PDF", datFile); sModSize = FIXEDLEN; } remove("X$X$$$$$.PDF"); FIXEDLEN = sModSize; initLoad(WinWindowFromID((HWND)hwnd, ID_LISTBOX1), datFile); setStatus((HWND)hwnd, datFile); WinPostMsg(WinWindowFromID((HWND)hwnd, ID_LISTBOX1), LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE)); } } DosSetDefaultDisk(drvNumOrg); enableButtons(); unSubClassWin(); /* WinEnableMenuItem(hwndMenu, ID_OPTIONS , TRUE); WinEnableMenuItem(hwndMenu, ID_HELPME , TRUE); WinEnableMenuItem(hwndMenu, ID_MISC , TRUE); WinEnableMenuItem(hwndMenu, ID_SETMODULES , TRUE); WinEnableMenuItem(WinWindowFromID(hwndFrame, FID_SYSMENU), SC_CLOSE , TRUE); */ WinDestroyMsgQueue(hmqT); WinTerminate(habT); _endthread(); }
ExecStreamResult LcsClusterReplaceExecStream::getTupleForLoad() { // If the last tuple provided has not been processed yet, then there's no // work to be done if (!needTuple) { return EXECRC_YIELD; } if (pInAccessor->getState() == EXECBUF_EOS) { // No more input rows, but that doesn't mean we're finished because // we have to match the number of rows in the original cluster. // Therefore, if there's a gap at the end of the cluster, read the // original rows until we read the rid corresponding to the last tuple // tuple in the original cluster, at which point, we can finally // say that we're done. However, if there wasn't at least one new // row, then there's no need to replace the column. We can simply // keep the original. if (!newData) { return EXECRC_EOS; } if (opaqueToInt(currLoadRid) < origNumRows) { readOrigClusterRow(); needTuple = false; // in case this wasn't already called initLoad(); return EXECRC_YIELD; } else { pSnapshotSegment->versionPage( origRootPageId, treeDescriptor.rootPageId); return EXECRC_EOS; } } if (!pInAccessor->demandData()) { return EXECRC_BUF_UNDERFLOW; } // Create a new rid to pageId btree map for this cluster, once we know // at least one row is being updated if (!newData) { treeDescriptor.rootPageId = NULL_PAGE_ID; BTreeBuilder builder( treeDescriptor, treeDescriptor.segmentAccessor.pSegment); builder.createEmptyRoot(); treeDescriptor.rootPageId = builder.getRootPageId(); newData = true; } initLoad(); if (currLoadRid == LcsRid(0) || currLoadRid > currInputRid) { assert(!pInAccessor->isTupleConsumptionPending()); pInAccessor->unmarshalProjectedTuple(projInputTupleData); currInputRid = *reinterpret_cast<LcsRid const *> (projInputTupleData[0].pData); } // If there's a gap between the last input tuple read and the // current row that needs to be loaded, then read the original // cluster data; otherwise, unmarshal the last input row read. if (currInputRid > currLoadRid) { readOrigClusterRow(); } else { assert(currInputRid == currLoadRid); clusterColsTupleAccessor.unmarshal(clusterColsTupleData); } needTuple = false; return EXECRC_YIELD; }
void XctionWorker::run() { Packet * xction = NULL; Packet * in = NULL; Packet * out = NULL; QueueBatcher<Packet> inBatcher(mpInQueue, Const::UTIL_QUEUE_BATCH_SIZE); QueueBatcher<Packet> outBatcher(mpOutQueue, Const::UTIL_QUEUE_BATCH_SIZE); // counter int counterQueue = counter.addAvg("xwq"); int counterLatency = counter.addAvg("xwl"); if (Const::MODE_TPCC_TRACE) { initLoad(); } /* populate read request */ for (int i = 0; i < Const::PROCESSOR_XCTION_QUEUE_SIZE; ++i) { if (Const::MODE_TPCC_TRACE) { load(mpXctions[i]); mpXctions[i]->mPid = PID_CLIENT_REQ; } else { Generator::genPacketRand(mpXctions[i], PID_CLIENT_REQ); } // mark when the transaction starts mpXctions[i]->timer.mark(0); mpXctions[i]->mXid = i; out = outBatcher.getWriteSlot(); Packet::getReadReq(out, mpXctions[i]); /*for (int j = 0; j < out->mReadCnt; ++j) { Logger::out(0, "ik %d %d ", out->mReadKeys.get(j)->toInt(), mpXctions[i]->mReadKeys.get(j)->toInt()); } Logger::out(0, "\n"); */ // mark when the packet gets into a queue out->timer.mark(0); outBatcher.putWriteSlot(out); // mpXctions[i]->setStart(); } Logger::out(0, "XctionWorker: populated all read requests\n"); resetStat(); mStat.setStart(); /*time_t prev = clock(); time_t cur = prev; for (int i = 0; i < 6; ++i) { mTypeStat[i].setStart(); }*/ /* start to process */ while (1) { in = inBatcher.getReadSlot(); xction = mpXctions[in->mXid]; // mark the time when the packet gets into the queue in->timer.mark(1); // update queue wait time counter.update(counterQueue, in->timer.lap(1)); if (in->mPid == PID_READ_RSP) { processReadRsp(in, xction); inBatcher.putReadSlot(in); out = outBatcher.getWriteSlot(); Packet::getCommitReq(out, xction); // mark the time when the packet gets into the queue out->timer.mark(0); outBatcher.putWriteSlot(out); } else if (in->mPid == PID_COMMIT_RSP) { /* process commit response */ ++mCommitRspCnt; processCommitRsp(in, xction); inBatcher.putReadSlot(in); // xction->setEnd(); // mStat.latency(xction->getLatency()); /* if (mCommitRspCnt % 100000 == 0) { cur = clock(); Logger::out(0, "%lu|", (cur - prev) / 1000); prev = cur; }*/ // mark when the transaction finishes xction->timer.mark(1); // update latency counter counter.update(counterLatency, xction->timer.lap(1)); // mark when the transaction starts xction->timer.mark(0); /* generate read request */ if (Const::MODE_TPCC_TRACE) { /* update type stat */ mTypeStat[xction->mType].update(xction->mDec); mTypeStat[xction->mType].latency(xction->getLatency()); load(xction); xction->mPid = PID_CLIENT_REQ; } else { Generator::genPacketRand(xction, PID_CLIENT_REQ); } out = outBatcher.getWriteSlot(); Packet::getReadReq(out, xction); // mark the time when the packet gets into the queue out->timer.mark(0); outBatcher.putWriteSlot(out); // xction->setStart(); // Logger::out(0, "commit rsp %d\n", xction->mXid); } else { assert(0); } } }