[Qt-interest] QProcess output every five seconds ..
chandrasekar wagmare
sekarwagmare at gmail.com
Tue Mar 24 08:35:08 CET 2009
if u are using linux system ..? if so try glxgears ..
it will gives output of the system GL update performance every 5 sec ..
here is the output
4141 frames in 5.0 seconds = 828.175 FPS
4278 frames in 5.0 seconds = 855.514 FPS
4292 frames in 5.0 seconds = 858.278 FPS
4289 frames in 5.0 seconds = 857.783 FPS
4281 frames in 5.0 seconds = 856.154 FPS
4281 frames in 5.0 seconds = 856.113 FPS
4286 frames in 5.0 seconds = 857.108 FPS
4268 frames in 5.0 seconds = 853.481 FPS
4289 frames in 5.0 seconds = 857.796 FPS
4237 frames in 5.0 seconds = 847.388 FPS
4284 frames in 5.0 seconds = 856.748 FPS
4276 frames in 5.0 seconds = 855.032 FPS
4284 frames in 5.0 seconds = 856.781 FPS
4219 frames in 5.0 seconds = 843.677 FPS
4284 frames in 5.0 seconds = 856.639 FPS
each line will be printed in the console for every 5 seconds ...
now i try QString prog = "glxgears";
QStringList args << "-display" <<"192.168.1.4:0.0" ;
graphicsProc = new QProcess();
graphicsProc->setProcessChannelMode(QProcess::MergedChannels);
connect(graphicsTestButton, SIGNAL(clicked()), this, SLOT(startProc()));
connect(graphicsProc, SIGNAL(readyReadStandardOutput()), this,
SLOT(readFromStdout()));
connect(graphicsProc, SIGNAL(readyRead()), this,
SLOT(procUpdate()));
connect(graphicsProc, SIGNAL(error(QProcess::ProcessError)),this,
SLOT(processError(QProcess::ProcessError)));
void GraphicsTestDialog::startProc()
{
graphicsProc->start(prog, args);
}
void GraphicsTestDialog::readFromStdout()
{
printf("the std out value \n");
QTextCursor cursor(graphicsTextEdit->textCursor());
cursor.movePosition(QTextCursor::Start);
QProcess *pr = (QProcess*)sender();
graphicsTextEdit->append(pr->readAllStandardOutput());
graphicsTextEdit->setTextCursor(cursor);
}
void GraphicsTestDialog::processError(QProcess::ProcessError error)
{
if (error == QProcess::FailedToStart) {
graphicsTextEdit->append("failed to start the program .");
}
}
now in output the slot readFromStdout() is called after 5 minutes not in
every 5 seconds ... even the signal SIGNAL(readyRead()) also called after 5
minutes only ....
after five minutes in graphicsTextEdit it is printing
4141 frames in 5.0 seconds = 828.175 FPS
4278 frames in 5.0 seconds = 855.514 FPS
4292 frames in 5.0 seconds = 858.278 FPS
4289 frames in 5.0 seconds = 857.783 FPS
4281 frames in 5.0 seconds = 856.154 FPS
4281 frames in 5.0 seconds = 856.113 FPS
4286 frames in 5.0 seconds = 857.108 FPS
4268 frames in 5.0 seconds = 853.481 FPS
4289 frames in 5.0 seconds = 857.796 FPS
4237 frames in 5.0 seconds = 847.388 FPS
4284 frames in 5.0 seconds = 856.748 FPS
4276 frames in 5.0 seconds = 855.032 FPS
4284 frames in 5.0 seconds = 856.781 FPS
4219 frames in 5.0 seconds = 843.677 FPS
4284 frames in 5.0 seconds = 856.639 FPS
and agin after 5 minutes it appending the same amount of text ....
i dont know how to solve the problem .... please help ..
2009/3/24 Thiago Macieira <thiago.macieira at trolltech.com>
> chandrasekar wagmare wrote:
> >but the problem is after filling the entire buffer QProcess() calls the
> >readOut() slot ie the signal readyReadStandardOutput() is emitted only
> >after the buffer fills otherwise it takes five minutes and printing it
> > in a heap ..
>
> Here's what I don't understand: QProcess's buffer doesn't have a limit, so
> it can't fill up. With that in mind, I have to ask: what exactly is the
> symptom? Your interpretation appears to be incorrect.
>
> --
> Thiago Macieira - thiago.macieira (AT) nokia.com
> Senior Product Manager - Nokia, Qt Software
> Sandakerveien 116, NO-0402 Oslo, Norway
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
CHANDRU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090324/daedce42/attachment.html
More information about the Qt-interest-old
mailing list