2022-12-23 13:50:27 -05:00
|
|
|
/*
|
|
|
|
* Created by Brett on 23/12/22.
|
|
|
|
* Licensed under GNU General Public License V3.0
|
|
|
|
* See LICENSE file for license detail
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BLT_PROFILER_H
|
|
|
|
#define BLT_PROFILER_H
|
|
|
|
|
2022-12-25 23:19:44 -05:00
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
2022-12-27 00:51:37 -05:00
|
|
|
#include <blt/config.h>
|
|
|
|
|
|
|
|
#ifdef PHMAP_ENABLED
|
|
|
|
#include <parallel_hashmap/phmap.h>
|
|
|
|
#else
|
|
|
|
#include <unordered_map>
|
|
|
|
#endif
|
2022-12-26 23:44:02 -05:00
|
|
|
|
2022-12-23 13:50:27 -05:00
|
|
|
|
2022-12-26 00:31:00 -05:00
|
|
|
namespace BLT {
|
|
|
|
struct CapturePoint {
|
|
|
|
long point;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CaptureInterval {
|
|
|
|
CapturePoint start;
|
|
|
|
CapturePoint end;
|
|
|
|
};
|
2022-12-27 00:51:37 -05:00
|
|
|
#ifdef PHMAP_ENABLED
|
|
|
|
typedef phmap::parallel_flat_hash_map<std::string_view, CaptureInterval> INTERVAL_MAP;
|
|
|
|
typedef phmap::parallel_flat_hash_map<std::string_view, CapturePoint> POINT_MAP;
|
|
|
|
#else
|
|
|
|
typedef std::unordered_map<std::string_view, CaptureInterval> INTERVAL_MAP;
|
|
|
|
typedef std::unordered_map<std::string_view, CapturePoint> POINT_MAP;
|
|
|
|
#endif
|
2022-12-26 00:31:00 -05:00
|
|
|
|
|
|
|
class Profiler {
|
|
|
|
private:
|
2022-12-27 00:51:37 -05:00
|
|
|
INTERVAL_MAP intervals;
|
|
|
|
POINT_MAP points;
|
2022-12-26 23:36:34 -05:00
|
|
|
public:
|
2022-12-27 00:51:37 -05:00
|
|
|
Profiler();
|
2022-12-26 00:31:00 -05:00
|
|
|
};
|
|
|
|
}
|
2022-12-23 13:50:27 -05:00
|
|
|
|
|
|
|
#endif //BLT_PROFILER_H
|