gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_clock::result Interface Reference

Public Member Functions

subroutine dcclockresult0 (clks, unit, total_auto, clk_total, total_name, err)

Detailed Description

Definition at line 191 of file dc_clock.f90.

Member Function/Subroutine Documentation

◆ dcclockresult0()

subroutine dc_clock::result::dcclockresult0 ( type(clock), dimension(:), intent(in) clks,
integer, intent(in), optional unit,
logical, intent(in), optional total_auto,
type(clock), intent(in), optional clk_total,
character(*), intent(in), optional total_name,
logical, intent(out), optional err )

Display CPU time summary

Displays the total CPU time summary. Pass an array of CLOCK variables to clks. This is intended to be called at the end of the program. Specify the output unit number in unit. If unit is not given, output goes to standard output.

If total_auto is .true., the sum of all clks is automatically displayed. If clk_total is given, it takes precedence.

If clk_total is given, this CLOCK variable is displayed as the total.

If total_name is given, this string is output at the beginning of the summary.

If any clk in clks has not been initialized by DCClockCreate, an error is raised. If err is provided, .true. is returned in err and the program continues.

Parameters
[in]clksArray of CLOCK type variables
[in]unitOutput unit number (optional). Default: standard output.
[in]total_autoIf .true., automatically display sum of all clks (optional)
[in]clk_totalCLOCK variable to display as total (optional)
[in]total_nameString to output at the beginning of summary (optional)
[out]errError flag (optional). .true. if error occurred.

Definition at line 712 of file dc_clock.f90.

713 use dc_types, only: stdout, string, dp
714 use dc_message, only: messagenotify
715 use dc_string, only: printf, tochar, cprintf
716 use dc_date, only: evalsec
718 implicit none
719 type(CLOCK), intent(in):: clks(:)
720 integer, intent(in), optional:: unit
721 logical, intent(in), optional:: total_auto
722 type(CLOCK), intent(in), optional:: clk_total
723 logical, intent(out), optional:: err
724 character(*), intent(in), optional:: total_name
725 integer:: out_unit, i, clks_size, ra
726 character(20):: clk_name
727 integer:: name_len
728 character(STRING):: cause_c
729 character(STRING):: total_name_work
730 type(CLOCK):: clk_auto_total
731 logical:: total_print_complete
732 real(DP):: elapsed_time_val_cor
733 integer:: stat
734 character(*), parameter:: total_time_mes = ' TOTAL TIME = '
735 integer:: myrank_mpi, nprocs_mpi
736 character(*), parameter:: subname = 'DCClockResult'
737 continue
738 call beginsub(subname)
739 stat = dc_noerr
740 cause_c = 'CLOCK'
741 clks_size = size(clks)
742 do i = 1, clks_size
743 if (.not. clks(i) % initialized) then
744 call messagenotify('W', subname, 'Call Create before Result in dc_clock.')
745 call dbgmessage('Ignored because input argument was not initialized.')
746 stat = dc_enotinit
747 goto 999
748 end if
749 end do
750 if (present(unit)) then
751 out_unit = unit
752 else
753 out_unit = stdout
754 end if
755 if (present(total_name)) then
756 total_name_work = ' (' // trim(total_name) // ')'
757 else
758 total_name_work = ''
759 end if
760 myrank_mpi = -1
761 nprocs_mpi = 1
762 do ra = 0, nprocs_mpi - 1
763 call printf(out_unit, '')
764 if ( myrank_mpi < 0 ) then
765 call printf(out_unit, &
766 & ' ############## CPU TIME SUMMARY%c################', &
767 & c1=trim(total_name_work) // ' ')
768 else
769 call printf(out_unit, &
770 & ' ####### CPU TIME SUMMARY%c#### [rank=%06d] ####', &
771 & c1=trim(total_name_work) // ' ', &
772 & i = (/myrank_mpi/) )
773 end if
774 do i = 1, clks_size
775 clk_name = ''
776 name_len = min(len(clk_name), len_trim(clks(i) % name))
777 if (name_len > 0) then
778 clk_name(1:name_len) = clks(i) % name(1:name_len)
779 end if
780 elapsed_time_val_cor = clks(i) % elapsed_time
781 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
782 call printf(out_unit, &
783 & ' %c%c %c', c1=clk_name, &
784 & c2=trim(result_value_form(elapsed_time_val_cor)), &
785 & c3=trim(fit_unit_value(clks(i) % elapsed_time)))
786 end do
787 total_print_complete = .false.
788 if (present(clk_total)) then
789 if (clk_total % initialized) then
790 call printf(out_unit, &
791 & ' ------------------------------------------------')
792 elapsed_time_val_cor = clk_total % elapsed_time
793 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
794 call printf(out_unit, &
795 & ' %c%c %c', c1=total_time_mes, &
796 & c2=trim(result_value_form(elapsed_time_val_cor)), &
797 & c3=trim(fit_unit_value(clk_total % elapsed_time)))
798 total_print_complete = .true.
799 end if
800 end if
801 if (present(total_auto) .and. .not. total_print_complete) then
802 if (total_auto) then
803 clk_auto_total = clks(1)
804 if (clks_size > 1) then
805 do i = 2, clks_size
806 clk_auto_total = clk_auto_total + clks(i)
807 end do
808 end if
809 call printf(out_unit, &
810 & ' ------------------------------------------------')
811 elapsed_time_val_cor = clk_auto_total % elapsed_time
812 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
813 call printf(out_unit, &
814 & ' %c%c %c', c1=total_time_mes, &
815 & c2=trim(result_value_form(elapsed_time_val_cor)), &
816 & c3=trim(fit_unit_value(clk_auto_total % elapsed_time)))
817 end if
818 end if
819 call dbgmessage('total results, output to device number %d', &
820 & i=(/out_unit/))
821 end do
822999 continue
823 call storeerror(stat, subname, err, cause_c)
824 call endsub(subname)
Date and time manipulation module.
Definition dc_date.f90:57
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
Message output module.
Handling character types.
Definition dc_string.f90:83
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public stdout
Unit number for Standard OUTPUT
Definition dc_types.f90:117
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

The documentation for this interface was generated from the following file: