void AsdkDocReactor::documentToBeActivated(AcApDocument* pDoc) { if (pDoc == curDocGlobals.doc) bumpCount(/*NOXLATE*/"#DOC_ACTIVATED(SAME)", Adesk::kTrue); else { // If switching documents, record the time spent on the // current document's active command/lisp and reset the // start time in the new document's active command/lisp. int i; if (curDocGlobals.doc != NULL) { if ((i = curDocGlobals.cmdIndex - 1) >= 0) recordElapsedCmdTime(curDocGlobals.cmdRcd[i], curDocGlobals.cmdStartTime[i]); if (curDocGlobals.lispRcd != NULL) recordElapsedCmdTime(curDocGlobals.lispRcd, curDocGlobals.lispStartTime); docData[lookupDoc(curDocGlobals.doc)] = curDocGlobals; } if (pDoc == NULL) { // This isn't supposed to happen... assert(pDoc!=NULL); // But in production, just log it and keep going... bumpCount(/*NOXLATE*/"#NULL_DOC_ACTIVATED", Adesk::kTrue); curDocGlobals.doc = NULL; return; } curDocGlobals = (docData[lookupDoc(pDoc)]); double currentTime = getCurTime(); if ((i = curDocGlobals.cmdIndex - 1) >= 0) curDocGlobals.cmdStartTime[i] = currentTime; curDocGlobals.lispStartTime = currentTime; bumpCount(/*NOXLATE*/"#DOC_SWITCHED", Adesk::kTrue); } }
void AsdkDocReactor::documentToBeDestroyed(AcApDocument *pDoc) { if (pDoc == NULL) { // This isn't supposed to happen... assert(pDoc!=NULL); // But in production, just log it and keep going... bumpCount(/*NOXLATE*/"#NULL_DOC_DESTROYED", Adesk::kTrue); return; } int i = lookupDoc(pDoc); // The current document being destroyed? if (pDoc == curDocGlobals.doc) { // If Anything is still active in the document being destroyed, // log it as done now. if (curDocGlobals.lispRcd != NULL) { recordElapsedCmdTime(curDocGlobals.lispRcd, curDocGlobals.lispStartTime); curDocGlobals.lispRcd = NULL; } recordCommandDuration(NULL); curDocGlobals.doc = NULL; } // Remove the document data docData.removeAt(i); }
void countCommand(const char* cmdStr) { // If nesting a command, record the time spent in the pushed command, and // stop counting it. if (curDocGlobals.cmdIndex > 0) recordElapsedCmdTime(curDocGlobals.cmdRcd[curDocGlobals.cmdIndex - 1], curDocGlobals.cmdStartTime[curDocGlobals.cmdIndex - 1]); curDocGlobals.cmdRcd[curDocGlobals.cmdIndex] = bumpCount(cmdStr, Adesk::kTrue); curDocGlobals.cmdStartTime[curDocGlobals.cmdIndex++] = getCurTime(); }
void AsdkDocReactor::documentCreated(AcApDocument* pDoc) { // Log document creations, for the heck of it.. // Note that bumpCount is independent of document-specific data. bumpCount(/*NOXLATE*/"#DOC_CREATED", Adesk::kTrue); // add an entry for the document, if some other notification hasn't // already done so. lookupDoc(pDoc); }
void AsdkCommandReactor::lispWillStart(const char* firstLine) { curDocGlobals.lispRcd = bumpCount(firstLine, Adesk::kTrue); curDocGlobals.lispStartTime = getCurTime(); }
DEF_TEST(SkpSkGrThreaded, reporter) { if (!initTest()) { return; } SkpSkGrThreadedTestRunner testRunner(reporter); for (int dirIndex = 1; dirIndex <= 100; ++dirIndex) { SkString pictDir = make_in_dir_name(dirIndex); if (pictDir.size() == 0) { continue; } SkOSFile::Iter iter(pictDir.c_str(), "skp"); SkString filename; while (iter.next(&filename)) { SkString pngName = make_png_name(filename.c_str()); SkString oldPng = make_filepath(dirIndex, outSkDir, pngName.c_str()); SkString newPng = make_filepath(dirIndex, outGrDir, pngName.c_str()); if (sk_exists(oldPng.c_str()) && sk_exists(newPng.c_str())) { bumpCount(reporter, true); continue; } for (size_t index = 0; index < skipOverSkGrCount; ++index) { if (skipOverSkGr[index].directory == dirIndex && strcmp(filename.c_str(), skipOverSkGr[index].filename) == 0) { bumpCount(reporter, true); goto skipOver; } } *testRunner.fRunnables.append() = new SkpSkGrThreadedRunnable( &testSkGrMain, dirIndex, filename.c_str(), &testRunner); skipOver: ; } } testRunner.render(); SkpSkGrThreadState& max = testRunner.fRunnables[0]->fState; for (int dirIndex = 2; dirIndex <= 100; ++dirIndex) { SkpSkGrThreadState& state = testRunner.fRunnables[dirIndex - 1]->fState; for (int index = 0; index < state.fFoundCount; ++index) { int maxIdx = max.fFoundCount; if (maxIdx < kMaxFiles) { max.fError[maxIdx] = state.fError[index]; strcpy(max.fFilesFound[maxIdx], state.fFilesFound[index]); max.fDirsFound[maxIdx] = state.fDirsFound[index]; ++max.fFoundCount; continue; } for (maxIdx = 0; maxIdx < max.fFoundCount; ++maxIdx) { if (max.fError[maxIdx] < state.fError[index]) { max.fError[maxIdx] = state.fError[index]; strcpy(max.fFilesFound[maxIdx], state.fFilesFound[index]); max.fDirsFound[maxIdx] = state.fDirsFound[index]; break; } } } } TestResult encoder; encoder.fTestStep = kEncodeFiles; for (int index = 0; index < max.fFoundCount; ++index) { encoder.fDirNo = max.fDirsFound[index]; strcpy(encoder.fFilename, max.fFilesFound[index]); encoder.testOne(); SkDebugf("+"); } }
static void testSkGrMain(SkpSkGrThreadState* data) { data->fResult.testOne(); bumpCount(data->fReporter, false); data->fReporter->bumpTestCount(); }