Hymn to Beauty
C++ 3D Engine
Event.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <list>
5#include <json/json.h>
6
7namespace Profiling {
8
10class Event {
11 public:
13
16 explicit Event(const std::string& name);
17
19
22 Json::Value ToJson() const;
23
25
28 void FromJson(const Json::Value& value);
29
31 std::string name;
32
34 double time;
35
37 double duration;
38
40 std::list<Event> children;
41
43 Event* parent = nullptr;
44
45 private:
46 void FromJson(const Json::Value& value, Event* parent);
47};
48
49}
A profiling event on the timeline.
Definition: Event.hpp:10
double duration
The duration of the event.
Definition: Event.hpp:37
void FromJson(const Json::Value &value)
Load event from json value.
Definition: Event.cpp:26
double time
The time the event occured.
Definition: Event.hpp:34
Event(const std::string &name)
Create new event.
Definition: Event.cpp:5
Event * parent
Parent event.
Definition: Event.hpp:43
std::list< Event > children
Child events.
Definition: Event.hpp:40
std::string name
The name of the event.
Definition: Event.hpp:31
Json::Value ToJson() const
Save event to json value.
Definition: Event.cpp:9
Definition: Event.cpp:3