From 61d9d45be19722b396ed9892668fb0a3ff164e34 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 10 Dec 2022 09:24:24 -0500 Subject: [PATCH] Clean up the timer 'init' and 'fini' calls, etc. --- q65w/libm65/decode0.f90 | 2 -- q65w/libm65/ftninit.f90 | 5 ++++- q65w/libm65/m65c.f90 | 24 +++++++++++++++--------- q65w/mainwindow.cpp | 12 ++++++++---- q65w/mainwindow.h | 2 +- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/q65w/libm65/decode0.f90 b/q65w/libm65/decode0.f90 index e3e8c251d..fa66b4bbd 100644 --- a/q65w/libm65/decode0.f90 +++ b/q65w/libm65/decode0.f90 @@ -20,7 +20,6 @@ subroutine decode0(dd,ss,savg,nstandalone) call sec0(0,tquick) ncand=0 - call timer('decode0 ',0) if(newdat.ne.0) then nz=96000*nhsym/5.3833 hist=0 @@ -59,7 +58,6 @@ subroutine decode0(dd,ss,savg,nstandalone) neme,ndepth,nstandalone,hiscall,hisgrid,nhsym,nfsample, & ndiskdat,nxpol,nmode,ndop00,ncand) call timer('map65a ',1) - call timer('decode0 ',1) if(nhsym.eq.nhsym2) write(*,1012) ndecodes,ncand 1012 format('',2i4) diff --git a/q65w/libm65/ftninit.f90 b/q65w/libm65/ftninit.f90 index f4217b6a0..d93fe4076 100644 --- a/q65w/libm65/ftninit.f90 +++ b/q65w/libm65/ftninit.f90 @@ -1,7 +1,7 @@ !subroutine ftninit() subroutine ftninit - use timer_module, only: timer + use timer_impl, only: init_timer !,fini_timer, limtrace use, intrinsic :: iso_c_binding, only: C_NULL_CHAR use FFTW3 ! character*(*) appd @@ -10,6 +10,9 @@ subroutine ftninit character wisfile*256 common/pfxcom/addpfx + lu=8 + call init_timer('./timer.out') + appd='.' addpfx=' ' call pfxdump(appd//'/prefixes.txt') diff --git a/q65w/libm65/m65c.f90 b/q65w/libm65/m65c.f90 index 3b533d195..558a9d8ae 100644 --- a/q65w/libm65/m65c.f90 +++ b/q65w/libm65/m65c.f90 @@ -1,7 +1,7 @@ -subroutine m65c +subroutine m65c(itimer) use timer_module, only: timer - use timer_impl, only: init_timer !, limtrace + use timer_impl, only: fini_timer !, limtrace use, intrinsic :: iso_c_binding, only: C_NULL_CHAR use FFTW3 use q65 @@ -29,21 +29,27 @@ subroutine m65c data first/.true./ save first,cwd + if(itimer.ne.0) then +! call timer('q65w ',1) +! call timer('q65w ',101) + call timer('decode0 ',101) + call fini_timer + return + endif + lq65w=.true. lq65w2=.true. nparams=nparams0 !Copy parameters into common/npar/ datetime(18:20)=':00' -! if(first) then -! call getcwd(cwd) -! call ftninit(trim(cwd)) -! call init_timer (trim(cwd)//'/timer.out') -! first=.false. -! endif +! if(first) call timer('q65w ',0) +! first=.false. npatience=1 nstandalone=0 - if(sum(nparams).ne.0) call decode0(dd,ss,savg,nstandalone) + call timer('decode0 ',0) + call decode0(dd,ss,savg,nstandalone) + call timer('decode0 ',1) return end subroutine m65c diff --git a/q65w/mainwindow.cpp b/q65w/mainwindow.cpp index d3f42e011..547514ca1 100644 --- a/q65w/mainwindow.cpp +++ b/q65w/mainwindow.cpp @@ -233,6 +233,9 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { writeSettings(); + int itimer=1; + m65c_(&itimer); + if (soundInThread.isRunning()) { soundInThread.quit(); soundInThread.wait(3000); @@ -751,7 +754,7 @@ void MainWindow::on_stopButton_clicked() //stopButton { m_monitoring=false; soundInThread.setMonitoring(m_monitoring); - m_loopall=false; + m_loopall=false; } void MainWindow::msgBox(QString t) //msgBox @@ -1033,7 +1036,8 @@ void MainWindow::decode() //decode() // QFile lockFile(m_appDir + "/.lock"); // Allow m65 to start // lockFile.remove(); - watcher3.setFuture(QtConcurrent::run (std::bind (m65c_))); + int itimer=0; + watcher3.setFuture(QtConcurrent::run (std::bind (m65c_, &itimer))); decodeBusy(true); } @@ -1067,7 +1071,7 @@ void MainWindow::m65_error (QProcess::ProcessError) } void MainWindow::readFromStdout() //readFromStdout -{ +{ while(proc_m65.canReadLine()) { QByteArray t=proc_m65.readLine(); @@ -1302,7 +1306,7 @@ void MainWindow::on_addButton_clicked() //Add button } while(!s.isNull()); if(hc>hc1 && !m_call3Modified) out << newEntry + "\n"; } - + if(m_call3Modified) { auto const& old_path = m_appDir + "/CALL3.OLD"; QFile f0 {old_path}; diff --git a/q65w/mainwindow.h b/q65w/mainwindow.h index b38cfaa10..8128acbc7 100644 --- a/q65w/mainwindow.h +++ b/q65w/mainwindow.h @@ -231,7 +231,7 @@ extern "C" { void astrosub00_ (int* nyear, int* month, int* nday, double* uth, int* nfreq, const char* mygrid, int* ndop00, int len1); - void m65c_(void); + void m65c_(int* itimer); } #endif // MAINWINDOW_H