You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
775 B
C++
31 lines
775 B
C++
#ifndef GODOT_HUB_MAP_TIME_H
|
|
#define GODOT_HUB_MAP_TIME_H
|
|
|
|
#include <string_view>
|
|
#include <map>
|
|
#include <chrono>
|
|
|
|
|
|
namespace cb::time {
|
|
using internal_clock = std::chrono::high_resolution_clock;
|
|
using time_point = std::chrono::time_point<internal_clock>;
|
|
using time_point_map = std::map<const std::string_view, time_point>;
|
|
|
|
inline static time_point_map _name_to_measurement;
|
|
inline static constexpr long long NO_MEASUREMENT = -1;
|
|
|
|
time_point chrono_now();
|
|
|
|
void start_measure(const std::string_view& id);
|
|
|
|
long long get_duration(const std::string_view &id);
|
|
|
|
void measure(const std::string_view& id);
|
|
|
|
bool has_measurement(const std::string_view &id);
|
|
|
|
const time_point_map& get_measurements();
|
|
}
|
|
|
|
#endif //GODOT_HUB_MAP_TIME_H
|