void Simulator::plotParticles(int iteration) { outputWriter::VTKWriter vtkWriter; outputWriter::XYZWriter xyzWriter; #ifndef NOGLVISUALIZER if(Settings::show3DVisual) { outputWriter::RenderOutputWriter openglView; LOG4CXX_TRACE(logger,"Plotting Particles"); openglView.plotParticles(*particleContainer, Settings::outputFilePrefix, iteration); } #endif if(Settings::disableOutput) return; switch (Settings::outputFileType) { case OutputFileType::xyz: xyzWriter.plotParticles(*particleContainer, Settings::outputFilePrefix, iteration); break; case OutputFileType::vtk: vtkWriter.initializeOutput(particleContainer->getSize()); particleContainer->each([&] (Particle& p) { #ifdef _OPENMP #pragma omp critical (plot_particle) #endif vtkWriter.plotParticle(p); }); vtkWriter.writeFile(Settings::outputFilePrefix, iteration); break; } LOG4CXX_TRACE(logger,"Plotted \t"<< iteration << "\t Particles" ); }
std::shared_ptr<Module<Impl>> Module_scanner<Impl>::instantiate_module_template(Label inst_name, ast::Module_def const* node, std::map<Label,std::shared_ptr<Type<Impl>>> const& args) { LOG4CXX_TRACE(this->m_logger, "creating module '" << inst_name << "' from template"); auto existing = m_mod.modules.find(inst_name); if( existing != m_mod.modules.end() ) return existing->second; auto m = std::make_shared<Module<Impl>>(inst_name); m->enclosing_ns = &m_mod; m->enclosing_library = m_mod.enclosing_library; // inject type arguments for(auto ty : args) { LOG4CXX_TRACE(this->m_logger, "overriding type parameters '" << ty.first << "' with type '" << ty.second->name << "'"); m->types[ty.first] = ty.second; } Module_scanner<Impl> scanner(*m); node->accept(scanner); m_mod.modules[m->name] = m; return m; }
void ReplicationManager::handleConnectionStatus(Notification<NetworkManager::ConnectionStatus>::MessageTypePtr connStatus) { assert(connStatus->getPhysicalInstanceId() != INVALID_INSTANCE); LOG4CXX_TRACE(logger, "ReplicationManager::handleConnectionStatus: notification for instance=" << connStatus->getPhysicalInstanceId() << ", remote receive queue size=" << connStatus->getAvailabeQueueSize()); if (connStatus->getQueueType() != NetworkManager::mqtReplication) { return; } if (connStatus->getAvailabeQueueSize() <= 0) { return; } ScopedMutexLock cs(_repMutex); RepQueue::iterator iter = _repQueue.find(connStatus->getPhysicalInstanceId()); if (iter == _repQueue.end()) { return; } LOG4CXX_TRACE(logger, "ReplicationManager::handleConnectionStatus: notification for instance=" << connStatus->getPhysicalInstanceId() << ", local replication queue size="<< iter->second->size() << ", remote receive queue size="<< connStatus->getAvailabeQueueSize()); _repEvent.signal(); }
// XXX TODO: consider returning std::vector<scidb::SharedMemoryPtr> // XXX TODO: which would require supporting different types of memory (double, char etc.) std::vector<MPIPhysical::SMIptr_t> MPIPhysical::allocateMPISharedMemory(size_t numBufs, size_t elemSizes[], size_t numElems[], string dbgNames[]) { LOG4CXX_DEBUG(logger, "MPIPhysical::allocateMPISharedMemory(numBufs "<<numBufs<<",,,)"); if(logger->isTraceEnabled()) { LOG4CXX_TRACE(logger, "MPIPhysical::allocateMPISharedMemory(): allocations are: "); for(size_t ii=0; ii< numBufs; ii++) { LOG4CXX_TRACE(logger, "MPIPhysical::allocateMPISharedMemory():" << " elemSizes["<<ii<<"] "<< dbgNames[ii] << " len " << numElems[ii]); } } std::vector<SMIptr_t> shmIpc(numBufs); bool preallocate = Config::getInstance()->getOption<bool>(CONFIG_PREALLOCATE_SHM); for(size_t ii=0; ii<numBufs; ii++) { std::stringstream suffix; suffix << "." << ii ; std::string ipcNameFull= _ipcName + suffix.str(); LOG4CXX_TRACE(logger, "IPC name = " << ipcNameFull); shmIpc[ii] = SMIptr_t(mpi::newSharedMemoryIpc(ipcNameFull, preallocate)); // can I get 'em off ctx instead? _ctx->addSharedMemoryIpc(_launchId, shmIpc[ii]); char* ptr = MpiLauncher::initIpcForWrite(shmIpc[ii].get(), (elemSizes[ii] * numElems[ii])); assert(ptr); ptr=ptr; } return shmIpc; }
BOOL WINAPI DetourWeCreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) { //LOG4CXX_TRACE(NYDWE::gInjectLogger, boost::format("ApplicationName: %1%") % lpApplicationName); //LOG4CXX_TRACE(NYDWE::gInjectLogger, boost::format("CommandLine: %1%") % lpCommandLine); std::cmatch matcher; if (lpCommandLine && std::regex_match(lpCommandLine, matcher, gRegexCommandLine)) { std::string currentWarcraftMap = (ydwe::path::get(ydwe::path::DIR_EXE).remove_filename() / matcher.str(1)).string(); LOG4CXX_TRACE(NYDWE::gInjectLogger, boost::format("Executing map %1%") % currentWarcraftMap); CYDWEEventData eventData; if (gIsInCompileProcess) { LOG4CXX_TRACE(NYDWE::gInjectLogger, "Need to compile..."); eventData.setEventData("map_path", currentWarcraftMap); const std::vector<int> &results = event_array[EVENT_SAVE_MAP](eventData); gIsInCompileProcess = false; if (results_is_failed(results)) { LOG4CXX_TRACE(NYDWE::gInjectLogger, "Save failed. Abort testing."); memset(lpProcessInformation, 0, sizeof(PROCESS_INFORMATION)); return FALSE; } } else { LOG4CXX_TRACE(NYDWE::gInjectLogger, "No need to compile."); } eventData.getDataStore().clear(); eventData.setEventData("map_path", currentWarcraftMap); if (lpApplicationName) eventData.setEventData("application_name", std::string(lpApplicationName)); if (lpCommandLine) eventData.setEventData("command_line", std::string(lpCommandLine)); const std::vector<int> &results = event_array[EVENT_TEST_MAP](eventData); return (!results_is_failed(results)); } else { // Retain original return aero::std_call<BOOL>(pgTrueCreateProcessA, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } }
bool RemoteMergedArray::proceedChunkMsg(size_t stream, AttributeID attId, MemChunk* chunk) { boost::shared_ptr<MessageDesc> chunkDesc = _messages[attId][stream]; _messages[attId][stream].reset(); boost::shared_ptr<scidb_msg::Chunk> chunkMsg = chunkDesc->getRecord<scidb_msg::Chunk>(); StatisticsScope sScope(_statistics); currentStatistics->receivedSize += chunkDesc->getMessageSize(); currentStatistics->receivedMessages++; _nextPositions[attId][stream].clear(); if (!chunkMsg->eof()) { LOG4CXX_TRACE(logger, "RemoteMergedArray received next chunk message"); if (chunkDesc->getBinary() && chunk != NULL) { const int compMethod = chunkMsg->compression_method(); const size_t decompressedSize = chunkMsg->decompressed_size(); Address firstElem; firstElem.attId = attId; firstElem.arrId = getArrayDesc().getId(); for (int i = 0; i < chunkMsg->coordinates_size(); i++) { firstElem.coords.push_back(chunkMsg->coordinates(i)); } chunk->initialize(this, &desc, firstElem, compMethod); chunk->setSparse(chunkMsg->sparse()); chunk->setRLE(chunkMsg->rle()); chunk->setCount(chunkMsg->count()); boost::shared_ptr<CompressedBuffer> compressedBuffer = dynamic_pointer_cast<CompressedBuffer>(chunkDesc->getBinary()); compressedBuffer->setCompressionMethod(compMethod); compressedBuffer->setDecompressedSize(decompressedSize); chunk->decompress(*compressedBuffer); assert(checkChunkMagic(*chunk)); LOG4CXX_TRACE(logger, "RemoteMergedArray initializes next chunk"); } LOG4CXX_TRACE(logger, "RemoteMergedArray initializes next position"); if (chunkMsg->has_next()) { for (int i = 0; i < chunkMsg->next_coordinates_size(); i++) { _nextPositions[attId][stream].push_back(chunkMsg->next_coordinates(i)); } requestNextChunk(stream, attId, false); } return true; } else { LOG4CXX_TRACE(logger, "RemoteMergedArray has no new chunks"); return false; } }
/* Clear all datastore files from the basepath */ void DataStores::clearAllDataStores() { /* Try to open the base dir */ DIR* dirp = ::opendir(_basePath.c_str()); if (dirp == NULL) { LOG4CXX_ERROR(logger, "DataStores::clearAllDataStores: failed to open base dir, aborting clearAll"); return; } boost::function<int()> f = boost::bind(&File::closeDir, _basePath.c_str(), dirp, false); scidb::Destructor<boost::function<int()> > dirCloser(f); struct dirent entry; memset(&entry, 0, sizeof(entry)); /* For each entry in the base dir */ while (true) { struct dirent *result(NULL); int rc = ::readdir_r(dirp, &entry, &result); if (rc != 0 || result == NULL) { return; } assert(result == &entry); LOG4CXX_TRACE(logger, "DataStores::clearAllDataStores: found entry " << entry.d_name); /* If its a datastore or fl file, go ahead and try to remove it */ size_t entrylen = strlen(entry.d_name); size_t fllen = strlen(".fl"); size_t datalen = strlen(".data"); const char* entryend = entry.d_name + entrylen; /* Check if entry ends in ".fl" or ".data" */ if (((entrylen > fllen) && (strcmp(entryend - fllen, ".fl") == 0)) || ((entrylen > datalen) && (strcmp(entryend - datalen, ".data") == 0)) ) { LOG4CXX_TRACE(logger, "DataStores::clearAllDataStores: deleting entry " << entry.d_name); std::string fullpath = _basePath + "/" + entry.d_name; File::remove(fullpath.c_str(), false); } } }
void Resources::fileExists(const string &path, map<InstanceID, bool> &instancesMap, const shared_ptr<Query> &query) { LOG4CXX_TRACE(logger, "Resources::fileExists. Checking file '" << path << "'"); NetworkManager* networkManager = NetworkManager::getInstance(); FileExistsResourcesCollector* collector = new FileExistsResourcesCollector(); uint64_t id = 0; { ScopedMutexLock lock(_lock); id = ++_lastResourceCollectorId; _resourcesCollectors[id] = collector; collector->collect(query->getInstanceID(), checkFileExists(path), false); } shared_ptr<MessageDesc> msg = make_shared<MessageDesc>(mtResourcesFileExistsRequest); shared_ptr<scidb_msg::ResourcesFileExistsRequest> request = msg->getRecord<scidb_msg::ResourcesFileExistsRequest>(); msg->setQueryID(0); request->set_resource_request_id(id); request->set_file_path(path); networkManager->broadcast(msg); LOG4CXX_TRACE(logger, "Resources::fileExists. Waiting while instances return result for collector " << id); try { Semaphore::ErrorChecker errorChecker = bind(&Query::validateQueryPtr, query); collector->_collectorSem.enter(query->getInstancesCount() - 1, errorChecker); } catch (...) { LOG4CXX_TRACE(logger, "Resources::fileExists. Waiting for result of collector " << id << " interrupter by error"); { ScopedMutexLock lock(_lock); delete _resourcesCollectors[id]; _resourcesCollectors.erase(id); } throw; } LOG4CXX_TRACE(logger, "Resources::fileExists. Returning result of collector " << id); { ScopedMutexLock lock(_lock); instancesMap = ((FileExistsResourcesCollector*) _resourcesCollectors[id])->_instancesMap; delete _resourcesCollectors[id]; _resourcesCollectors.erase(id); } }
void test6() { log4cxx::PropertyConfigurator::configure("log4cxx.properties"); log4cxx::LoggerPtr loggerA(log4cxx::Logger::getLogger("aaa")); log4cxx::LoggerPtr loggerB(log4cxx::Logger::getLogger("bbb")); LOG_F("\n"); LOG4CXX_INFO(loggerA, "this is log4cxx test"); LOG4CXX_INFO(loggerB, "this is log4cxx test"); log4cxx::LoggerPtr logger0(log4cxx::Logger::getLogger("logger0")); LOG4CXX_DEBUG(logger0, "hello"); LOG4CXX_TRACE(logger0, "hello"); LOG4CXX_INFO(logger0, "hello"); LOG4CXX_WARN(logger0, "hello"); LOG4CXX_ERROR(logger0, "hello"); LOG4CXX_FATAL(logger0, "hello"); // std::set<int> cList; // LOG4CXX_INFO(logger0, cList); //log4j.logger.logger0 = INFO, ap0 // INFO 23:02:03 -- hello // WARN 23:02:04 -- hello // ERROR 23:02:04 -- hello // FATAL 23:02:04 -- hello LOG_F("\n"); }
static bool Graph_read(Graph& graph, std::istream& stream) { if (!stream) { return false; } // s.t. con3122 : x_2250 - x_2866 + e_2866_2250 = 190; static boost::regex reg("s\\.t\\. con(\\d+)\\s*:\\s*x_(\\d+)\\s*-\\s*x_(\\d+)\\s*\\+\\s*e_(\\d+)_(\\d+)\\s*=\\s*((\\+|-)?\\d+)\\s*;"); std::string line; while (std::getline(stream, line)) { boost::algorithm::trim(line); boost::smatch what; if (boost::regex_match(line, what, reg)) { size_t xj = boost::lexical_cast< size_t >(what[2]); size_t xi = boost::lexical_cast< size_t >(what[3]); int err = boost::lexical_cast< int >(what[6]); LOG4CXX_TRACE(logger, boost::format("regex: %d %d %d %s") % xi % xj % err % line); Graph_addEdge(graph, xi, xj, err); } } return true; }
/* Construct a new DataStore object */ DataStore::DataStore(char const* filename, Guid guid, DataStores& parent) : _dsm(&parent), _dslock(), _guid(guid), _largestFreeChunk(0), _dirty(false), _fldirty(false) { /* Open the file */ string filenamestr = filename; _file = FileManager::getInstance()->openFileObj(filenamestr.c_str(), O_LARGEFILE | O_RDWR | O_CREAT); if (_file.get() == NULL) { throw SYSTEM_EXCEPTION(SCIDB_SE_STORAGE, SCIDB_LE_CANT_OPEN_FILE) << filenamestr << errno; } LOG4CXX_TRACE(logger, "datastore: new ds opened file " << filenamestr); /* Try to initialize the free lists from the free-list file. */ initializeFreelist(); }
bool ReplicationManager::sendItem(RepItems& ri) { ScopedMutexLock cs(_repMutex); const std::shared_ptr<Item>& item = ri.front(); if (item->isDone()) { ri.pop_front(); return true; } try { std::shared_ptr<Query> q(Query::getValidQueryPtr(item->getQuery())); std::shared_ptr<MessageDesc> chunkMsg(item->getChunkMsg()); NetworkManager::getInstance()->sendPhysical(item->getInstanceId(), chunkMsg, NetworkManager::mqtReplication); LOG4CXX_TRACE(logger, "ReplicationManager::sendItem: successful replica chunk send to instance=" << item->getInstanceId() << ", size=" << item->getChunkMsg()->getMessageSize() << ", query (" << q->getQueryID()<<")" << ", queue size="<< ri.size()); InjectedErrorListener<ReplicaSendInjectedError>::check(); item->setDone(); } catch (NetworkManager::OverflowException& e) { assert(e.getQueueType() == NetworkManager::mqtReplication); return false; } catch (Exception& e) { item->setDone(e.copy()); } ri.pop_front(); return true; }
/* Invalidate the free-list file on disk @pre caller has locked the DataStore */ void DataStore::invalidateFreelistFile() { if (!_fldirty) { File::FilePtr flfile; std::string filename; size_t nbuckets = 0; LOG4CXX_TRACE(logger, "datastore: invalidating freelist for " << _file->getPath()); filename = _file->getPath() + ".fl"; flfile = FileManager::getInstance()->openFileObj(filename, O_CREAT | O_TRUNC | O_RDWR); if (!flfile) { throw SYSTEM_EXCEPTION(SCIDB_SE_STORAGE, SCIDB_LE_CANT_OPEN_PATH) << filename; } /* This is one vulnerable spot... after truncate, but before we write the zero byte */ _dsm->getErrorListener().check(); flfile->writeAll((void*)&nbuckets, sizeof(size_t), 0); flfile->fsync(); _fldirty = true; _dsm->getFlusher().add(_guid); } }
void VTKWriter::plotParticle(Particle& p) { if (vtkFile->UnstructuredGrid().present()) { LOG4CXX_TRACE(iolog, "UnstructuredGrid is present"); } else { LOG4CXX_ERROR(iolog, "No UnstructuredGrid present"); } PointData::DataArray_sequence& pointDataSequence = vtkFile->UnstructuredGrid()->Piece().PointData().DataArray(); PointData::DataArray_iterator dataIterator = pointDataSequence.begin(); dataIterator->push_back(p.getM()); //cout << "Appended mass data in: " << dataIterator->Name(); dataIterator++; dataIterator->push_back(p.getV()[0]); dataIterator->push_back(p.getV()[1]); dataIterator->push_back(p.getV()[2]); //cout << "Appended velocity data in: " << dataIterator->Name(); dataIterator++; dataIterator->push_back(p.getOldF()[0]); dataIterator->push_back(p.getOldF()[1]); dataIterator->push_back(p.getOldF()[2]); //cout << "Appended force data in: " << dataIterator->Name(); dataIterator++; dataIterator->push_back(p.getType()); Points::DataArray_sequence& pointsSequence = vtkFile->UnstructuredGrid()->Piece().Points().DataArray(); Points::DataArray_iterator pointsIterator = pointsSequence.begin(); pointsIterator->push_back(p.getX()[0]); pointsIterator->push_back(p.getX()[1]); pointsIterator->push_back(p.getX()[2]); }
void CuboidInitializer::initialize(ParticleContainer& container) { double x[] = {0,0,0}; double m = _config.getMaterialConfig().getM(); double epsilon = _config.getMaterialConfig().getEpsilon(); double sigma = _config.getMaterialConfig().getSigma(); LOG4CXX_DEBUG(logger, "SphereInitializer material: m=" << m << " epsilon=" << epsilon << " sigma=" << sigma); const utils::Vector<double,3>& v = _config.getV(); const utils::Vector<int, 3>& n = _config.getN(); LOG4CXX_DEBUG(logger, "Initializing CUBE at " << _config.getX().toString()); for (int i = 0; i < n[0]; i++) { for (int j = 0; j < n[1]; j++) { for (int k = 0; k < n[2]; k++) { x[0] = _config.getX()[0] + ((double)i) * _config.getH(); x[1] = _config.getX()[1] + ((double)j) * _config.getH(); x[2] = _config.getX()[2] + ((double)k) * _config.getH(); LOG4CXX_TRACE(logger, "creating (x,y,z): (" << x[i] << "," << x[j] << "," << x[k] << ")"); Particle p(x, v, m, epsilon, sigma, _type_id); //MaxwellBoltzmannDistribution(p, 0.1, dim); container.addParticle(p); } } } }
/* Read free lists from disk file @returns number of buckets successfully read */ int DataStore::readFreelistFromFile() { /* Try to open the freelist file */ File::FilePtr flfile; std::string filename; filename = _file->getPath() + ".fl"; flfile = FileManager::getInstance()->openFileObj(filename, O_RDONLY); if (!flfile) { return 0; } /* Sanity check: make sure its not empty */ struct stat st; if (flfile->fstat(&st) || (st.st_size == 0)) { LOG4CXX_ERROR(logger, "DataStore: found empty freelist file for " << _file->getPath()); return 0; } /* Try to parse the contents File format: <# of buckets><bucket 1>...<bucket n> */ off_t fileoff = 0; size_t nbuckets = 0; size_t current; flfile->readAll(&nbuckets, sizeof(size_t), fileoff); fileoff += sizeof(size_t); LOG4CXX_TRACE(logger, "DataStore: reading " << nbuckets << " for freelist"); for (current = 0; current < nbuckets; ++current) { try { FreelistBucket flb(flfile, fileoff); fileoff += flb.size(); flb.unload(_freelists); } catch (SystemException const& x) { LOG4CXX_ERROR(logger, "DataStore: failed to read freelist for " << _file->getPath() << ", error (" << x.getErrorMessage() << ")"); _freelists.clear(); return 0; } } return nbuckets; }
void PanguAppendStore::CreateDirs(const std::string& root) { if (CreateDirectory(root)) { LOG4CXX_DEBUG(logger_, "CreateDirectory : " << root); } std::string index_path = root+ std::string(Defaults::IDX_DIR); if (CreateDirectory(index_path.c_str())) { LOG4CXX_DEBUG(logger_, "CreateDirectory : " << index_path); } std::string data_path = root+ std::string(Defaults::DAT_DIR); if (CreateDirectory(data_path.c_str())) { LOG4CXX_DEBUG(logger_, "CreateDirectory : " << data_path); } std::string log_path = root + std::string(Defaults::LOG_DIR); if (CreateDirectory(log_path.c_str())) { LOG4CXX_DEBUG(logger_, "CreateDirectory : " << log_path); } LOG4CXX_TRACE(logger_, "Store::Directories Created" ); }
void Vcd_instrumenter::initial(ir::Time const& t) { LOG4CXX_TRACE(m_logger, "initial dump"); m_os << "$enddefinitions\n"; write_dump_all(m_os); }
// XXX TODO: consider returning std::vector<scidb::SharedMemoryPtr> // XXX TODO: which would require supporting different types of memory (double, char etc.) std::vector<MPIPhysical::SMIptr_t> MPIPhysical::allocateMPISharedMemory(size_t numBufs, size_t elemSizes[], size_t numElems[], string dbgNames[]) { if(DBG) { std::cerr << "SHM ALLOCATIONS:@@@@@@@@@@@@@@@@@@@" << std::endl ; for(size_t ii=0; ii< numBufs; ii++) { std::cerr << "numElems["<<ii<<"] "<< dbgNames[ii] << " len = " << numElems[0] << std::endl; } } std::vector<SMIptr_t> shmIpc(numBufs); for(size_t ii=0; ii<numBufs; ii++) { std::stringstream suffix; suffix << "." << ii ; std::string ipcNameFull= _ipcName + suffix.str(); LOG4CXX_TRACE(logger, "IPC name = " << ipcNameFull); shmIpc[ii] = SMIptr_t(mpi::newSharedMemoryIpc(ipcNameFull)); // can I get 'em off ctx instead? _ctx->addSharedMemoryIpc(_launchId, shmIpc[ii]); try { shmIpc[ii]->create(SharedMemoryIpc::RDWR); shmIpc[ii]->truncate(elemSizes[ii] * numElems[ii]); } catch(SharedMemoryIpc::SystemErrorException& e) { std::stringstream ss; ss << "shared_memory_mmap " << e.what(); throw (SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_OPERATION_FAILED) << ss.str()) ; } catch(SharedMemoryIpc::InvalidStateException& e) { throw (SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_UNKNOWN_ERROR) << e.what()); } } return shmIpc; }
Chunk* PanguAppendStore::LoadRandomChunk(ChunkIDType id) { if (ValidChunkID(id) == false) { return 0; } // first look at the current reading chunk if(mCurrentRandomChunk.get() != 0) { if(mCurrentRandomChunk.get()->GetID() == id) { return mCurrentRandomChunk.get(); } } // then search the opened chunks ChunkMapType::const_iterator it = mChunkMap.find(id); if (it != mChunkMap.end()) { return it->second.get(); } // still not found, have to open the chunk for read mCurrentRandomChunk.reset(new Chunk(mRoot, id, mMeta.maxChunkSize, false, mCodec, mCache)); assert(mCurrentRandomChunk.get()); mChunkMap.insert(std::make_pair(id, mCurrentRandomChunk)); LOG4CXX_TRACE(logger_, "Store::LoadedRandomChunk" ); return mCurrentRandomChunk.get(); }
void PanguAppendStore::WriteMetaInfo(const std::string& root, const StoreMetaData& meta) { std::string metaFileName = root + MetaFileName; try { FileHelper* metaOutputFH = mFileSystemHelper->CreateFileHelper(metaFileName, O_WRONLY); metaOutputFH->Open(); char *write_buffer = new char[sizeof(StoreMetaData)]; /* Copying into buffer from StoreMetaData */ LOG4CXX_DEBUG(logger_, "before reading mMeta values : " << mMeta.storeminor << "," << mMeta.storemajor << "," << mMeta.maxChunkSize << "," << mMeta.blockIndexInterval << "," << mMeta.compressionFlag); meta.toBuffer(write_buffer); metaOutputFH->WriteData(write_buffer, sizeof(StoreMetaData)); metaOutputFH->Close(); mFileSystemHelper->DestroyFileHelper(metaOutputFH); } catch (ExceptionBase& e) { THROW_EXCEPTION(AppendStoreWriteException, e.ToString()+" Cannot generate .meta_ file"); } LOG4CXX_TRACE(logger_, "Store::WroteMetaDataInfo()" ); }
void MpiLauncher::handleKillTimeout(boost::shared_ptr<boost::asio::deadline_timer>& killTimer, const boost::system::error_code& error) { ScopedMutexLock lock(_mutex); if (error == boost::asio::error::operation_aborted) { assert(_pid < 0); LOG4CXX_TRACE(logger, " MPI launcher kill timer cancelled"); return; } if (error) { assert(false); LOG4CXX_WARN(logger, "MPI launcher kill timer encountered error"<<error); } if (_pid <= 0) { LOG4CXX_WARN(logger, "MPI launcher kill timer cannot kill pid="<<_pid); return; } if (!_waiting) { assert(false); LOG4CXX_ERROR(logger, "MPI launcher kill timer cannot kill pid="<<_pid); throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__) << " MPI launcher process cannot be killed"; } LOG4CXX_WARN(logger, "MPI launcher is about to kill group pid="<<_pid); // kill launcher's proc group MpiErrorHandler::killProc(_installPath, -_pid); }
// Returns samples (1 sample contains data from all channels) long Mp3Stream::read(float* buffer, int bytes) { LOG4CXX_TRACE(narratorMP3StreamLog, "read " << bytes << " bytes from mp3 file"); // mpg123 uses enconding MPG123_ENC_SIGNED_16 which results in decoded short samples short *shortBuffer; shortBuffer = new short[bytes * mChannels]; size_t done = 0; int result = mpg123_read(mh, (unsigned char*)shortBuffer, bytes*sizeof(short)*mChannels, &done); switch (result) { case MPG123_DONE: LOG4CXX_DEBUG(narratorMP3StreamLog, "End of stream"); break; case MPG123_OK: break; } LOG4CXX_TRACE(narratorMP3StreamLog, done << " bytes decoded"); // convert short buffer to scaled float buffer float *bufptr = buffer; for (int i = 0; i < done/sizeof(short); i++) { int value = (int)shortBuffer[i]; if (value == 0) { *bufptr++ = 0.f; } else if (value < 0) { // multiple with 2.0f to increase volume by a factor of 2 (+6dB) *bufptr++ = (float)(value/scaleNegative) * 2.0f; } else { // multiple with 2.0f to increase volume by a factor of 2 (+6dB) *bufptr++ = (float)(value/scalePositive) * 2.0f; } } delete shortBuffer; return done/(sizeof(short) * mChannels); }
void Log4::logTrace(int i, std::string *message) { if (logger[i][0]->isTraceEnabled()) { logCall[0] += 1; LOG4CXX_TRACE(logger[i][0], *message); } }
void induceSAs(const DNASeqList& reads, SuffixArray* sa, char** type_array, size_t* counts, size_t* buckets, size_t n, size_t K, bool end) { getBuckets(counts, buckets, K, end); for (size_t i = n; i > 0; --i) { const SuffixArray::Elem& ielem = (*sa)[i - 1]; if (!ielem.empty() && ielem.j > 0) { LOG4CXX_TRACE(logger, boost::format("Curr: %d %d") % ielem.i % ielem.j); SuffixArray::Elem jelem(ielem.i, ielem.j - 1); if (getBit(type_array, jelem.i, jelem.j)) { const DNASeq& read = reads[jelem.i]; char c = read.seq[jelem.j]; LOG4CXX_TRACE(logger, boost::format("<iSA1>Placing %d %d at position %d") % jelem.i % jelem.j % (buckets[DNAAlphabet::torank(c)] - 1)); (*sa)[--buckets[DNAAlphabet::torank(c)]] = jelem; } } } }
int ProcwatcherIMV::loadPKey(void) { LOG4CXX_TRACE(logger, "loadPKey()"); pKey = X509_get_pubkey(x509Cert); if (pKey == NULL) return -1; return 0; }
int ProcwatcherIMV::loadRSA(void) { LOG4CXX_TRACE(logger, "loadRSA()"); rsa = EVP_PKEY_get1_RSA(pKey); if (rsa == NULL) return -1; return 0; }
void SphereInitializer::initialize(ParticleContainer& container) { utils::Vector<double,3> x(0.); double m = _config.getMaterialConfig().getM(); double epsilon = _config.getMaterialConfig().getEpsilon(); double sigma = _config.getMaterialConfig().getSigma(); LOG4CXX_DEBUG(logger, "SphereInitializer material: m=" << m << " epsilon=" << epsilon << " sigma=" << sigma); int n = _config.getN(); double h = _config.getH(); double radius = ((double)n) * h; const utils::Vector<double, 3>& center = _config.getX(); utils::Vector<double,3> radius_vector = radius; utils::Vector<double,3> lower_left_front = center - radius_vector; int dim = Configuration::getInstance().getDimension(); LOG4CXX_DEBUG(logger, "SphereINitializer dimension: " << dim ); bool two_d = (dim == 2); if (two_d) { lower_left_front[2] = center[2]; } const utils::Vector<double, 3>& v = _config.getV(); int innerCount = two_d ? 1 : (2*n); LOG4CXX_DEBUG(logger, "Initializing SPHERE at " << _config.getX().toString() << " two_d==" << two_d); for (int i = 0; i < n*2; i++) { for (int j = 0; j < n*2; j++) { for (int k = 0; k < innerCount; k++) { x[0] = lower_left_front[0] + ((double)i) * h; x[1] = lower_left_front[1] + ((double)j) * h; x[2] = lower_left_front[2] + ((double)k) * h; LOG4CXX_TRACE(logger, "point at " << x.toString() << "has distance " << (x - center).L2Norm() << " and radius is "<< radius); if ((x - center).L2Norm() < radius) { LOG4CXX_TRACE(logger, "creating (x,y,z): (" << x[0] << "," << x[1] << "," << x[2] << ")"); Particle p(x, v, m, epsilon, sigma, _type_id); //MaxwellBoltzmannDistribution(p, 0.1, dim); container.addParticle(p); } } } } }
void RLEEncoding<scidb::Value>::initializeInternalDatum(const char* buf, size_t dataIndx, size_t elemSize) { const char * func = "RLEEncoding<scidb::Value>::initializeInternalDatum"; assert(dataIndx < _data.size()); scidb::Value& el = _data[dataIndx]; el.setData(buf, elemSize); LOG4CXX_TRACE(logger, func << " this = "<< this <<" next value = "<<el); }
bool RemoteArray::proceedChunkMsg(AttributeID attId, MemChunk& chunk) { boost::shared_ptr<MessageDesc> chunkDesc = _messages[attId]; _messages[attId].reset(); StatisticsScope sScope(_statistics); boost::shared_ptr<scidb_msg::Chunk> chunkMsg = chunkDesc->getRecord<scidb_msg::Chunk>(); currentStatistics->receivedSize += chunkDesc->getMessageSize(); currentStatistics->receivedMessages++; if (!chunkMsg->eof()) { LOG4CXX_TRACE(logger, "RemoteArray received next chunk message"); assert(chunkDesc->getBinary()); const int compMethod = chunkMsg->compression_method(); const size_t decompressedSize = chunkMsg->decompressed_size(); Address firstElem; firstElem.attId = attId; firstElem.arrId = getArrayDesc().getId(); for (int i = 0; i < chunkMsg->coordinates_size(); i++) { firstElem.coords.push_back(chunkMsg->coordinates(i)); } chunk.initialize(this, &desc, firstElem, compMethod); chunk.setSparse(chunkMsg->sparse()); chunk.setCount(chunkMsg->count()); boost::shared_ptr<CompressedBuffer> compressedBuffer = dynamic_pointer_cast<CompressedBuffer>(chunkDesc->getBinary()); compressedBuffer->setCompressionMethod(compMethod); compressedBuffer->setDecompressedSize(decompressedSize); chunk.decompress(*compressedBuffer); LOG4CXX_TRACE(logger, "RemoteArray initializes next chunk"); requestNextChunk(attId); return true; } else { return false; } }