blob: d4ee956d4cb572ca94d9b227f7e3f5d50d694eb1 [file] [log] [blame]
Zack Rusin3acde362011-04-06 01:11:55 -04001#ifndef RETRACER_H
2#define RETRACER_H
3
José Fonseca62997b42011-11-27 15:16:34 +00004#include "trace_api.hpp"
Zack Rusin10fd4772011-09-14 01:45:12 -04005#include "apitracecall.h"
6
Zack Rusinf389ae82011-04-10 19:27:28 -04007#include <QThread>
José Fonsecab6d7e162012-03-26 09:49:01 +01008#include <QProcess>
Zack Rusin3acde362011-04-06 01:11:55 -04009
Zack Rusinf389ae82011-04-10 19:27:28 -040010class ApiTraceState;
Zack Rusinf389ae82011-04-10 19:27:28 -040011
James Bentonfc4f55a2012-08-08 17:09:07 +010012namespace trace { struct Profile; }
13
Zack Rusinf389ae82011-04-10 19:27:28 -040014class Retracer : public QThread
15{
16 Q_OBJECT
17public:
18 Retracer(QObject *parent=0);
19
20 QString fileName() const;
21 void setFileName(const QString &name);
22
Carl Worth7257dfc2012-08-09 08:21:42 -070023 QString remoteTarget() const;
24 void setRemoteTarget(const QString &host);
25
José Fonseca62997b42011-11-27 15:16:34 +000026 void setAPI(trace::API api);
27
Zack Rusinf389ae82011-04-10 19:27:28 -040028 bool isBenchmarking() const;
29 void setBenchmarking(bool bench);
30
31 bool isDoubleBuffered() const;
32 void setDoubleBuffered(bool db);
33
Peter Lohrmannb34c6752013-07-10 11:08:14 -040034 bool isSinglethread() const;
35 void setSinglethread(bool singlethread);
36
Corey Richardsonf3006462014-01-26 17:15:42 -050037 bool isCoreProfile() const;
38 void setCoreProfile(bool coreprofile);
39
James Bentonfc4f55a2012-08-08 17:09:07 +010040 bool isProfilingGpu() const;
41 bool isProfilingCpu() const;
42 bool isProfilingPixels() const;
43 bool isProfiling() const;
44 void setProfiling(bool gpu, bool cpu, bool pixels);
45
Zack Rusinf389ae82011-04-10 19:27:28 -040046 void setCaptureAtCallNumber(qlonglong num);
47 qlonglong captureAtCallNumber() const;
48
49 bool captureState() const;
50 void setCaptureState(bool enable);
51
Dan McCabe66dfdda2012-03-05 17:20:39 -080052 bool captureThumbnails() const;
53 void setCaptureThumbnails(bool enable);
54
Dan McCabe88938852012-06-01 13:40:04 -070055 void addThumbnailToCapture(qlonglong num);
56 void resetThumbnailsToCapture();
57
Zack Rusinf389ae82011-04-10 19:27:28 -040058signals:
59 void finished(const QString &output);
Zack Rusined40bc62011-08-28 17:11:02 -040060 void foundState(ApiTraceState *state);
James Bentonfc4f55a2012-08-08 17:09:07 +010061 void foundProfile(trace::Profile *profile);
José Fonseca8759ae02012-03-24 07:44:43 +000062 void foundThumbnails(const QList<QImage> &thumbnails);
Zack Rusinf389ae82011-04-10 19:27:28 -040063 void error(const QString &msg);
Zack Rusin10fd4772011-09-14 01:45:12 -040064 void retraceErrors(const QList<ApiTraceError> &errors);
Zack Rusinf389ae82011-04-10 19:27:28 -040065
66protected:
67 virtual void run();
68
Zack Rusinf389ae82011-04-10 19:27:28 -040069private:
70 QString m_fileName;
Carl Worth7257dfc2012-08-09 08:21:42 -070071 QString m_remoteTarget;
José Fonseca62997b42011-11-27 15:16:34 +000072 trace::API m_api;
Zack Rusinf389ae82011-04-10 19:27:28 -040073 bool m_benchmarking;
74 bool m_doubleBuffered;
Peter Lohrmannb34c6752013-07-10 11:08:14 -040075 bool m_singlethread;
Corey Richardsonf3006462014-01-26 17:15:42 -050076 bool m_useCoreProfile;
Zack Rusinf389ae82011-04-10 19:27:28 -040077 bool m_captureState;
Dan McCabe66dfdda2012-03-05 17:20:39 -080078 bool m_captureThumbnails;
Zack Rusinf389ae82011-04-10 19:27:28 -040079 qlonglong m_captureCall;
James Bentonfc4f55a2012-08-08 17:09:07 +010080 bool m_profileGpu;
81 bool m_profileCpu;
82 bool m_profilePixels;
Dan McCabe88938852012-06-01 13:40:04 -070083
84 QProcessEnvironment m_processEnvironment;
85
86 QList<qlonglong> m_thumbnailsToCapture;
Zack Rusin3acde362011-04-06 01:11:55 -040087};
88
89#endif