#ifndef BENCHMARKDIALOG_H #define BENCHMARKDIALOG_H #include #include #include "ui_benchmarks.h" #include #include "Bitmap.h" #include struct BenchmarkResult { std::vector> values; double percentage = 0.0; }; Q_DECLARE_METATYPE(BenchmarkResult) class Benchmarker : public QObject { Q_OBJECT private: mnd::MandelContext mndContext; static const std::vector benches; public: inline Benchmarker(mnd::MandelContext& mndContext) : mndContext{ mnd::initializeContext() } { } static mnd::MandelViewport benchViewport(void); std::pair measureMips(const std::function*()>& bench) const; double benchmarkResult(mnd::Generator& mg) const; public slots: void start(void); signals: void update(BenchmarkResult br); void finished(void); }; class BenchmarkDialog : public QDialog { Q_OBJECT private: Ui::BenchmarkDialog ui; mnd::MandelContext& mndContext; QThread benchThread; Benchmarker benchmarker; public: explicit BenchmarkDialog(mnd::MandelContext& mndContext, QWidget *parent = nullptr); signals: public slots: void update(BenchmarkResult br); private slots: void on_run_clicked(); }; #endif // BENCHMARKDIALOG_H