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

Public Member Functions

subroutine dcclockpredict0 (clk, progress, unit, err)

Detailed Description

Definition at line 160 of file dc_clock.f90.

Member Function/Subroutine Documentation

◆ dcclockpredict0()

subroutine dc_clock::dcclockpredict::dcclockpredict0 ( type(clock), intent(in) clk,
real, intent(in) progress,
integer, intent(in), optional unit,
logical, intent(out), optional err )

Display predicted CPU time and completion date

From CLOCK variable clk and progress, displays predicted CPU time and completion date as follows:

########## PREDICTION OF CALCULATION ###########
start date 2007-03-08t16:49:25+09:00
current date 2007-03-08t16:49:27+09:00
progress 66.67% [**************** ]
remaining cpu time 0.100000e+01
completion date 2007-03-08t16:49:28+09:00

Give progress a value from 0 to 1. 0 is program start, 1 is end. (For example, give 0.5 when the program is half done.)

Note: The "prediction" is calculated by a simple algorithm from elapsed time and progress, so it is not an accurate prediction. Use as a guide only.

Specify the output unit number in unit. If unit is not given, output goes to standard output.

If clk 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]clkCLOCK type variable
[in]progressProgress value (0.0 to 1.0)
[in]unitOutput unit number (optional). Default: standard output.
[out]errError flag (optional). .true. if error occurred.

Definition at line 1124 of file dc_clock.f90.

1125 use dc_types, only: stdout, dp
1126 use dc_message, only: messagenotify
1127 use dc_string, only: tochar, cprintf, printf
1130 use dc_date, only: operator(+), dcdatetimecreate, tochar, evalsec, &
1131 & dcdifftimecreate
1132 implicit none
1133 type(CLOCK), intent(in):: clk
1134 real, intent(in):: progress
1135 integer, intent(in), optional:: unit
1136 logical, intent(out), optional:: err
1137 character(STRING):: cause_c
1138 integer:: stat, out_unit
1139 type(DC_DIFFTIME):: remain_diff
1140 type(DC_DATETIME):: comp_date, cur_date
1141 character(7):: prog_percent
1142 character(25):: prog_bar
1143 integer:: prog_bar_ptr
1144 real:: prog_valid
1145 character(*), parameter:: subname = 'DCClockPredict'
1146 continue
1147 call beginsub(subname)
1148 stat = dc_noerr
1149 cause_c = 'CLOCK'
1150 if (.not. clk % initialized) then
1151 call messagenotify('W', subname, 'Call Create before Predict in dc_clock.')
1152 call dbgmessage('Ignored because input argument was not initialized.')
1153 stat = dc_enotinit
1154 goto 999
1155 end if
1156 if (progress <= 0.0) then
1157 call messagenotify('W', subname, 'Specify 0.0 -- 1.0 value to "progress"')
1158 return
1159 elseif (progress > 1.0) then
1160 call messagenotify('W', subname, 'Over 1.0 value to "progress" was modified to 1.0')
1161 prog_valid = 1.0
1162 else
1163 prog_valid = progress
1164 end if
1165 if (present(unit)) then
1166 out_unit = unit
1167 else
1168 out_unit = stdout
1169 end if
1170 call dcdifftimecreate( remain_diff, &
1171 & sec = real(nint(evalsec(clk) / prog_valid * (1.0 - prog_valid)), dp) )
1172 call dcdatetimecreate(cur_date)
1173 comp_date = cur_date + remain_diff
1174 prog_percent = ''
1175 prog_percent = adjustr(trim(printf_g5_2(real(prog_valid * 100, dp))) // '%')
1176 prog_bar = ''
1177 prog_bar_ptr = int(prog_valid * 25)
1178 if (prog_bar_ptr > 0) prog_bar(1:prog_bar_ptr) = '*************************'
1179 call printf(out_unit, '')
1180 call printf(out_unit, &
1181 & ' ########## PREDICTION OF CALCULATION ###########')
1182 call printf(out_unit, &
1183 & ' Start Date %c', c1=trim(tochar(clk % start_date)))
1184 call printf(out_unit, &
1185 & ' Current Date %c', c1=trim(tochar(cur_date)))
1186 call printf(out_unit, &
1187 & ' Progress %c [%c]', c1=prog_percent, c2=prog_bar)
1188 call printf(out_unit, &
1189 & ' Remaining CPU TIME %c %c', &
1190 & c1=trim(result_value_form(evalsec(remain_diff))), &
1191 & c2=trim(fit_unit_value(0.0_dp, remain_diff)))
1192 call printf(out_unit, &
1193 & ' Completion Date %c', c1=trim(tochar(comp_date)))
1194999 continue
1195 call storeerror(stat, subname, err, cause_c)
1196 call endsub(subname)
Derived types and parameters for date and time.
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 stdout
Unit number for Standard OUTPUT
Definition dc_types.f90:117
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_types::dp, dc_trace::endsub(), dc_types::stdout, and dc_error::storeerror().

Here is the call graph for this function:

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