EmsInfoView::EmsInfoView(QWidget *parent) : QWidget(parent) { ui.setupUi(this); ui.locationIdInfoTableWidget->setColumnCount(17); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("LocID")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Table Name")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("Flags")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(3,new QTableWidgetItem("Parent")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(4,new QTableWidgetItem("RamPage")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(5,new QTableWidgetItem("FlashPage")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(6,new QTableWidgetItem("RamAddress")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(7,new QTableWidgetItem("FlashAddress")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(8,new QTableWidgetItem("Size")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(9,new QTableWidgetItem("Has Parent")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(10,new QTableWidgetItem("Is Ram")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(11,new QTableWidgetItem("Is Flash")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(12,new QTableWidgetItem("Is Index")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(13,new QTableWidgetItem("Is Read Only")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(14,new QTableWidgetItem("Is Verified")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(15,new QTableWidgetItem("For Backup")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(16,new QTableWidgetItem("Table Type")); connect(ui.locationIdInfoTableWidget,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(locationInfoWidgetDoubleClicked(int,int))); connect(ui.checkSyncButton,SIGNAL(clicked()),this,SIGNAL(checkSync())); }
void AsyncFio::write(int fd, const void *src, unsigned int len) { WaitSema(_ioSema); checkSync(); assert(fd < MAX_HANDLES); _runningOp = _ioSlots + fd; fileXioWrite(fd, (unsigned char*)src, len); SignalSema(_ioSema); }
void AsyncFio::read(int fd, void *dest, unsigned int len) { WaitSema(_ioSema); checkSync(); assert(fd < MAX_HANDLES); _runningOp = _ioSlots + fd; fileXioRead(fd, (unsigned char*)dest, len); SignalSema(_ioSema); }
void AsyncFio::remove(const char *path) { int res; WaitSema(_ioSema); checkSync(); fileXioRemove(path); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); }
int AsyncFio::mount(const char *mountpoint, const char *mountstring, int flag) { int res; WaitSema(_ioSema); checkSync(); fileXioMount(mountpoint, mountstring, flag); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::sync(int fd) { WaitSema(_ioSema); if (_runningOp == _ioSlots + fd) checkSync(); int res = _ioSlots[fd]; _ioSlots[fd] = 0; SignalSema(_ioSema); return res; }
int AsyncFio::seek(int fd, int offset, int whence) { int res; WaitSema(_ioSema); checkSync(); fileXioLseek(fd, offset, whence); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::open(const char *name, int ioMode) { WaitSema(_ioSema); checkSync(); int res; fileXioOpen(name, ioMode, DEFAULT_MODE); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
void AsyncFio::dclose(int fd) { int res; WaitSema(_ioSema); checkSync(); fileXioDclose(fd); fileXioWaitAsync(FXIO_WAIT, &res); assert(res == 0); SignalSema(_ioSema); }
int AsyncFio::umount(const char *mountpoint) { int res; WaitSema(_ioSema); checkSync(); fileXioUmount(mountpoint); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::dread(int fd, iox_dirent_t *dest) { int res; WaitSema(_ioSema); checkSync(); fileXioDread(fd, dest); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::dopen(const char *name) { int res; WaitSema(_ioSema); checkSync(); fileXioDopen(name); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::mkdir(const char *name) { int res; WaitSema(_ioSema); checkSync(); fileXioMkdir(name, DEFAULT_MODE); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); return res; }
int AsyncFio::open(const char *name, int ioMode, int mode) { WaitSema(_ioSema); checkSync(); int res; fileXioOpen(name, ioMode, mode); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); // dbg_printf("FIO: open ext(%s, %d, %d) => %d", name, ioMode, mode, res); return res; }
int AsyncFio::dopen(const char *name) { int res; WaitSema(_ioSema); checkSync(); fileXioDopen(name); fileXioWaitAsync(FXIO_WAIT, &res); SignalSema(_ioSema); dbg_printf("FIO: dopen(%s) => %d\n", name, res); return res; }
void AsyncFio::close(int handle) { WaitSema(_ioSema); checkSync(); fileXioClose(handle); int res; fileXioWaitAsync(FXIO_WAIT, &res); if (res != 0) sioprintf("ERROR: fileXioClose failed, EC %d", res); _ioSlots[handle] = 0; SignalSema(_ioSema); }
void AsyncFio::dclose(int fd) { int res; WaitSema(_ioSema); checkSync(); fileXioDclose(fd); fileXioWaitAsync(FXIO_WAIT, &res); //assert(res == 0); dbg_printf("FIO: dclose(%d) => %d\n", fd, res); if (res != 0) sioprintf("ERROR: fileXioDclose failed, EC %d\n", res); SignalSema(_ioSema); }
void pdsp::PRNoiseGen::process_PA(const float* &trigSyncBuffer, const int &bufferSize) noexcept { float* outputBuffer = getOutputBufferToFill(output); for (int n = 0; n < bufferSize; ++n){ //resetting on cycle if (checkSync(trigSyncBuffer[n])){ pnRegister = seed; } outputBuffer[n] = PNSequenceNext(pnRegister); } }
//! Verify state of a file void CFile::checkFile(void) { if (mode.isEmpty() || mode.getValue() == mode_attr::write) { CTimer::get("Files : create headers").resume(); if (!isOpen) createHeader(); CTimer::get("Files : create headers").suspend(); checkSync(); } else { CTimer::get("Files : open headers").resume(); if (!isOpen) openInReadMode(); CTimer::get("Files : open headers").suspend(); } checkSplit(); }
EmsInfoView::EmsInfoView(QWidget *parent) : QWidget(parent) { ui.setupUi(this); /*ui.locationIdInfoTableWidget->setColumnCount(17); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("LocID")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Table Name")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("Flags")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(3,new QTableWidgetItem("Parent")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(4,new QTableWidgetItem("RamPage")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(5,new QTableWidgetItem("FlashPage")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(6,new QTableWidgetItem("RamAddress")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(7,new QTableWidgetItem("FlashAddress")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(8,new QTableWidgetItem("Size")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(9,new QTableWidgetItem("Has Parent")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(10,new QTableWidgetItem("Is Ram")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(11,new QTableWidgetItem("Is Flash")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(12,new QTableWidgetItem("Is Index")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(13,new QTableWidgetItem("Is Read Only")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(14,new QTableWidgetItem("Is Verified")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(15,new QTableWidgetItem("For Backup")); ui.locationIdInfoTableWidget->setHorizontalHeaderItem(16,new QTableWidgetItem("Table Type"));*/ connect(ui.locationIdInfoTableWidget,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(locationInfoWidgetDoubleClicked(int,int))); connect(ui.checkSyncButton,SIGNAL(clicked()),this,SIGNAL(checkSync())); //ui.locationIdInfoTableWidget->set //ui.locationIdInfoTableWidget->setContextMenuPolicy(Qt::ActionsContextMenu); //QAction *hexAction = new QAction(this); //hexAction->setText("Hex View"); //connect(hexAction,SIGNAL(triggered()),this,SLOT(hexViewClicked())); //QAction *normalAction= new QAction(this); //normalAction->setText("Normal View"); //connect(normalAction,SIGNAL(triggered()),this,SLOT(normalViewClicked())); //ui.locationIdInfoTableWidget->addAction(normalAction); //ui.locationIdInfoTableWidget->addAction(hexAction); }
void doOneUpdate(void) { int p_index, r_index; int retval = 0; struct timeval select_timeout; fd_set select_set; if (rep_type == SMR) { // Detect replica that self-kills, has no timer (Load does this due to memory leak) #ifdef TIME_WAITPID timestamp_t start_restart = generate_timestamp(); #endif // TIME_WAITPID // can only waitpid for children (unless subreaper is used (prctl is not POSIX compliant)). int exit_pid = waitpid(-1, NULL, WNOHANG); // Seems to take a while for to clean up zombies #ifdef TIME_WAITPID timestamp_t end_restart = generate_timestamp(); if (exit_pid > 0 && exit_pid != last_dead) { printf("Waitpid for %d (%s) took usec (%lf)\n", exit_pid, REP_TYPE_T[rep_type], diff_time(end_restart, start_restart, CPU_MHZ)); } else { //printf("No zombie took (%lld)\n", end_restart - start_restart); } #endif // TIME_WAITPID if (exit_pid > 0 && exit_pid != last_dead) { debug_print("PID %d exited on its own.\n", exit_pid); voterRestartHandler(); timer_started = false; } } select_timeout.tv_sec = 0; select_timeout.tv_usec = 50000; if (timer_started) { timestamp_t current = generate_timestamp(); long remaining = voting_timeout - diff_time(current, watchdog, CPU_MHZ); if (remaining > 0) { select_timeout.tv_sec = 0; select_timeout.tv_usec = remaining; } else { // printf("Restart handler called, %s is %ld late\n", controller_name, remaining); voterRestartHandler(); } } // See if any of the read pipes have anything FD_ZERO(&select_set); // Check external in pipes bool check_inputs = checkSync(); if (check_inputs) { for (p_index = 0; p_index < pipe_count; p_index++) { if (ext_pipes[p_index].fd_in != 0) { int e_pipe_fd = ext_pipes[p_index].fd_in; FD_SET(e_pipe_fd, &select_set); } } } else if (voter_priority < 5 && ! timer_started) { // non-RT controller is now lagging behind. timer_started = true; watchdog = generate_timestamp(); } // Check pipes from replicas for (p_index = 0; p_index < pipe_count; p_index++) { for (r_index = 0; r_index < rep_count; r_index++) { int rep_pipe_fd = replicas[r_index].vot_pipes[p_index].fd_in; if (rep_pipe_fd != 0) { FD_SET(rep_pipe_fd, &select_set); } } } // This will wait at least timeout until return. Returns earlier if something has data. retval = select(FD_SETSIZE, &select_set, NULL, NULL, &select_timeout); if (retval > 0) { // Check for data from external sources for (p_index = 0; p_index < pipe_count; p_index++) { int read_fd = ext_pipes[p_index].fd_in; if (read_fd != 0) { if (FD_ISSET(read_fd, &select_set)) { ext_pipes[p_index].buff_count = TEMP_FAILURE_RETRY(read(read_fd, ext_pipes[p_index].buffer, MAX_VOTE_PIPE_BUFF)); if (ext_pipes[p_index].buff_count > 0) { // TODO: read may still have been interrupted processData(&(ext_pipes[p_index]), p_index); } else if (ext_pipes[p_index].buff_count < 0) { printf("Voter - Controller %s pipe %d\n", controller_name, p_index); perror("Voter - read error on external pipe"); } else { printf("Voter - Controller %s pipe %d\n", controller_name, p_index); perror("Voter - read == 0 on external pipe"); } } } } // Check all replicas for data for (p_index = 0; p_index < pipe_count; p_index++) { for (r_index = 0; r_index < rep_count; r_index++) { struct vote_pipe* curr_pipe = &(replicas[r_index].vot_pipes[p_index]); if (curr_pipe->fd_in !=0) { if (FD_ISSET(curr_pipe->fd_in, &select_set)) { processFromRep(r_index, p_index); } } } } } }