Added debugging fromthe decoder

This commit is contained in:
Jordan Sherer 2019-11-19 10:13:10 -05:00
parent 41321561bc
commit 2a320ddcdd
2 changed files with 57 additions and 17 deletions

View File

@ -71,13 +71,14 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
nfox=0
endif
trydecode=.false.
write(*,1012) params%nsubmode, params%nsubmodes
1012 format('<DecodeStarted>',2i4)
if(params%nmode.eq.8 .and. (params%nsubmode.eq.4 .or. iand(params%nsubmodes, 8).eq.8)) then
! We're in JS8 mode E
call timer('decjs8e ',0)
newdat=params%newdat
trydecode=.true.
write(*,*) '<DecodeDebug> mode E decode started'
! copy the relevant frames for decoding
pos = max(0,params%kposE)
@ -90,6 +91,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
mycall,mygrid,hiscall,hisgrid)
write(*,*) '<DecodeDebug> mode E decode finished'
call timer('decjs8e ',1)
endif
@ -97,7 +101,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
! We're in JS8 mode C
call timer('decjs8c ',0)
newdat=params%newdat
trydecode=.true.
write(*,*) '<DecodeDebug> mode C decode started'
! copy the relevant frames for decoding
pos = max(0,params%kposC)
@ -110,6 +114,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
mycall,mygrid,hiscall,hisgrid)
write(*,*) '<DecodeDebug> mode C decode finished'
call timer('decjs8c ',1)
endif
@ -117,7 +124,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
! We're in JS8 mode B
call timer('decjs8b ',0)
newdat=params%newdat
trydecode=.true.
write(*,*) '<DecodeDebug> mode B decode started'
! copy the relevant frames for decoding
pos = max(0,params%kposB)
@ -130,6 +137,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
mycall,mygrid,hiscall,hisgrid)
write(*,*) '<DecodeDebug> mode B decode finished'
call timer('decjs8b ',1)
endif
@ -137,7 +147,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
! We're in JS8 mode A
call timer('decjs8a ',0)
newdat=params%newdat
trydecode=.true.
write(*,*) '<DecodeDebug> mode A decode started'
! copy the relevant frames for decoding
pos = max(0,params%kposA)
@ -150,16 +160,19 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
mycall,mygrid,hiscall,hisgrid)
write(*,*) '<DecodeDebug> mode A decode finished'
call timer('decjs8a ',1)
endif
if(trydecode) go to 800
write(*,*) '<DecodeDebug> finished'
call flush(6)
!$call omp_set_dynamic(.true.)
800 ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8e%decoded
write(*,1010) nsynced,ndecoded
1010 format('<DecodeFinished>',2i4)
ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8e%decoded
call sleep_msec(3000)
write(*,1010) ndecoded
1010 format('<DecodeFinished>',i4)
call flush(6)
return

View File

@ -1604,9 +1604,6 @@ void MainWindow::initDecoderSubprocess(){
if(JS8_DEBUG_DECODE) qDebug() << "decoder subprocess starting...";
auto proc = new QProcess(this);
proc->setProcessEnvironment (env);
proc->start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
"js8", js8_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
connect(proc, &QProcess::readyReadStandardOutput, this,
[this, proc](){
@ -1620,9 +1617,28 @@ void MainWindow::initDecoderSubprocess(){
connect(proc, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
[this, proc] (int exitCode, QProcess::ExitStatus status) {
proc->deleteLater();
proc->thread()->quit();
subProcessFailed (proc, exitCode, status);
});
proc->setProcessEnvironment (env);
proc->start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
"js8", js8_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
// create a process watcher looking for stdout read...
// seems like we're starving the event loop or something?
// auto watcher = new QTimer(proc);
// watcher->setInterval(500);
// connect(watcher, &QTimer::timeout, this,
// [this, proc](){
// if(proc->canReadLine()){
// if(JS8_DEBUG_DECODE) qDebug() << "decode process watcher intercepted readline";
// readFromStdout(proc);
// }
// });
// watcher->start();
// kill the previous proc and set the new one
m_valid = false;
{
@ -4371,8 +4387,8 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
dec_data.params.nmode=8;
dec_data.params.lft8apon = false;
dec_data.params.napwid=50;
dec_data.params.ntrperiod=period; //m_TRperiod;
dec_data.params.nsubmode=submode; // m_nSubMode;
dec_data.params.ntrperiod=-1; // not needed
dec_data.params.nsubmode=-1; // not needed
dec_data.params.minw=0;
dec_data.params.nclearave=m_nclearave;
@ -4660,6 +4676,7 @@ QList<int> generateOffsets(int minOffset, int maxOffset){
void MainWindow::readFromStdout(QProcess * proc) //readFromStdout
{
if(!proc || proc->state() == QProcess::NotRunning){
qDebug() << "proc not running";
return;
}
@ -4669,9 +4686,19 @@ void MainWindow::readFromStdout(QProcess * proc) //r
bool bAvgMsg=false;
int navg=0;
if(t.indexOf("<DecodeDebug>") >= 0) {
if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists());
return;
}
if(t.indexOf("<DecodeStarted>") >= 0) {
if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists());
return;
}
if(t.indexOf("<DecodeFinished>") >= 0) {
if(m_mode=="QRA64") m_wideGraph->drawRed(0,0);
m_bDecoded = t.mid(20).trimmed().toInt() > 0;
m_bDecoded = t.mid(16).trimmed().toInt() > 0;
int mswait=3*1000*m_TRperiod/4;
if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period
decodeDone();