WLogEasyConfigurator::WLogEasyConfigurator(Wf::LogLevel defaultLogLevel) : m_defaultLogFilePath("default.log") , m_defaultLogLevel(defaultLogLevel) { m_defaultLogFilePath = QDir(QCoreApplication::applicationDirPath()).filePath("log.txt"); initializeLog(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); initializeLog(); TesterWindow window; window.show(); // QTimer::singleShot(1000, &a, SLOT(quit())); return a.exec(); }
SipConfigServerAgent* SipConfigServerAgent::getSipConfigServerAgent() { UtlBoolean isStarted ; // If the task object already exists, and the corresponding low-level task // has been started, then use it if (spInstance != NULL && spInstance->isStarted()) return spInstance; // If the task does not yet exist or hasn't been started, then acquire // the lock to ensure that only one instance of the task is started sLock.acquire(); if (spInstance == NULL) { OsPath workingDirectory ; if ( OsFileSystem::exists( CONFIG_ETC_DIR ) ) { workingDirectory = CONFIG_ETC_DIR; OsPath path(workingDirectory); path.getNativePath(workingDirectory); } else { OsPath path; OsFileSystem::getWorkingDirectory(path); path.getNativePath(workingDirectory); } UtlString ConfigfileName = workingDirectory + OsPathBase::separator + CONFIG_SETTINGS_FILE ; // Initialize the OsSysLog OsConfigDb configDb ; configDb.loadFromFile(ConfigfileName) ; initializeLog(&configDb) ; spInstance = startAgents(ConfigfileName); } isStarted = spInstance->isStarted(); if (!isStarted) { isStarted = spInstance->start(); // assert(isStarted); } sLock.release(); return spInstance; }
int initializeLogTest() { START_TEST_CASE; char *fileName = NULL; int mazeport = 40368; int nAvs = 4; int diff = 3; fileName = calloc(100, sizeof(char)); strcpy(fileName, "Amazing_jfeng_3_4.log"); initializeLog(fileName, mazeport, nAvs, diff); SHOULD_BE(access(fileName, F_OK) != -1); // file exists unlink(fileName); // delete file free(fileName); END_TEST_CASE; }
extern "C" NTSTATUS DriverEntry ( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath ) { NTSTATUS status ; KdPrint(("==> DriverEntry\n")); // 注册进程回调函数 PsSetCreateProcessNotifyRoutine(OnProcessQuit, FALSE); pDriverObject->MajorFunction[IRP_MJ_CREATE] = DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_CLOSE] = DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl; pDriverObject->MajorFunction[IRP_MJ_POWER] = DDKPower; pDriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = DDKPower; status = CreateDevice(pDriverObject); ::KeInitializeMutex(&g_DispatchMutex,0); getProcessNameOffset(); InitializeFilterGoEvent(); if(false == initializeLog()) return STATUS_UNSUCCESSFUL; if(false == InitHardCode()) { KdPrint(("init OS is error!\n")); return STATUS_UNSUCCESSFUL; } HookSSDT(); initialMutex();//whiteTable initialMutexB();//blackTable initialMutexAddPID(); KdPrint(("<== DriverEntry\n")); return status; }
static void InitDebug(char *path, unsigned int mask, unsigned char level, unsigned int trace) { char LogPath[1024]; unsigned int DbgMask = mask; unsigned int DbgTrace = trace; unsigned char DbgLevel = level; if (init_xprint(DbgMask, DbgLevel, DbgTrace) < 0) { fprintf(stderr, "init_xprint error, So exit\n"); exit(0); } /* 로그 디렉토리 및 로그파일의 초기화 */ sprintf(LogPath, "%s/%s", path, "log/VMCT"); if (initializeLog(LogPath) < 0) { xprint(FMS_VMC | FMS_FATAL, "initializeLog error, So exit\n"); close_xprint(); exit(0); } return; }
int printSucessTest() { START_TEST_CASE; char *fileName = NULL; AM_Message move; int moves = 1000; int nAvs = 4; int mazeport = 40368; int diff = 3; FILE *fp; char *buff; int buff_len = 50; int success = 0; fileName = calloc(100, sizeof(char)); strcpy(fileName, "Amazing_jfeng_3_4.log"); move.maze_solved.Hash = 3143850; buff = calloc(buff_len, sizeof(char)); initializeLog(fileName, mazeport, nAvs, diff); printSuccess(fileName, move, moves, nAvs); if ((fp = fopen(fileName, "r")) != NULL) { while (fscanf(fp, "%s\n", buff) == 1) { // Get every string and check the total number of moves value and // the hash value, should be 4000 and 2868391680 if(strcmp(buff, "4000") == 0 || strcmp(buff, "2868391680") == 0) { success++; } } } fclose(fp); free(buff); unlink(fileName); free(fileName); SHOULD_BE(success == 2); END_TEST_CASE; }
// handles the testing void SVMProcessing::test(int index, char *volumeFile, float &classnum, float &projection) { char msg[500], result[10]; if (svmLog == 0) initializeLog(); int idxInterval = vdbPtr->interval.returnInterval(index); if (index == vdbPtr->interval.intervals[idxInterval].start) { sprintf(msg, "\nBeginning of interval %d\n", (idxInterval+1)); writeLog(msg); } sprintf(featuresTestMask, "%s%s.nii", vdbPtr->featuresSuffix, vdbPtr->testFeatureSuffix); // correcting the file name fileExists(featuresTestMask); if (model == NULL) model = svm_load_model(svmModelPredictFile); if (model == NULL) fprintf(stderr, "model file %s not loaded.\n", svmModelPredictFile); else { //fprintf(stderr, "volumeFile tested : %s with mask : %s\n", volumeFile, featuresTestMask); predict(model, volumeFile, featuresTestMask, classnum, projection); if (adaptTraining) { fprintf(stderr, "Adapting projection.\n"); adaptativeTraining.adaptResult(classnum, projection); } if (projectionsFile) fprintf(projectionsFile, "%f\n", projection); hasPredicted = 1; int actualClass = vdbPtr->getClass(index); int predicted = (int)classnum; int idxInterval = vdbPtr->interval.returnInterval(index); //if (!vdbPtr->interval.isBaselineCondition(vdbPtr->interval.intervals[idxInterval].condition)) if ((strcmp(vdbPtr->interval.intervals[idxInterval].condition, "REAPPRAISE")==0) || (strcmp(vdbPtr->interval.intervals[idxInterval].condition, "REMEMBER")==0)) // to only consider the two conditions AUG2016 { if (index >= vdbPtr->interval.intervals[idxInterval].start + vdbPtr->offset) accuracyResults.reportResult(actualClass, predicted); if (actualClass == predicted) sprintf(result, "OK"); else sprintf(result, "NOK"); sprintf(msg, "Classification : %s %d %s : %f\n", vdbPtr->interval.conditionNames[predicted - 1].c_str(), index, result, projection); writeLog(msg); } if (index == vdbPtr->interval.intervals[idxInterval].end) { if (accuracyResults.examples()) sprintf(result, "%.2f", accuracyResults.hits()); else sprintf(result, "0.00"); strcat(result, "%"); sprintf(msg, "Ending of interval %d. Accuracy so far %d in %d (%s)\n", (idxInterval + 1), accuracyResults.correctExamples(), accuracyResults.examples(), result); writeLog(msg); } if (projection < 0) projection = projection / minDistance; else projection = projection / maxDistance; projection *= extrapolationFactor; if (actualClass != predicted) projection *= -1; // 18AUG2016 } }