Typedefs for maps
parent
c0955f0762
commit
7cf07bb5c0
|
@ -18,6 +18,15 @@ else()
|
||||||
set(PROFILING_FILES "")
|
set(PROFILING_FILES "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap/CMakeLists.txt)
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap/)
|
||||||
|
set(PHMAP_ENABLED ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file(include/blt/config.h.in blt/config.h @ONLY)
|
||||||
|
# include the config file
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
include_directories(include/)
|
include_directories(include/)
|
||||||
|
|
||||||
message("Standard Files ${STD_FILES}")
|
message("Standard Files ${STD_FILES}")
|
||||||
|
@ -27,3 +36,4 @@ message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
add_library(BLT ${STD_FILES} ${PROFILING_FILES})
|
add_library(BLT ${STD_FILES} ${PROFILING_FILES})
|
||||||
target_include_directories(BLT PUBLIC include/)
|
target_include_directories(BLT PUBLIC include/)
|
||||||
|
target_link_libraries(BLT phmap)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* Created by Brett on 27/12/22.
|
||||||
|
* Licensed under GNU General Public License V3.0
|
||||||
|
* See LICENSE file for license detail
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CMAKE_CONFIG
|
||||||
|
|
||||||
|
#cmakedefine PHMAP_ENABLED
|
||||||
|
|
||||||
|
#define CMAKE_CONFIG
|
||||||
|
#endif
|
|
@ -9,7 +9,13 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <blt/config.h>
|
||||||
|
|
||||||
|
#ifdef PHMAP_ENABLED
|
||||||
|
#include <parallel_hashmap/phmap.h>
|
||||||
|
#else
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace BLT {
|
namespace BLT {
|
||||||
|
@ -21,15 +27,20 @@ namespace BLT {
|
||||||
CapturePoint start;
|
CapturePoint start;
|
||||||
CapturePoint end;
|
CapturePoint end;
|
||||||
};
|
};
|
||||||
|
#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
|
||||||
|
|
||||||
class Profiler {
|
class Profiler {
|
||||||
private:
|
private:
|
||||||
std::map<std::string_view, CaptureInterval>* intervals;
|
INTERVAL_MAP intervals;
|
||||||
std::map<std::string_view, CapturePoint>* points;
|
POINT_MAP points;
|
||||||
public:
|
public:
|
||||||
Profiler(std::map<std::string_view, CaptureInterval>* test) {
|
Profiler();
|
||||||
intervals = test;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue