Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandonki/small_profiler
Simple inline C++ profiling.
https://github.com/brandonki/small_profiler
chrome profiler
Last synced: 3 days ago
JSON representation
Simple inline C++ profiling.
- Host: GitHub
- URL: https://github.com/brandonki/small_profiler
- Owner: BrandonKi
- License: mit
- Created: 2021-03-28T02:56:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T23:52:58.000Z (7 months ago)
- Last Synced: 2024-04-25T00:54:11.749Z (7 months ago)
- Topics: chrome, profiler
- Language: C++
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TODO reduce overhead of profiling a function
this is especially noticeable for small functions# small_profiler
Simple header-only inline C++ profiling. Outputs a json that can be used with chrome://tracing as a frontend.Include the header then put `PROFILE()` at the begining of any function you wish to profile.
## Example
```cpp
#include "small_profiler.h"int main(int, char**) {
PROFILE();
}
```
You can also profile arbitrary scopes as long as you give them a custom name
```cpp
#include "small_profiler.h"int main(int, char**) {
PROFILE();
{
PROFILE("WHILE_LOOP");
int i = 100000;
while(i --> 0) {}
}
}
```To view the graph go to chrome://tracing click 'load' and select the generated json file.
To turn off profiling define the macro `NO_PROFILE` before including the header file.
To change the name/path of the output file define the 'PROFILE_OUTPUT_FILE' macro and set it to a string