test_accumulate_nested Subroutine

public subroutine test_accumulate_nested()

Arguments

None

Calls

proc~~test_accumulate_nested~~CallsGraph proc~test_accumulate_nested test_accumulate_nested assertequal assertequal proc~test_accumulate_nested->assertequal asserttrue asserttrue proc~test_accumulate_nested->asserttrue get_child get_child proc~test_accumulate_nested->get_child get_meter get_meter proc~test_accumulate_nested->get_meter get_num_cycles get_num_cycles proc~test_accumulate_nested->get_num_cycles has_child has_child proc~test_accumulate_nested->has_child none~accumulate~4 BaseProfiler%accumulate proc~test_accumulate_nested->none~accumulate~4 none~finalize~7 BaseProfiler%finalize proc~test_accumulate_nested->none~finalize~7 none~get_num_meters~2 BaseProfiler%get_num_meters proc~test_accumulate_nested->none~get_num_meters~2 none~get_root_node~2 BaseProfiler%get_root_node proc~test_accumulate_nested->none~get_root_node~2 none~start~82 TimeProfiler%start proc~test_accumulate_nested->none~start~82 none~accumulate~4->none~get_root_node~2 accumulate accumulate none~accumulate~4->accumulate none~back~18 MeterNodeStack%back none~accumulate~4->none~back~18 none~finalize~5 AbstractMeter%finalize none~finalize~7->none~finalize~5 none~get_meter MeterNode%get_meter none~finalize~7->none~get_meter none~pop_back~18 MeterNodeStack%pop_back none~finalize~7->none~pop_back~18 none~get_num_nodes MeterNode%get_num_nodes none~get_num_meters~2->none~get_num_nodes none~start_self StubProfiler%start_self none~start~82->none~start_self mpi_op_free mpi_op_free none~finalize~5->mpi_op_free mpi_type_free mpi_type_free none~finalize~5->mpi_type_free proc~mapl_verify MAPL_Verify none~finalize~5->proc~mapl_verify get_num_nodes get_num_nodes none~get_num_nodes->get_num_nodes none~begin~283 MeterNodeVector%begin none~get_num_nodes->none~begin~283 none~get~189 MeterNodeVectorIterator%get none~get_num_nodes->none~get~189 none~next~174 MeterNodeVectorIterator%next none~get_num_nodes->none~next~174 proc~mapl_return MAPL_Return none~start_self->proc~mapl_return at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine test_accumulate_nested()
      type(TimeProfiler), target :: main, lap
      class(AbstractMeterNode), pointer :: main_node
      class(AbstractMeterNode), pointer :: child
      class(AbstractMeter), pointer :: t

      main = TimeProfiler('main')
      call main%start()
      lap = TimeProfiler('lap')
      call lap%start()
      call lap%start('A')
      call lap%stop('A')
      call lap%finalize()
      call main%accumulate(lap)

      ! should now have 'lap' as a subtimer of 'main'
      @assertEqual(3, main%get_num_meters())

      main_node => main%get_root_node()
      @assertTrue(main_node%has_child('lap'))

      child => main_node%get_child('lap')
      t => child%get_meter()
      select type (t)
      class is (AdvancedMeter)
         @assertEqual(1, t%get_num_cycles())
      end select

      @assertTrue(child%has_child('A'))
      child => child%get_child('A')
      t => child%get_meter()
      select type (t)
      class is (AdvancedMeter)
         @assertEqual(1, t%get_num_cycles())
      end select

   end subroutine test_accumulate_nested