test_simple_report_timer Subroutine

public subroutine test_simple_report_timer()

Arguments

None

Calls

proc~~test_simple_report_timer~~CallsGraph proc~test_simple_report_timer test_simple_report_timer assertequal assertequal proc~test_simple_report_timer->assertequal none~add_column MultiColumn%add_column proc~test_simple_report_timer->none~add_column none~finalize~3 BaseProfiler%finalize proc~test_simple_report_timer->none~finalize~3 none~generate_report ProfileReporter%generate_report proc~test_simple_report_timer->none~generate_report none~start~84 TimeProfiler%start proc~test_simple_report_timer->none~start~84 get_num_rows_header get_num_rows_header none~add_column->get_num_rows_header none~get_num_rows_separator TextColumn%get_num_rows_separator none~add_column->none~get_num_rows_separator none~get_width TextColumn%get_width none~add_column->none~get_width none~push_back~10 TextColumnVector%push_back none~add_column->none~push_back~10 none~set_width TextColumn%set_width none~add_column->none~set_width none~finalize~15 AbstractMeter%finalize none~finalize~3->none~finalize~15 none~get_meter~4 MeterNode%get_meter none~finalize~3->none~get_meter~4 none~pop_back~6 MeterNodeStack%pop_back none~finalize~3->none~pop_back~6 none~generate_report_profiler ProfileReporter%generate_report_profiler none~generate_report->none~generate_report_profiler none~start_self~2 StubProfiler%start_self none~start~84->none~start_self~2 mpi_op_free mpi_op_free none~finalize~15->mpi_op_free mpi_type_free mpi_type_free none~finalize~15->mpi_type_free proc~mapl_verify MAPL_Verify none~finalize~15->proc~mapl_verify none~generate_report_profiler->none~get_width none~get_header~6 MultiColumn%get_header none~generate_report_profiler->none~get_header~6 none~get_root_node BaseProfiler%get_root_node none~generate_report_profiler->none~get_root_node none~get_rows~8 MultiColumn%get_rows none~generate_report_profiler->none~get_rows~8 none~capacity~55 TextColumnVector%capacity none~push_back~10->none~capacity~55 none~resize~20 TextColumnVector%resize none~push_back~10->none~resize~20 proc~mapl_return MAPL_Return none~start_self~2->proc~mapl_return

Source Code

   subroutine test_simple_report_timer()
      type (TimeProfiler), target :: prof
      type (ProfileReporter), target :: reporter

      character(:), allocatable :: report_lines(:)

      prof = TimeProfiler('top')   ! timer 1
      call prof%start()
      call prof%start('timer_1') ! 2
      call prof%start('timer_1a')! 3
      call prof%stop('timer_1a')
      call prof%start('timer_1b') ! 4
      call prof%start('timer_1b1') ! 5
      call prof%stop('timer_1b1')
      call prof%stop('timer_1b')
      call prof%stop('timer_1')
      call prof%start('timer_2') ! 6
      call prof%start('timer_2b')! 7
      call prof%stop('timer_2b')
      call prof%stop('timer_2')

      call prof%start('timer_1') ! 2
      call prof%start('timer_1a')! 3
      call prof%stop('timer_1a')
      call prof%stop('timer_1')

      call prof%start('timer_2') ! 6
      call prof%stop('timer_2')
      call prof%start('timer_2') ! 6
      call prof%stop('timer_2')

      call prof%finalize()

      reporter = ProfileReporter(empty)
      call reporter%add_column(NameColumn(20))
      call reporter%add_column(FormattedTextColumn('# cycles','(i8.0)', 8, NumCyclesColumn()))
      allocate(report_lines, source=reporter%generate_report(prof))

      @assertEqual(1 + 7, size(report_lines))
      @assertEqual(20 + 1 + 8, len(report_lines(1)))

      @assertEqual('Name                 # cycles', report_lines(1))
      @assertEqual('top                         1', report_lines(2))
      @assertEqual('--timer_1                   2', report_lines(3))
      @assertEqual('----timer_1a                2', report_lines(4))
      @assertEqual('----timer_1b                1', report_lines(5))
      @assertEqual('------timer_1b1             1', report_lines(6))
      @assertEqual('--timer_2                   3', report_lines(7))
      @assertEqual('----timer_2b                1', report_lines(8))

   end subroutine test_simple_report_timer