blob: bd395e2cf310041e44114af1fe2b5df64caca704 [file] [log] [blame]
Jose Fonseca9653f952015-05-19 16:32:43 +01001#pragma once
Zack Rusin3acde362011-04-06 01:11:55 -04002
José Fonseca62997b42011-11-27 15:16:34 +00003#include "trace_api.hpp"
Dan McCabec6f924e2012-06-01 13:40:05 -07004#include "apitrace.h"
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;
BogDan Vatraa9f9e642015-02-10 14:31:17 +020043 bool isProfilingMemory() const;
James Bentonfc4f55a2012-08-08 17:09:07 +010044 bool isProfiling() const;
BogDan Vatraa9f9e642015-02-10 14:31:17 +020045 void setProfiling(bool gpu, bool cpu, bool pixels, bool memory);
James Bentonfc4f55a2012-08-08 17:09:07 +010046
Zack Rusinf389ae82011-04-10 19:27:28 -040047 void setCaptureAtCallNumber(qlonglong num);
48 qlonglong captureAtCallNumber() const;
49
50 bool captureState() const;
51 void setCaptureState(bool enable);
52
Dan McCabe66dfdda2012-03-05 17:20:39 -080053 bool captureThumbnails() const;
54 void setCaptureThumbnails(bool enable);
55
Dan McCabe88938852012-06-01 13:40:04 -070056 void addThumbnailToCapture(qlonglong num);
57 void resetThumbnailsToCapture();
BogDan Vatraa9f9e642015-02-10 14:31:17 +020058 QString thumbnailCallSet() const;
Dan McCabe88938852012-06-01 13:40:04 -070059
BogDan Vatraa9f9e642015-02-10 14:31:17 +020060 QStringList retraceArguments() const;
Dan McCabeb14bda22012-06-01 13:40:06 -070061
Zack Rusinf389ae82011-04-10 19:27:28 -040062signals:
63 void finished(const QString &output);
Zack Rusined40bc62011-08-28 17:11:02 -040064 void foundState(ApiTraceState *state);
James Bentonfc4f55a2012-08-08 17:09:07 +010065 void foundProfile(trace::Profile *profile);
Dan McCabec6f924e2012-06-01 13:40:05 -070066 void foundThumbnails(const ImageHash &thumbnails);
Zack Rusinf389ae82011-04-10 19:27:28 -040067 void error(const QString &msg);
Zack Rusin10fd4772011-09-14 01:45:12 -040068 void retraceErrors(const QList<ApiTraceError> &errors);
Zack Rusinf389ae82011-04-10 19:27:28 -040069
70protected:
71 virtual void run();
72
Zack Rusinf389ae82011-04-10 19:27:28 -040073private:
74 QString m_fileName;
Carl Worth7257dfc2012-08-09 08:21:42 -070075 QString m_remoteTarget;
José Fonseca62997b42011-11-27 15:16:34 +000076 trace::API m_api;
Zack Rusinf389ae82011-04-10 19:27:28 -040077 bool m_benchmarking;
78 bool m_doubleBuffered;
Peter Lohrmannb34c6752013-07-10 11:08:14 -040079 bool m_singlethread;
Corey Richardsonf3006462014-01-26 17:15:42 -050080 bool m_useCoreProfile;
Zack Rusinf389ae82011-04-10 19:27:28 -040081 bool m_captureState;
Dan McCabe66dfdda2012-03-05 17:20:39 -080082 bool m_captureThumbnails;
Zack Rusinf389ae82011-04-10 19:27:28 -040083 qlonglong m_captureCall;
James Bentonfc4f55a2012-08-08 17:09:07 +010084 bool m_profileGpu;
85 bool m_profileCpu;
86 bool m_profilePixels;
BogDan Vatraa9f9e642015-02-10 14:31:17 +020087 bool m_profileMemory;
Dan McCabe88938852012-06-01 13:40:04 -070088
89 QProcessEnvironment m_processEnvironment;
90
91 QList<qlonglong> m_thumbnailsToCapture;
Zack Rusin3acde362011-04-06 01:11:55 -040092};