void UUpdateWidget::slot_downloadFileFinished() { m_toolBarActions.at(eINSTALL_UPDATES_ACTION)->setEnabled(false); m_currentDownloadFile++; QAbstractTableModel *model = (UUpdatesModel *)m_updatesTableView->model(); if (m_currentDownloadFile == model->rowCount()) { Q_EMIT signal_downloadUpdatesFinished(); return; } m_downloader->set_progressBar(m_progressBarList.at(m_currentDownloadFile)); QModelIndex index = model->index(m_currentDownloadFile, UUpdatesModel::ePACKAGE); QString packageName = model->data(index, Qt::DisplayRole).toString(); if (packageName.contains('/') == true) { int indx = packageName.indexOf('/'); m_downloader->setDir(packageName.remove(indx, packageName.size() - indx)); } else { m_downloader->setDir(""); } index = model->index(m_currentDownloadFile, UUpdatesModel::ePACKAGE); createFolders(index.data().toString()); index = model->index(m_currentDownloadFile, UUpdatesModel::eURI); m_downloader->slot_downloadFile(model->data(index, Qt::DisplayRole).toUrl()); }
/** * Tests the creation of a number of folders in the root */ int multipleFoldersTest() { int hr = SUCCESS; FAIL_BRK4(initAndLoadDisk()); FAIL_BRK4(initFS()); FAIL_BRK4(createFolders("folder", 500)); Fail: saveAndCloseDisk(); PRINT_RESULTS("Multiple Folders Test"); return hr; }
void FSHost::run(void) { switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT; const char *err = NULL; switch_bool_t console = SWITCH_FALSE; switch_status_t destroy_status; createFolders(); /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */ qDebug() << "Initializing core..."; /* Initialize the core and load modules, that will startup FS completely */ if (switch_core_init(flags, console, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err); emit coreLoadingError(err); } qDebug() << "Everything OK, Entering runtime loop ..."; if (switch_event_bind("FSHost", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, eventHandlerCallback, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); } emit loadingModules("Loading modules...", Qt::AlignRight|Qt::AlignBottom, Qt::blue); if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err); emit coreLoadingError(err); } switch_log_bind_logger(loggerHandler, SWITCH_LOG_DEBUG, SWITCH_FALSE); emit ready(); /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set * If its false, it initializes the libedit for the console, then does the same thing */ switch_core_runtime_loop(!console); fflush(stdout); switch_event_unbind_callback(eventHandlerCallback); /* When the runtime loop exits, its time to shutdown */ destroy_status = switch_core_destroy(); if (destroy_status == SWITCH_STATUS_SUCCESS) { qDebug() << "We have properly shutdown the core."; } }
int main(int argc,char **argv) { LogLevel = 3; iniMPI(argc, argv); fftw_init_threads(); fftw_plan_with_nthreads(1); loadCommandLineParameters(argc,argv); loadDataFromAnalyzerToDoList(); iniTools(537*Parameter_Job_ID); startTimer(); if (Parameter_Job_ID>0) randomDelay(1000); SDReader = new StateDescriptorReader(Parameter_SD_FileName); int threadCountPerNode = 1; int ParaOpMode = 0; char* fftPlanDescriptor = NULL; bool usexFFT = false; readOptimalFermionVectorEmbeddingAndFFTPlanFromTuningDB(SDReader->getL0(), SDReader->getL1(), SDReader->getL2(), SDReader->getL3(), threadCountPerNode, ParaOpMode, usexFFT, SDReader->getUseP(), SDReader->getUseQ(), SDReader->getUseR(), SDReader->getUseQHM(), fftPlanDescriptor); delete[] fftPlanDescriptor; char* fileNameExtension = SDReader->getFileNameExtension(); ioControl = new AnalyzerIOControl(fileNameExtension, Parameter_Job_ID); delete[] fileNameExtension; fermiOps = new FermionMatrixOperations(SDReader->getL0(), SDReader->getL1(), SDReader->getL2(), SDReader->getL3(), SDReader->getRho(), SDReader->getR(), SDReader->getYN()); fermiOps->setMassSplitRatio(SDReader->getMassSplit()); fermiOps->setAntiPeriodicBoundaryConditionsInTime(SDReader->useAntiPeriodicBoundaryConditionsInTimeDirection()); iniAnalyzerObs(); iniAuxVecs(); createFolders(); ioControl->removeDeprecatedInProgressFiles(48.0); if (LogLevel>2) printf("\nEntering main Analyzer-Loop.\n"); int confID = -1; while (((confID=getNextConfIDforAnalysis())>=0) && (timePassed()<3600*Parameter_MaxRunTime)) { ioControl->markAsInProgress(confID); bool keepMarked = false; char* confFileName = ioControl->getPhiConfFileName(confID); AnalyzerPhiFieldConfiguration* phiFieldConf = new AnalyzerPhiFieldConfiguration(confFileName, fermiOps); delete[] confFileName; if (phiFieldConf->getErrorState() == 0) { for (int I=0; I<analyzerObsCount; I++) { bool activeObs = false; for (int I2=0; I2<Parameter_tagCount; I2++) { if (analyzerObs[I]->isNick(Parameter_tags[I2])) activeObs = true; } if (activeObs) { if ((!analyzerObs[I]->isConfAnalyzed(confID)) && (analyzerObs[I]->shallConfBeAnalyzed(confID))) { if (LogLevel>2) printf("Analyzing Observable %s...\n",analyzerObs[I]->getObsName()); bool b = analyzerObs[I]->analyze(phiFieldConf, auxVecs); phiFieldConf->clearPhiFieldCopies(); if (b) { analyzerObs[I]->saveAnalyzerResults(confID); } else { keepMarked = true; if (LogLevel>1) { printf(" *** Could not analyze observable %s on configuration %d. Continue with next configuration.\n",analyzerObs[I]->getObsName(),confID); } } } } } } else { keepMarked = true; if (LogLevel>1) { printf(" *** Could not load configuration file %d --> Skipping configuration file\n",confID); } } delete phiFieldConf; if (!keepMarked) ioControl->unmarkAsInProgress(confID); if (Parameter_Job_ID>0) randomDelay(2); } if (LogLevel>2) printf("\nLeaving main Analyzer-Loop.\n\n"); desini(); desiniTools(); fftw_cleanup_threads(); if (LogLevel>1) printf("Analyzer terminated correctly.\n"); }
/** * Tests the algorithm for performance */ int perfTest() { int hr = SUCCESS; int i; char *fileName = malloc(32); char *dirName = malloc(32); printf("###########################\n"); printf("Let the competition begin!\n"); FAIL_BRK4(initAndLoadDisk()); FAIL_BRK4(initFS()); // lots of files FAIL_BRK4(multipleFiles("file", 900, SD_SECTORSIZE)); // deleting them for (i = 0; i < 900; i++) { sprintf(fileName, "file%05d", i); FAIL_BRK4(sfs_rm(fileName)); } // lots of files again FAIL_BRK4(multipleFiles("file", 900, SD_SECTORSIZE)); // now deleting them in reverse for (i = 900 - 1; i >= 0; i--) { sprintf(fileName, "file%05d", i); FAIL_BRK4(sfs_rm(fileName)); } // one very big file FAIL_BRK4(singleBigFile("huge.txt", (SD_NUMSECTORS - 100) * SD_SECTORSIZE)); // and now it is gone FAIL_BRK4(sfs_rm("huge.txt")); // lots of flat folders FAIL_BRK4(createFolders("dir", 900)); for (i = 0; i < 900; i++) { sprintf(dirName, "dir%04d", i); FAIL_BRK4(sfs_rm(dirName)); } // lots of nested folders FAIL_BRK4(nestedFolders("dir", 900)); // going to the bottom FAIL_BRK3(sfs_fcd("/"), stdout, "Error: cd / failed\n"); for (i = 0; i < 900; i++) { sprintf(dirName, "dir%04d", i); FAIL_BRK3(sfs_fcd(dirName), stdout , "Error: fcd to (%s) failed\n", dirName); } // deleting them on the way out for (i = 900 - 1; i >= 0; i--) { sprintf(dirName, "dir%04d", i); FAIL_BRK3(sfs_fcd(".."), stdout, "Error: cd .. failed\n"); FAIL_BRK3(sfs_rm(dirName), stdout, "Error: rm (%s) failed\n", dirName); } Fail: SAFE_FREE(fileName); SAFE_FREE(dirName); printf("COMPETITION RESULTS: "); saveAndCloseDisk(); PRINT_RESULTS("Performance Test"); return hr; }