MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / timer

Class timer

src/svgfill/src/arrange_polygons.cpp:2898–2936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2896}
2897
2898class timer {
2899 public:
2900 class entry {
2901 public:
2902 entry() {}
2903
2904 entry(std::map<std::string, std::chrono::high_resolution_clock::time_point>::const_iterator start_it)
2905 : start_it(start_it) {}
2906
2907 void stop() {
2908 if (start_it) {
2909 auto end = std::chrono::high_resolution_clock::now();
2910 auto duration = std::chrono::duration<double, std::milli>(end - start_it.value()->second).count();
2911 std::cerr << "Timing for " << start_it.value()->first << ": " << duration << " ms" << std::endl;
2912 }
2913 }
2914
2915 private:
2916 std::optional<std::map<std::string, std::chrono::high_resolution_clock::time_point>::const_iterator> start_it;
2917 };
2918
2919 timer(bool enabled = true) : enabled_(enabled) {}
2920
2921 entry start(const std::string& name) {
2922 if (enabled_) {
2923 return entry(timings_.insert({name, std::chrono::high_resolution_clock::now()}).first);
2924 } else {
2925 return entry();
2926 }
2927 }
2928
2929 private:
2930 std::map<
2931 std::string,
2932 std::chrono::high_resolution_clock::time_point>
2933 timings_;
2934
2935 bool enabled_;
2936};
2937
2938void arrange_cgal_polygons(svgfill::arrange_polygon_settings settings, const std::vector<Polygon_2>& input_polygons_, std::vector<Polygon_2>& output_polygons, double polygon_offset_distance = -1.) {
2939 static const double OVERLAP_RESOLUTION_DISTANCE = 1.e-1;

Callers 6

__enter__Method · 0.85
__exit__Method · 0.85
__init__Method · 0.85
logMethod · 0.85
__enter__Method · 0.85
__exit__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected