Avara3D 0.2.0
C++ API reference
Profile.h
1//
2// Profiling.h
3// avara3d
4//
5// Created by Morgan Davis on 12/25/25.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_PROFILE_PROFILE_H
10#define AVARA3D_PROFILE_PROFILE_H
11
12#include <functional>
13#include <type_traits>
14#include <utility>
15
16#include "a3d/profile/Profile.h"
17#include "a3d/profile/ScopeTimer.h"
18
19namespace a3d::prof {
20
21 // run f() while measuring its duration into `profiler` under `tag`
22 // supports nesting!
23 template<class F>
24 decltype(auto) profile(Profiler& profiler, Profiler::Tag tag, F&& f) {
25 ScopeTimer t {profiler, tag};
26 return std::invoke(std::forward<F>(f));
27 }
28
29}
30
31#endif // AVARA3D_PROFILE_PROFILE_H