added an additional layer for process killing to musrgui/musredit which hopefully should help to reduce the number of musrfit/musrview corpses with high CPU load.
This commit is contained in:
@ -28,6 +28,8 @@ FIXED 2 little annoying problems: (i) now it is possible to zoom down to the sin
|
||||
(ii) when switching between data- and difference-view, the x-range doesn't change anymore.
|
||||
FIXED musrt0 crash for histogram number out of range (MUSR-157)
|
||||
FIXED fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148)
|
||||
CHANGED added an additional layer for process killing to musrgui/musredit which hopefully should help to reduce the number of
|
||||
musrfit/musrview corpses with high CPU load.
|
||||
CHANGED the formating of the parameters such that they show the precision corresponding to the error. At the
|
||||
same time some other parameter formating is improved (MUSR-167)
|
||||
CHANGED the default behavior of msr2data for writing output-file headers (see svn-log 4758)
|
||||
|
@ -54,6 +54,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
||||
fVbox->addWidget(fOutput);
|
||||
fOutput->setMinimumSize(800, 455);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Fitting...") );
|
||||
fVbox->addWidget(fQuitButton);
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
@ -85,6 +86,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
||||
tr("Quit") );
|
||||
done(0);
|
||||
}
|
||||
fProcPID = fProc->pid();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -94,15 +96,19 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
||||
PFitOutputHandler::~PFitOutputHandler()
|
||||
{
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
qDebug() << "fProc still running" << endl;
|
||||
fProc->kill();
|
||||
fProc->terminate();
|
||||
if (!fProc->waitForFinished()) {
|
||||
qDebug() << "fProc still running, will call kill." << endl;
|
||||
fProc->kill();
|
||||
}
|
||||
fProc->waitForFinished();
|
||||
}
|
||||
/*
|
||||
if (fProc->isRunning()) {
|
||||
QString msg = "fProc still running ...";
|
||||
qDebug(msg);
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
QString cmd = "kill -9 "+ fProcPID;
|
||||
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd;
|
||||
qDebug() << msg << endl;
|
||||
system(cmd.toLatin1());
|
||||
}
|
||||
*/
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
fProc = 0;
|
||||
|
@ -64,6 +64,7 @@ class PFitOutputHandler : public QDialog
|
||||
virtual void processDone(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
Q_PID fProcPID; ///< keeps the process PID
|
||||
QProcess *fProc; ///< pointer to the musrfit process
|
||||
|
||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||
|
@ -48,6 +48,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
||||
fOutput = new QTextEdit( fVbox );
|
||||
fOutput->setMinimumSize(800, 455);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT(quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Fitting..."), fVbox );
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
resize( 800, 500 );
|
||||
@ -74,6 +75,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
||||
tr("Quit") );
|
||||
done(0);
|
||||
}
|
||||
fProcPID = fProc->processIdentifier();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -83,7 +85,13 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
||||
PFitOutputHandler::~PFitOutputHandler()
|
||||
{
|
||||
if (fProc->isRunning()) {
|
||||
fProc->kill();
|
||||
fProc->tryTerminate();
|
||||
QTimer::singleShot( 3000, fProc, SLOT( kill() ) );
|
||||
}
|
||||
if (fProc->isRunning()) { // try low level kill
|
||||
char cmd[128];
|
||||
sprintf(cmd, "kill -9 %ld", fProcPID);
|
||||
system(cmd);
|
||||
}
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
@ -130,11 +138,8 @@ void PFitOutputHandler::quitButtonPressed()
|
||||
{
|
||||
// if the fitting is still taking place, kill it
|
||||
if (fProc->isRunning()) {
|
||||
/*
|
||||
fProc->tryTerminate();
|
||||
QTimer::singleShot( 100, fProc, SLOT( kill() ) );
|
||||
*/
|
||||
fProc->kill();
|
||||
QTimer::singleShot( 1000, fProc, SLOT( kill() ) );
|
||||
}
|
||||
|
||||
accept();
|
||||
|
@ -58,6 +58,7 @@ class PFitOutputHandler : public QDialog
|
||||
virtual void processDone();
|
||||
|
||||
private:
|
||||
Q_LONG fProcPID;
|
||||
QProcess *fProc;
|
||||
|
||||
QVBox *fVbox;
|
||||
|
Reference in New Issue
Block a user