|
FE 0.15.0
A C++23 toolkit for writing compiler/interpreter frontends.
|
Records wall-clock timings for (possibly nested) named Profiler::Spans and reports them in various formats. More...
#include <fe/profile.h>
Classes | |
| struct | Span |
| A single run. More... | |
Public Types | |
| using | Clock = std::chrono::steady_clock |
| using | Duration = Clock::duration |
Public Member Functions | |
Getters | |
| bool | empty () const |
| const auto & | spans () const |
Recording | |
Bracket a run with Profiler::start / Profiler::stop; the calls must nest like a stack. | |
| void | start (std::string_view name) |
| void | stop () |
| Marks the end of the most recently started run; no-op if no Span is running. | |
| void | count (std::string_view key, uint64_t n=1) |
Adds n to counter key of the currently running Span; no-op if no Span is running or n is 0. | |
Reporting | |
| void | summary (std::ostream &) const |
| void | tree (std::ostream &) const |
| Prints the Spans as an indented tree, preserving the order in which they ran. | |
| void | chrome_trace (std::ostream &) const |
| Dumps all Spans as Chrome Trace Event Format JSON. | |
Static Public Attributes | |
| static constexpr size_t | No_Parent = std::numeric_limits<size_t>::max() |
Records wall-clock timings for (possibly nested) named Profiler::Spans and reports them in various formats.
Spans nest like a stack, so each one remembers its parent. From these Spans the Profiler can derive
| using fe::Profiler::Clock = std::chrono::steady_clock |
| using fe::Profiler::Duration = Clock::duration |
| void fe::Profiler::chrome_trace | ( | std::ostream & | ) | const |
Dumps all Spans as Chrome Trace Event Format JSON.
| void fe::Profiler::count | ( | std::string_view | key, |
| uint64_t | n = 1 ) |
| void fe::Profiler::start | ( | std::string_view | name | ) |
Marks the start of a run named name.
| void fe::Profiler::stop | ( | ) |
Marks the end of the most recently started run; no-op if no Span is running.
| void fe::Profiler::summary | ( | std::ostream & | ) | const |
Prints a flat table aggregated by name, sorted by total time, descending.
| void fe::Profiler::tree | ( | std::ostream & | ) | const |
Prints the Spans as an indented tree, preserving the order in which they ran.
|
staticconstexpr |