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.
|
(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 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)
|
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
|
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)
|
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)
|
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);
|
fVbox->addWidget(fOutput);
|
||||||
fOutput->setMinimumSize(800, 455);
|
fOutput->setMinimumSize(800, 455);
|
||||||
fOutput->setReadOnly(true);
|
fOutput->setReadOnly(true);
|
||||||
|
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||||
fQuitButton = new QPushButton( tr("Fitting...") );
|
fQuitButton = new QPushButton( tr("Fitting...") );
|
||||||
fVbox->addWidget(fQuitButton);
|
fVbox->addWidget(fQuitButton);
|
||||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||||
@ -85,6 +86,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
|||||||
tr("Quit") );
|
tr("Quit") );
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
fProcPID = fProc->pid();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -94,15 +96,19 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
|||||||
PFitOutputHandler::~PFitOutputHandler()
|
PFitOutputHandler::~PFitOutputHandler()
|
||||||
{
|
{
|
||||||
if (fProc->state() == QProcess::Running) {
|
if (fProc->state() == QProcess::Running) {
|
||||||
qDebug() << "fProc still running" << endl;
|
fProc->terminate();
|
||||||
fProc->kill();
|
if (!fProc->waitForFinished()) {
|
||||||
|
qDebug() << "fProc still running, will call kill." << endl;
|
||||||
|
fProc->kill();
|
||||||
|
}
|
||||||
|
fProc->waitForFinished();
|
||||||
}
|
}
|
||||||
/*
|
if (fProc->state() == QProcess::Running) {
|
||||||
if (fProc->isRunning()) {
|
QString cmd = "kill -9 "+ fProcPID;
|
||||||
QString msg = "fProc still running ...";
|
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd;
|
||||||
qDebug(msg);
|
qDebug() << msg << endl;
|
||||||
|
system(cmd.toLatin1());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (fProc) {
|
if (fProc) {
|
||||||
delete fProc;
|
delete fProc;
|
||||||
fProc = 0;
|
fProc = 0;
|
||||||
|
@ -64,6 +64,7 @@ class PFitOutputHandler : public QDialog
|
|||||||
virtual void processDone(int exitCode, QProcess::ExitStatus exitStatus);
|
virtual void processDone(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_PID fProcPID; ///< keeps the process PID
|
||||||
QProcess *fProc; ///< pointer to the musrfit process
|
QProcess *fProc; ///< pointer to the musrfit process
|
||||||
|
|
||||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||||
|
@ -48,6 +48,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
|||||||
fOutput = new QTextEdit( fVbox );
|
fOutput = new QTextEdit( fVbox );
|
||||||
fOutput->setMinimumSize(800, 455);
|
fOutput->setMinimumSize(800, 455);
|
||||||
fOutput->setReadOnly(true);
|
fOutput->setReadOnly(true);
|
||||||
|
connect( fOutput, SIGNAL( destroyed() ), this, SLOT(quitButtonPressed() ) );
|
||||||
fQuitButton = new QPushButton( tr("Fitting..."), fVbox );
|
fQuitButton = new QPushButton( tr("Fitting..."), fVbox );
|
||||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||||
resize( 800, 500 );
|
resize( 800, 500 );
|
||||||
@ -74,6 +75,7 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
|||||||
tr("Quit") );
|
tr("Quit") );
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
fProcPID = fProc->processIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -83,7 +85,13 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QStr
|
|||||||
PFitOutputHandler::~PFitOutputHandler()
|
PFitOutputHandler::~PFitOutputHandler()
|
||||||
{
|
{
|
||||||
if (fProc->isRunning()) {
|
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) {
|
if (fProc) {
|
||||||
delete fProc;
|
delete fProc;
|
||||||
@ -130,11 +138,8 @@ void PFitOutputHandler::quitButtonPressed()
|
|||||||
{
|
{
|
||||||
// if the fitting is still taking place, kill it
|
// if the fitting is still taking place, kill it
|
||||||
if (fProc->isRunning()) {
|
if (fProc->isRunning()) {
|
||||||
/*
|
|
||||||
fProc->tryTerminate();
|
fProc->tryTerminate();
|
||||||
QTimer::singleShot( 100, fProc, SLOT( kill() ) );
|
QTimer::singleShot( 1000, fProc, SLOT( kill() ) );
|
||||||
*/
|
|
||||||
fProc->kill();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
|
@ -58,6 +58,7 @@ class PFitOutputHandler : public QDialog
|
|||||||
virtual void processDone();
|
virtual void processDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_LONG fProcPID;
|
||||||
QProcess *fProc;
|
QProcess *fProc;
|
||||||
|
|
||||||
QVBox *fVbox;
|
QVBox *fVbox;
|
||||||
|
Reference in New Issue
Block a user