ofxProfiler/README.md

57 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2020-05-17 11:09:47 +02:00
ofxProfile
================
2020-05-21 13:14:14 +02:00
![thumbnail](ofxaddons_thumbnail.png)
2020-05-17 11:09:47 +02:00
OpenFrameworks addon for simple and quick thread safe profiling.
Then throw the result in chrome://tracing
This addon is practically cut and paste from https://github.com/TheCherno/Hazel/blob/master/Hazel/src/Hazel/Debug/Instrumentor.h
## Usage
add ofxProfiler to your application with projectGenerator (or whatever method you prefer)
ofApp.h
```
// uncommment to profile
// #define OFX_PROFILER 1
#include "ofxProfiler.h"
// ... bla bla bla
```
ofApp.cpp
```
//--------------------------------------------------------------
void ofApp::setup() {
OFX_PROFILER_BEGIN_SESSION("a test","result.json");
OFX_PROFILER_FUNCTION();
} // end of scope => profile function ends
//--------------------------------------------------------------
void ofApp::update() {
OFX_PROFILER_FUNCTION();
{
OFX_PROFILER_SCOPE("scope 1");
}
{
OFX_PROFILER_SCOPE("scope 2");
}
}
//--------------------------------------------------------------
void ofApp::exit() {
OFX_PROFILER_END_SESSION();
}
```
2020-05-17 11:16:01 +02:00
when closing the application, you will find a result.json next to the binary
open that with chrome://tracing