3#ifndef poplar_Profile_hpp
4#define poplar_Profile_hpp
6#include <poplar/OptionFlags.hpp>
7#include <poplar/StringRef.hpp>
19class MutableProfileValue;
50 using Number = double;
51 using String = std::string;
52 using Vector = std::vector<ProfileValue>;
53 using Map = std::map<std::string, ProfileValue>;
56 std::aligned_union<1, Boolean, Number, String, Vector, Map>::type buffer;
63 const String &asString()
const;
66 Boolean asBool()
const;
68 std::int64_t asInt()
const;
71 std::uint64_t asUint()
const;
72 double asDouble()
const;
79 const Map &asMap()
const;
83 const Vector &asVector()
const;
87 std::vector<std::uint64_t> toUintVector()
const;
90 std::size_t size()
const;
94 double sumDouble()
const;
95 std::int64_t sumInt()
const;
96 std::uint64_t sumUint()
const;
100 std::int64_t sum2DInt()
const;
101 std::uint64_t sum2DUint()
const;
118 template <
class T,
typename =
typename std::enable_if<
119 std::is_integral<T>::value>::type>
140 template <
class T,
typename =
typename std::enable_if<
141 std::is_integral<T>::value>::type>
143 return operator=(ProfileValue::Number(init));
147 friend class core::MutableProfileValue;
155void serializeToJSON(std::ostream &out,
const ProfileValue &val,
156 bool prettyPrint =
false);
158void serializeToCBOR(std::ostream &out,
const ProfileValue &val,
159 bool withTag =
true);
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
ProfileValue represents a read-only JSON-like tree of values that are used to store the output of the...
Definition: ProfileValue.hpp:39
Poplar classes and functions.
Definition: ArrayRef.hpp:14
std::ostream & operator<<(std::ostream &os, const DebugNameAndId &dnai)
Display the path name of the DebugNameAndId.
void printGraphSummary(std::ostream &out, const std::string &databasePath, const OptionFlags &opts)
Print a summary of the static graph profiling information - primarily memory use.
void printExecutionSummary(std::ostream &out, const std::string &databasePath, const OptionFlags &opts)
Print a summary of the execution profiling information - primarily cycle counts.
void printProfileSummary(std::ostream &out, const std::string &databasePath, const OptionFlags &opts={})
Equivalent to calling printGraphSummary() followed by printExecutionSummary().