Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-26 Thread Thiago Macieira
Em qua 26 fev 2014, às 10:29:46, Peter Hartmann escreveu:
 Hello,
 
 it might be the socket is bind()ing to a local address when it does not
 need to; would you be able to file a bug report with a program to
 reproduce the problem?

The interesting part to me are those SIOCGIFINDEX calls. We don't have those 
directly in our codebase, so it's coming from some library function we call. 
Probably if_nametoindex or the reverse.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-26 Thread Mauro Brenna
Hello Peter,
no I haven`t report it in a bug tracker yet. I still do not know if it is
just an issue related to my specific platform.
If I interpreted correctly what Thiago is trying to explain, maybe using
QT5 together with some other low level library of some specific version I
might have installed in my platform can cause this unexpected ioctl call?
Is there a way to get rid of that? Maybe initializing under the hood the
socket handled by QUdpSocket with some 'magic' parameter? Also the sendto
function seems to use a slightly different set of parameters. Can I make
those ones the same of the QT4.8.5?

Regards,

Mauro


On 26 February 2014 10:35, Thiago Macieira thiago.macie...@intel.comwrote:

 Em qua 26 fev 2014, às 10:29:46, Peter Hartmann escreveu:
  Hello,
 
  it might be the socket is bind()ing to a local address when it does not
  need to; would you be able to file a bug report with a program to
  reproduce the problem?

 The interesting part to me are those SIOCGIFINDEX calls. We don't have
 those
 directly in our codebase, so it's coming from some library function we
 call.
 Probably if_nametoindex or the reverse.
 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Development mailing list
 Development@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/development

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-26 Thread Peter Hartmann
On 02/26/2014 10:56 AM, Mauro Brenna wrote:
 no I haven`t report it in a bug tracker yet. I still do not know if it
 is just an issue related to my specific platform.

If you had an example program to reproduce the problem, I could check on 
my side whether the problem can be reproduced. Maybe the bug tracker 
(https://bugreports.qt-project.org/) is the right way to discuss this 
further...

Peter

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-26 Thread Mauro Brenna
You can find the example program sourcecode in my first e-mail.
I will try to open a bug then.

Thanks again,

Mauro



On 26 February 2014 11:06, Peter Hartmann phartm...@blackberry.com wrote:

 On 02/26/2014 10:56 AM, Mauro Brenna wrote:

 no I haven`t report it in a bug tracker yet. I still do not know if it
 is just an issue related to my specific platform.


 If you had an example program to reproduce the problem, I could check on
 my side whether the problem can be reproduced. Maybe the bug tracker (
 https://bugreports.qt-project.org/) is the right way to discuss this
 further...

 Peter


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-26 Thread Mauro Brenna
I have just reported the bug: QTBUG-37092
https://bugreports.qt-project.org/browse/QTBUG-37092

We can continue the discussion there.

Thanks.

Kind regards,

Mauro


On 26 February 2014 11:27, Mauro Brenna malloble...@gmail.com wrote:

 You can find the example program sourcecode in my first e-mail.
 I will try to open a bug then.

 Thanks again,

 Mauro



 On 26 February 2014 11:06, Peter Hartmann phartm...@blackberry.comwrote:

 On 02/26/2014 10:56 AM, Mauro Brenna wrote:

 no I haven`t report it in a bug tracker yet. I still do not know if it
 is just an issue related to my specific platform.


 If you had an example program to reproduce the problem, I could check on
 my side whether the problem can be reproduced. Maybe the bug tracker (
 https://bugreports.qt-project.org/) is the right way to discuss this
 further...

 Peter



___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-25 Thread Mauro Brenna
Hello,

I am facing an unusual behaviour related to the performance of the method
writeDatagram of QUdpSocket using two different version of QT ( Qt4.8.5 vs
Qt5.1.1).

I tested the same program both on Ubuntu between 4.8.1 and 5.0 and the
results are fine.
While on an emDebian arm platform, Qt5.1.1 performs much worse than Qt4.8.5
(two order of magnitude times slower).

Basically, my application is just calling writeDatagram in a for loop and
returns the average time writeDatagram calls.
The results after 1 calls, sending 19bytes of payload are:
 Qt 4.8.5 avg 0.000224s each call
 Qt 5.1.1 avg 0.033..s (about 30ms each message).

 I checked in Wireshark and I am able to receive the messages in both cases.
 Moreover, I tested vanilla c socket and they perform as good as qt 4.8.5.
 I wonder how it is possible, and if you have any suggestion in merit.
 I looked a bit in the qt code and saw a bind() inside the QT5
writeDatagram method, which I do not immediately understand but I do not
know if might cause the issue.
 Should I specify something more in the initialization of the QUdpSocket?
Are there any pauses, wait or blocking mechanisms?
 Might my ethernet interface configuration be wrong? How should I adjust it
in that case?

 Regards,


 Below is my code:

//Util.h
#pragma once
#ifdef __linux__
#include time.h
#else
#define NOMINMAX
#include windows.h
#include time.h
#endif

class Util
{
  public:
  inline static float GetTimeSeconds(void)
  {
   #ifdef __linux__
 static bool initialized = false;
 static struct timespec offsetTime;
 struct timespec startTime;
 clock_gettime( CLOCK_MONOTONIC, startTime);
 if (!initialized)
 {
offsetTime.tv_sec = startTime.tv_sec;
offsetTime.tv_nsec = startTime.tv_nsec;
initialized = true;
 }
 return static_castfloat( (startTime.tv_sec - offsetTime.tv_sec)
 + (startTime.tv_nsec - offsetTime.tv_nsec)/1.0e9);
   #else
 return static_castfloat(clock())/
static_castfloat(CLOCKS_PER_SEC);
   #endif
  }
};

//Task.h
#pragma once
#include QtCore
#include QtNetwork
#include QUdpSocket
#include Util.h

class Task : public QObject
{
Q_OBJECT
public:
Task(QObject *parent = 0) : QObject(parent) {}

public slots:
void run()
{
// Do processing here
unsigned int messageNo = 0;
QUdpSocket *udpSocket;
udpSocket = new QUdpSocket(this);
int times = 1;
QByteArray datagram = Broadcast message  +
QByteArray::number(messageNo);
const double t1 = Util::GetTimeSeconds();
  for (int i = 0; itimes; i++)
{
   udpSocket-writeDatagram(datagram.data(), datagram.size(),
QHostAddress::Broadcast, 45454);
}
const double t2 = Util::GetTimeSeconds();
qDebug( writeDatagram(): %f s, total %f, (t2 - t1)/times, (t2 -
t1));//dt
++messageNo;
emit finished();
delete udpSocket;
}

signals:
void finished();
};

// main.cpp
#include Task.h
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Task *task = new Task(a);
QObject::connect(task, SIGNAL(finished()), a, SLOT(quit()));
QTimer::singleShot(0, task, SLOT(run()));
return a.exec();
}
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms

2014-02-25 Thread Jan Kundrát
On Tuesday, 25 February 2014 16:56:53 CEST, Mauro Brenna wrote:
  I looked a bit in the qt code and saw a bind() inside the QT5
 writeDatagram method, which I do not immediately understand but I do not
 know if might cause the issue.

Is there any difference in `strace` when you instrument the Qt4 and Qt5 
versions of the test?

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development