Commit f92240a8 authored by Daniel Smith's avatar Daniel Smith

WIP: update frametime to print with QDebug

parent 7c47e1ce
QT += quick
QT += quick opengl
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.0, 2018-12-12T16:24:04. -->
<!-- Written by QtCreator 4.8.0, 2018-12-13T10:03:53. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -7,7 +7,6 @@
#include <QQuickWindow>
#include <QGuiApplication>
void Benchmark::startTimer(){
}
......@@ -21,15 +20,32 @@ void Benchmark::countFrame(){
printf("frame.");
//No need to handle this. We probably just rendered extra frames before finished() completed.
}
printf("frame %d: %d ms\n", frame, thisframe);
qDebug() << "frame " << frame << ": " << thisframe << " ms";
frame+=1;
if (frame >= maxframes){
this->finished();
}
}
void Benchmark::measureFrame(qint64 value){
printf("%d,", static_cast<int>(value));
void Benchmark::measureMem(){
#ifdef _WIN32
//define something for Windows (32-bit and 64-bit, this part is common)
#elif __APPLE__
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_IPHONE
// iOS device
#elif TARGET_OS_MAC
// Other kinds of Mac OS
#else
# error "Unknown Apple platform"
#endif
#elif __linux__
// linux
#else
# error "Unknown compiler"
#endif
}
void Benchmark::finished(){
......
......@@ -4,6 +4,7 @@
#include <QObject>
#include <QGuiApplication>
#include <QElapsedTimer>
#include <QCoreApplication>
class Benchmark: public QObject{
......@@ -18,12 +19,12 @@ class Benchmark: public QObject{
QElapsedTimer timer;
int frame = 0;
int lastframetotal;
static const int maxframes = 120;
static const int maxframes = 300;
int frametimes [maxframes];
void finished();
void startTimer();
void measureFrame(qint64);
void measureMem();
const int processID = static_cast<int>(QCoreApplication::applicationPid());
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment