diff options
author | Martin Wolf <ext-martin.2.wolf@nokia.com> | 2010-05-17 16:02:02 +0300 |
---|---|---|
committer | Martin Wolf <ext-martin.2.wolf@nokia.com> | 2010-05-17 16:02:02 +0300 |
commit | def2b0c7930cd92b08351844a2e40a8e3ed94dae (patch) | |
tree | eb7ecc6129ff639f93ef54bdb08e3f0a200854b3 /tests/test-performance/dbus-spammer/dbus-services.h | |
parent | 0e279e4350932643144f4ba9ac0afe501cb94c47 (diff) |
Added performance tests
Diffstat (limited to 'tests/test-performance/dbus-spammer/dbus-services.h')
-rw-r--r-- | tests/test-performance/dbus-spammer/dbus-services.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/test-performance/dbus-spammer/dbus-services.h b/tests/test-performance/dbus-spammer/dbus-services.h new file mode 100644 index 0000000..6924fdc --- /dev/null +++ b/tests/test-performance/dbus-spammer/dbus-services.h @@ -0,0 +1,74 @@ +#ifndef _DBUS_THREAD_ +#define _DBUS_THREAD_ + +#include <QList> +#include <QtDBus/QtDBus> +#include <QtCore/QObject> +#include <QtCore/QCoreApplication> +#include <dbus/dbus.h> + +typedef QList<QThread*> Threads; +typedef QList<QObject*> Servers; + +class Maintainer : public QObject +{ + Q_OBJECT + +public: + Maintainer(Threads* t); + ~Maintainer(); + +protected: + void timerEvent(QTimerEvent *e); + + int timerID; + Threads* threads; + bool allOnline; +}; + +class DbusSpammer : public QThread +{ +public: + DbusSpammer(int id, QString service, int messageLen); + ~DbusSpammer(); + + void run(); + + DBusConnection* myBus; + DBusMessage* myMessage; + + bool firstTime; + bool exitThread; + int threadID; + const char* pszSpamData; + QString spamData; + QString serviceName; + +protected: + void timerEvent(QTimerEvent *e); + + int timerID; +}; + +class DbusServer: public QThread +{ + Q_OBJECT + +public: + DbusServer(int id); + ~DbusServer(); + + const QString& getServiceName() { return serviceName; } + const int getServiceID() { return serviceID; } + void run(); + +private: + QDBusConnection* myBus; + QString serviceName; + int serviceID; + +public slots: + Q_SCRIPTABLE QString ping(const QString &arg); +}; + +#endif // _DBUS_THREAD_ |