LCOV - code coverage report
Current view: top level - artdaq/ArtModules - ArtdaqGlobalsService_service.cc (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 27 0
Test Date: 2025-09-04 00:45:34 Functions: 0.0 % 12 0

            Line data    Source code
       1              : #define TRACE_NAME "ArtdaqGlobalsService"
       2              : 
       3              : #include <cstdint>
       4              : #include <memory>
       5              : 
       6              : #include "art/Framework/Services/Registry/ServiceHandle.h"
       7              : #include "artdaq-core/Utilities/ExceptionHandler.hh"
       8              : #include "artdaq/ArtModules/ArtdaqGlobalsService.h"
       9              : 
      10              : #include "artdaq/DAQdata/Globals.hh"
      11              : 
      12              : #define build_key(seed) ((seed) + ((GetPartitionNumber() + 1) << 16) + (getppid() & 0xFFFF))
      13              : 
      14              : static fhicl::ParameterSet empty_pset;
      15              : 
      16            0 : ArtdaqGlobalsService::ArtdaqGlobalsService(fhicl::ParameterSet const& pset, art::ActivityRegistry& /*unused*/)
      17              : {
      18            0 :         TLOG(TLVL_DEBUG + 33) << "ArtdaqGlobalsService CONSTRUCTOR";
      19              : 
      20            0 :         char const* artapp_env = getenv("ARTDAQ_APPLICATION_NAME");
      21            0 :         std::string artapp_str = "art";
      22            0 :         if (artapp_env != nullptr)
      23              :         {
      24            0 :                 artapp_str = std::string(artapp_env) + "_art";
      25              :         }
      26              : 
      27            0 :         TLOG(TLVL_DEBUG + 33) << "Setting app_name to " << artapp_str;
      28            0 :         app_name = artapp_str;
      29              : 
      30            0 :         artapp_env = getenv("ARTDAQ_RANK");
      31            0 :         if (artapp_env != nullptr && my_rank < 0)
      32              :         {
      33            0 :                 TLOG(TLVL_DEBUG + 33) << "Setting rank from envrionment";
      34            0 :                 my_rank = strtol(artapp_env, nullptr, 10);
      35            0 :         }
      36              :         else
      37              :         {
      38            0 :                 TLOG(TLVL_DEBUG + 33) << "Setting default rank";
      39            0 :                 my_rank = -1;
      40              :         }
      41              : 
      42              :         try
      43              :         {
      44            0 :                 if (metricMan)
      45              :                 {
      46            0 :                         metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), app_name);
      47            0 :                         metricMan->do_start();
      48              :                 }
      49              :         }
      50            0 :         catch (...)
      51              :         {
      52            0 :                 artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in ArtdaqGlobalsService()");
      53            0 :         }
      54              : 
      55            0 :         TLOG(TLVL_INFO) << "app_name is " << app_name << ", rank " << my_rank;
      56            0 : }
      57              : 
      58            0 : ArtdaqGlobalsService::~ArtdaqGlobalsService()
      59              : {
      60            0 :         artdaq::Globals::CleanUpGlobals();
      61            0 : }
      62              : 
      63            0 : DEFINE_ART_SERVICE_INTERFACE_IMPL(ArtdaqGlobalsService, ArtdaqSharedMemoryServiceInterface)
        

Generated by: LCOV version 2.0-1