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~5 BaseProfiler%accumulate proc~test_accumulate_nested->none~accumulate~5 none~finalize~14 BaseProfiler%finalize proc~test_accumulate_nested->none~finalize~14 none~get_num_meters BaseProfiler%get_num_meters proc~test_accumulate_nested->none~get_num_meters none~get_root_node BaseProfiler%get_root_node proc~test_accumulate_nested->none~get_root_node none~start~83 TimeProfiler%start proc~test_accumulate_nested->none~start~83 none~accumulate~5->none~get_root_node accumulate accumulate none~accumulate~5->accumulate none~back~42 MeterNodeStack%back none~accumulate~5->none~back~42 none~finalize~3 AbstractMeter%finalize none~finalize~14->none~finalize~3 none~get_meter MeterNode%get_meter none~finalize~14->none~get_meter none~pop_back~41 MeterNodeStack%pop_back none~finalize~14->none~pop_back~41 none~get_num_nodes MeterNode%get_num_nodes none~get_num_meters->none~get_num_nodes none~start_self BaseProfiler%start_self none~start~83->none~start_self mpi_op_free mpi_op_free none~finalize~3->mpi_op_free mpi_type_free mpi_type_free none~finalize~3->mpi_type_free proc~mapl_verify MAPL_Verify none~finalize~3->proc~mapl_verify get_num_nodes get_num_nodes none~get_num_nodes->get_num_nodes none~begin~103 MeterNodeVector%begin none~get_num_nodes->none~begin~103 none~get~202 MeterNodeVectorIterator%get none~get_num_nodes->none~get~202 none~next~108 MeterNodeVectorIterator%next none~get_num_nodes->none~next~108 interface~mapl_assert MAPL_Assert none~start_self->interface~mapl_assert none~get_name~5 MeterNode%get_name none~start_self->none~get_name~5 none~start~47 BaseProfiler%start none~start_self->none~start~47 proc~mapl_return MAPL_Return none~start_self->proc~mapl_return

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