LCOV - code coverage report
Current view: top level - elsa/storage/memory_resource - AllocationHint.cpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 13 13 100.0 %
Date: 2024-05-16 04:22:26 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include "AllocationHint.h"
       2             : 
       3             : #include "PoolResource.h"
       4             : #include "CacheResource.h"
       5             : #include "RegionResource.h"
       6             : 
       7             : #include <variant>
       8             : #include <limits>
       9             : 
      10             : namespace elsa::mr::hint
      11             : {
      12             :     thread_local std::optional<MemoryResource> HINT;
      13             : 
      14             :     ScopedMR::ScopedMR(const MemoryResource& hint)
      15           3 :     {
      16           3 :         _previous = std::move(HINT);
      17           3 :         HINT = hint;
      18           3 :     }
      19             : 
      20             :     ScopedMR::~ScopedMR()
      21           3 :     {
      22           3 :         HINT = std::move(_previous);
      23           3 :     }
      24             : 
      25             :     std::optional<MemoryResource> selectMemoryResource()
      26       58515 :     {
      27       58515 :         if (!HINT) {
      28       58509 :             return std::nullopt;
      29       58509 :         }
      30           6 :         return *HINT;
      31           6 :     }
      32             : } // namespace elsa::mr::hint

Generated by: LCOV version 1.14