uncrustify
This commit is contained in:
parent
0b8fb261fa
commit
fa1d70e6a5
4 changed files with 189 additions and 178 deletions
|
@ -6,7 +6,7 @@
|
|||
################################################################################
|
||||
# OF ROOT
|
||||
# The location of your root openFrameworks installation
|
||||
# (default) OF_ROOT = ../../..
|
||||
# (default) OF_ROOT = ../../..
|
||||
################################################################################
|
||||
# OF_ROOT = ../../..
|
||||
|
||||
|
@ -14,39 +14,39 @@
|
|||
# PROJECT ROOT
|
||||
# The location of the project - a starting place for searching for files
|
||||
# (default) PROJECT_ROOT = . (this directory)
|
||||
#
|
||||
#
|
||||
################################################################################
|
||||
# PROJECT_ROOT = .
|
||||
|
||||
################################################################################
|
||||
# PROJECT SPECIFIC CHECKS
|
||||
# This is a project defined section to create internal makefile flags to
|
||||
# conditionally enable or disable the addition of various features within
|
||||
# This is a project defined section to create internal makefile flags to
|
||||
# conditionally enable or disable the addition of various features within
|
||||
# this makefile. For instance, if you want to make changes based on whether
|
||||
# GTK is installed, one might test that here and create a variable to check.
|
||||
# GTK is installed, one might test that here and create a variable to check.
|
||||
################################################################################
|
||||
# None
|
||||
|
||||
################################################################################
|
||||
# PROJECT EXTERNAL SOURCE PATHS
|
||||
# These are fully qualified paths that are not within the PROJECT_ROOT folder.
|
||||
# Like source folders in the PROJECT_ROOT, these paths are subject to
|
||||
# Like source folders in the PROJECT_ROOT, these paths are subject to
|
||||
# exlclusion via the PROJECT_EXLCUSIONS list.
|
||||
#
|
||||
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
|
||||
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_EXTERNAL_SOURCE_PATHS =
|
||||
# PROJECT_EXTERNAL_SOURCE_PATHS =
|
||||
|
||||
################################################################################
|
||||
# PROJECT EXCLUSIONS
|
||||
# These makefiles assume that all folders in your current project directory
|
||||
# These makefiles assume that all folders in your current project directory
|
||||
# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
|
||||
# to look for source code. The any folders or files that match any of the
|
||||
# to look for source code. The any folders or files that match any of the
|
||||
# items in the PROJECT_EXCLUSIONS list below will be ignored.
|
||||
#
|
||||
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
|
||||
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
|
||||
# string unless teh user adds a wildcard (%) operator to match subdirectories.
|
||||
# GNU make only allows one wildcard for matching. The second wildcard (%) is
|
||||
# treated literally.
|
||||
|
@ -71,45 +71,46 @@
|
|||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
#
|
||||
# Currently, shared libraries that are needed are copied to the
|
||||
# Currently, shared libraries that are needed are copied to the
|
||||
# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
|
||||
# add a runtime path to search for those shared libraries, since they aren't
|
||||
# add a runtime path to search for those shared libraries, since they aren't
|
||||
# incorporated directly into the final executable application binary.
|
||||
################################################################################
|
||||
# PROJECT_LDFLAGS=-Wl,-rpath=./libs
|
||||
|
||||
################################################################################
|
||||
# PROJECT DEFINES
|
||||
# Create a space-delimited list of DEFINES. The list will be converted into
|
||||
# Create a space-delimited list of DEFINES. The list will be converted into
|
||||
# CFLAGS with the "-D" flag later in the makefile.
|
||||
#
|
||||
# (default) PROJECT_DEFINES = (blank)
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_DEFINES =
|
||||
# PROJECT_DEFINES =
|
||||
PROJECT_DEFINES = OFX_PROFILER=1
|
||||
|
||||
################################################################################
|
||||
# PROJECT CFLAGS
|
||||
# This is a list of fully qualified CFLAGS required when compiling for this
|
||||
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
|
||||
# This is a list of fully qualified CFLAGS required when compiling for this
|
||||
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
|
||||
# defined in your platform specific core configuration files. These flags are
|
||||
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
|
||||
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
|
||||
#
|
||||
# (default) PROJECT_CFLAGS = (blank)
|
||||
#
|
||||
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
|
||||
# your platform specific configuration file will be applied by default and
|
||||
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
|
||||
# your platform specific configuration file will be applied by default and
|
||||
# further flags here may not be needed.
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_CFLAGS =
|
||||
# PROJECT_CFLAGS =
|
||||
|
||||
################################################################################
|
||||
# PROJECT OPTIMIZATION CFLAGS
|
||||
# These are lists of CFLAGS that are target-specific. While any flags could
|
||||
# be conditionally added, they are usually limited to optimization flags.
|
||||
# These are lists of CFLAGS that are target-specific. While any flags could
|
||||
# be conditionally added, they are usually limited to optimization flags.
|
||||
# These flags are added BEFORE the PROJECT_CFLAGS.
|
||||
#
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
|
||||
|
@ -120,15 +121,15 @@
|
|||
#
|
||||
# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
|
||||
#
|
||||
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
|
||||
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
|
||||
# file will be applied by default and further optimization flags here may not
|
||||
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
|
||||
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
|
||||
# file will be applied by default and further optimization flags here may not
|
||||
# be needed.
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
|
||||
|
||||
################################################################################
|
||||
# PROJECT COMPILERS
|
||||
|
@ -137,5 +138,5 @@
|
|||
# (default) PROJECT_CC = (blank)
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_CXX =
|
||||
# PROJECT_CC =
|
||||
# PROJECT_CXX =
|
||||
# PROJECT_CC =
|
||||
|
|
|
@ -1,159 +1,172 @@
|
|||
#include "ofApp.h"
|
||||
#include "ofAppRunner.h"
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::setup() {
|
||||
OFX_PROFILER_BEGIN_SESSION("test","result.json");
|
||||
void ofApp::setup(){
|
||||
OFX_PROFILER_BEGIN_SESSION("test", "result.json");
|
||||
OFX_PROFILER_FUNCTION();
|
||||
|
||||
ofBackgroundHex(0x57554c);
|
||||
ofSetFrameRate(60);
|
||||
//ofSetFrameRate(60);
|
||||
ofSetVerticalSync(true);
|
||||
|
||||
|
||||
|
||||
|
||||
// slow = 1
|
||||
// faster = 2
|
||||
// super fast = 3
|
||||
mode = 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::update() {
|
||||
void ofApp::update(){
|
||||
OFX_PROFILER_FUNCTION();
|
||||
// add points all the time
|
||||
if(points.size() < 500000) {
|
||||
for (int i=0; i<30; i++) {
|
||||
addPoint(ofGetWidth()/2, ofGetHeight()/2);
|
||||
if(points.size() < 500000 || ofGetFrameRate() > 30){
|
||||
for(int i = 0; i < 300; i++){
|
||||
addPoint(ofGetWidth() / 2, ofGetHeight() / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// move all the points around
|
||||
for (unsigned int i=0; i<points.size(); i++) {
|
||||
|
||||
for(unsigned int i = 0; i < points.size(); i++){
|
||||
|
||||
speeds[i].y += 0.04; // some grav
|
||||
points[i] += speeds[i];
|
||||
speeds[i] *= 0.98;
|
||||
|
||||
points[i] += speeds[i];
|
||||
speeds[i] *= 0.98;
|
||||
|
||||
// move from the mouse
|
||||
glm::vec2 mouseVec = glm::vec2(ofGetMouseX(), ofGetMouseY()) - points[i];
|
||||
if(glm::length(mouseVec) < 100) {
|
||||
if(glm::length(mouseVec) < 100){
|
||||
mouseVec = glm::normalize(mouseVec);
|
||||
speeds[i] -= mouseVec;
|
||||
}
|
||||
|
||||
|
||||
// wrap the screenhttps://profiler.firefox.com/from-file/calltree/?v=4
|
||||
if(points[i].x > ofGetWidth()) points[i].x = 1;
|
||||
if(points[i].x < 0) points[i].x = ofGetWidth()-1;
|
||||
if(points[i].y > ofGetHeight()) points[i].y = 1;
|
||||
if(points[i].y < 0) points[i].y = ofGetHeight()-1;
|
||||
if(points[i].x > ofGetWidth()){
|
||||
points[i].x = 1;
|
||||
}
|
||||
if(points[i].x < 0){
|
||||
points[i].x = ofGetWidth() - 1;
|
||||
}
|
||||
if(points[i].y > ofGetHeight()){
|
||||
points[i].y = 1;
|
||||
}
|
||||
if(points[i].y < 0){
|
||||
points[i].y = ofGetHeight() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::draw() {
|
||||
void ofApp::draw(){
|
||||
OFX_PROFILER_FUNCTION();
|
||||
|
||||
// draw the points the slow way
|
||||
if(mode == 1) {
|
||||
if(mode == 1){
|
||||
OFX_PROFILER_SCOPE("mode 1");
|
||||
#ifdef TARGET_OPENGLES
|
||||
ofSetColor(255);
|
||||
ofDrawBitmapString("OpenGL immediate mode not available in OpenGL ES. Press 2 or 3.",ofGetWidth() / 2.0f - 300,ofGetHeight() / 2.0f);
|
||||
#else
|
||||
ofSetColor(255);
|
||||
glBegin(GL_POINTS);
|
||||
for (unsigned int i=0; i<points.size(); i++) {
|
||||
glVertex2f(points[i].x, points[i].y);
|
||||
}
|
||||
glEnd();
|
||||
ofSetColor(255);
|
||||
ofDrawBitmapString("OpenGL immediate mode not available in OpenGL ES. Press 2 or 3.", ofGetWidth() / 2.0f - 300, ofGetHeight() / 2.0f);
|
||||
#else
|
||||
ofSetColor(255);
|
||||
glBegin(GL_POINTS);
|
||||
for(unsigned int i = 0; i < points.size(); i++){
|
||||
glVertex2f(points[i].x, points[i].y);
|
||||
}
|
||||
glEnd();
|
||||
#endif
|
||||
}
|
||||
|
||||
// a bit faster
|
||||
else if(mode == 2) {
|
||||
else if(mode == 2){
|
||||
OFX_PROFILER_SCOPE("mode 2");
|
||||
ofSetColor(255);
|
||||
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 0, &points[0].x);
|
||||
glDrawArrays(GL_POINTS, 0, (int)points.size());
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
}
|
||||
|
||||
// super fast (vbo)
|
||||
else if(mode == 3) {
|
||||
else if(mode == 3){
|
||||
OFX_PROFILER_SCOPE("mode 3");
|
||||
ofSetColor(255);
|
||||
vbo.setVertexData(&points[0], (int)points.size(), GL_DYNAMIC_DRAW);
|
||||
vbo.draw(GL_POINTS, 0, (int)points.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ofSetColor(0);
|
||||
ofDrawRectangle(0, 0, 250, 90);
|
||||
ofSetColor(255);
|
||||
ofDrawBitmapString("Mode "+ofToString(mode), 20, 20);
|
||||
ofDrawBitmapString("FPS "+ofToString(ofGetFrameRate(), 0), 20, 40);
|
||||
ofDrawBitmapString("Total Points "+ofToString((int)points.size()), 20, 60);
|
||||
|
||||
ofDrawBitmapString("Mode " + ofToString(mode), 20, 20);
|
||||
ofDrawBitmapString("FPS " + ofToString(ofGetFrameRate(), 0), 20, 40);
|
||||
ofDrawBitmapString("Total Points " + ofToString((int)points.size()), 20, 60);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::exit() {
|
||||
void ofApp::exit(){
|
||||
OFX_PROFILER_END_SESSION();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::keyPressed(int key) {
|
||||
|
||||
if(key == '1') mode = 1;
|
||||
if(key == '2') mode = 2;
|
||||
if(key == '3') mode = 3;
|
||||
|
||||
|
||||
void ofApp::keyPressed(int key){
|
||||
|
||||
if(key == '1'){
|
||||
mode = 1;
|
||||
}
|
||||
if(key == '2'){
|
||||
mode = 2;
|
||||
}
|
||||
if(key == '3'){
|
||||
mode = 3;
|
||||
}
|
||||
|
||||
|
||||
// clear all the points
|
||||
if(key == 'c') {
|
||||
if(key == 'c'){
|
||||
points.clear();
|
||||
speeds.clear();
|
||||
}
|
||||
|
||||
|
||||
// add crazy amount
|
||||
if(key == 'z') {
|
||||
for (int i=0; i<400000; i++) {
|
||||
if(key == 'z'){
|
||||
for(int i = 0; i < 400000; i++){
|
||||
addPoint(ofRandomWidth(), ofRandomHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::keyReleased(int key){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseMoved(int x, int y ){
|
||||
|
||||
void ofApp::mouseMoved(int x, int y){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseDragged(int x, int y, int button){
|
||||
// add a bunch as you drag
|
||||
for (int i=0; i<400; i++) {
|
||||
for(int i = 0; i < 400; i++){
|
||||
addPoint(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mousePressed(int x, int y, int button){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseReleased(int x, int y, int button){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
@ -168,15 +181,15 @@ void ofApp::mouseExited(int x, int y){
|
|||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::windowResized(int w, int h){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::gotMessage(ofMessage msg){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::dragEvent(ofDragInfo dragInfo){
|
||||
|
||||
void ofApp::dragEvent(ofDragInfo dragInfo){
|
||||
|
||||
}
|
||||
|
|
|
@ -1,44 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#define OFX_PROFILER 1
|
||||
|
||||
#include "ofMain.h"
|
||||
#include "ofxProfiler.h"
|
||||
|
||||
class ofApp : public ofBaseApp{
|
||||
|
||||
public:
|
||||
void setup();
|
||||
void update();
|
||||
void draw();
|
||||
void exit();
|
||||
class ofApp : public ofBaseApp {
|
||||
|
||||
public:
|
||||
void setup();
|
||||
void update();
|
||||
void draw();
|
||||
void exit();
|
||||
|
||||
void keyPressed(int key);
|
||||
void keyReleased(int key);
|
||||
void mouseMoved(int x, int y);
|
||||
void mouseDragged(int x, int y, int button);
|
||||
void mousePressed(int x, int y, int button);
|
||||
void mouseReleased(int x, int y, int button);
|
||||
void mouseEntered(int x, int y);
|
||||
void mouseExited(int x, int y);
|
||||
void windowResized(int w, int h);
|
||||
void dragEvent(ofDragInfo dragInfo);
|
||||
void gotMessage(ofMessage msg);
|
||||
|
||||
void addPoint(float x, float y){
|
||||
points.push_back(glm::vec2(x, y));
|
||||
speeds.push_back(glm::vec2(ofRandom(-1, 1), ofRandom(-1, 1)));
|
||||
}
|
||||
|
||||
// a simple vector of points
|
||||
vector <glm::vec2> points;
|
||||
vector <glm::vec2> speeds;
|
||||
|
||||
// in super fast mode we use a vbo
|
||||
ofVbo vbo;
|
||||
|
||||
// mode switcher
|
||||
int mode;
|
||||
|
||||
|
||||
void keyPressed (int key);
|
||||
void keyReleased(int key);
|
||||
void mouseMoved(int x, int y );
|
||||
void mouseDragged(int x, int y, int button);
|
||||
void mousePressed(int x, int y, int button);
|
||||
void mouseReleased(int x, int y, int button);
|
||||
void mouseEntered(int x, int y);
|
||||
void mouseExited(int x, int y);
|
||||
void windowResized(int w, int h);
|
||||
void dragEvent(ofDragInfo dragInfo);
|
||||
void gotMessage(ofMessage msg);
|
||||
|
||||
void addPoint(float x, float y) {
|
||||
points.push_back(glm::vec2(x, y));
|
||||
speeds.push_back(glm::vec2(ofRandom(-1, 1), ofRandom(-1, 1)));
|
||||
}
|
||||
|
||||
// a simple vector of points
|
||||
vector <glm::vec2> points;
|
||||
vector <glm::vec2> speeds;
|
||||
|
||||
// in super fast mode we use a vbo
|
||||
ofVbo vbo;
|
||||
|
||||
// mode switcher
|
||||
int mode;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -27,12 +27,12 @@ struct InstrumentationSession {
|
|||
};
|
||||
|
||||
class Instrumentor {
|
||||
private:
|
||||
private:
|
||||
mutex m_Mutex;
|
||||
InstrumentationSession * m_CurrentSession;
|
||||
ofstream m_OutputStream;
|
||||
public:
|
||||
Instrumentor()
|
||||
public:
|
||||
Instrumentor()
|
||||
: m_CurrentSession(nullptr){
|
||||
}
|
||||
|
||||
|
@ -59,12 +59,12 @@ class Instrumentor {
|
|||
ofLog(OF_LOG_ERROR, "Instrumentor could not open results file '%s'.", filepath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EndSession(){
|
||||
lock_guard <mutex> lock(m_Mutex);
|
||||
InternalEndSession();
|
||||
}
|
||||
InternalEndSession();
|
||||
}
|
||||
|
||||
void WriteProfile(const ProfileResult & result){
|
||||
stringstream json;
|
||||
|
@ -73,62 +73,62 @@ class Instrumentor {
|
|||
replace(name.begin(), name.end(), '"', '\'');
|
||||
|
||||
json << setprecision(3) << fixed;
|
||||
json << ",{";
|
||||
json << "\"cat\":\"function\",";
|
||||
json << ",{";
|
||||
json << "\"cat\":\"function\",";
|
||||
json << "\"dur\":" << (result.ElapsedTime.count()) << ',';
|
||||
json << "\"name\":\"" << name << "\",";
|
||||
json << "\"ph\":\"X\",";
|
||||
json << "\"name\":\"" << name << "\",";
|
||||
json << "\"ph\":\"X\",";
|
||||
json << "\"pid\":0,";
|
||||
json << "\"tid\":" << result.ThreadID << ",";
|
||||
json << "\"ts\":" << result.Start.count();
|
||||
json << "}";
|
||||
json << "\"tid\":" << result.ThreadID << ",";
|
||||
json << "\"ts\":" << result.Start.count();
|
||||
json << "}";
|
||||
|
||||
lock_guard <mutex> lock(m_Mutex);
|
||||
if(m_CurrentSession){
|
||||
m_OutputStream << json.str();
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
}
|
||||
m_OutputStream << json.str();
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
}
|
||||
|
||||
static Instrumentor & Get(){
|
||||
static Instrumentor instance;
|
||||
return instance;
|
||||
}
|
||||
static Instrumentor instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void WriteHeader(){
|
||||
m_OutputStream << "{\"otherData\": {},\"traceEvents\":[{}";
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
m_OutputStream << "{\"otherData\": {},\"traceEvents\":[{}";
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
|
||||
void WriteFooter(){
|
||||
m_OutputStream << "]}";
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
m_OutputStream << "]}";
|
||||
m_OutputStream.flush();
|
||||
}
|
||||
|
||||
// Note: you must already own lock on m_Mutex before
|
||||
// calling InternalEndSession()
|
||||
// Note: you must already own lock on m_Mutex before
|
||||
// calling InternalEndSession()
|
||||
void InternalEndSession(){
|
||||
if(m_CurrentSession){
|
||||
WriteFooter();
|
||||
m_OutputStream.close();
|
||||
delete m_CurrentSession;
|
||||
m_CurrentSession = nullptr;
|
||||
}
|
||||
}
|
||||
WriteFooter();
|
||||
m_OutputStream.close();
|
||||
delete m_CurrentSession;
|
||||
m_CurrentSession = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class InstrumentationTimer {
|
||||
public:
|
||||
public:
|
||||
InstrumentationTimer(const char * name)
|
||||
: m_Name(name), m_Stopped(false){
|
||||
m_StartTimepoint = chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
|
||||
~InstrumentationTimer(){
|
||||
if(!m_Stopped){
|
||||
Stop();
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,16 +139,15 @@ class InstrumentationTimer {
|
|||
|
||||
Instrumentor::Get().WriteProfile({m_Name, highResStart, elapsedTime, this_thread::get_id()});
|
||||
|
||||
m_Stopped = true;
|
||||
}
|
||||
private:
|
||||
m_Stopped = true;
|
||||
}
|
||||
private:
|
||||
const char * m_Name;
|
||||
chrono::time_point <chrono::steady_clock> m_StartTimepoint;
|
||||
bool m_Stopped;
|
||||
bool m_Stopped;
|
||||
};
|
||||
}
|
||||
|
||||
#define OFX_PROFILER 1
|
||||
// Resolve which function signature macro will HZ_PROFILE_BEGIN_SESSIONbe used. Note that this only
|
||||
// is resolved when the (pre)compiler starts, so the syntax highlighting
|
||||
// could mark the wrong one in your editor!
|
||||
|
|
Loading…
Reference in a new issue