+---------------------------------Fortran 95---------------------------------+
目的
すべてのスレッドの現行プロセスおよび場合によっては子プロセス にかかる CPU 時間を秒単位で戻します。 CPU_TIME を呼び出すと、 プログラムの始まりからの処理にかかるプロセッサー時間を戻します。計測される時間は、プログラムが実際に実行された時間であり、 プログラムが中断している時間または待っている時間ではありません。
クラス
サブルーチン
引き数の型と属性
これが、cpu_time_type 実行時オプションを 設定していない場合の、CPU_TIME の時間のデフォルト測定です。
cpu_time_type 実行時オプションの 設定は、setrteopts プロシージャーを使用して行います。 cpu_time_type 設定へのそれぞれの変更は、 後続の CPU_TIME の呼び出しすべてに影響します。
例
例 1:
! The default value for cpu_time_type is used REAL T1, T2 ... ! First chunk of code to be timed CALL CPU_TIME(T1) ... ! Second chunk of code to be timed CALL CPU_TIME(T2) print *, 'Time taken for first chunk of code: ', T1, 'seconds.' print *, 'Time taken for both chunks of code: ', T2, 'seconds.' print *, 'Time for second chunk of code was ', T2-T1, 'seconds.'
cpu_time_type 実行時オプションを usertime に 設定したい場合、ksh または bsh コマンド行から次のコマンドを入力します。
export XLFRTEOPTS=cpu_time_type=usertime
例 2:
! Use setrteopts to set the cpu_time_type run-time option as many times ! as you need to CALL setrteopts ('cpu_time_type=alltime') CALL stallingloop CALL CPU_TIME(T1) print *, 'The sum of the user and system time is', T1, 'seconds'. CALL setrteopts ('cpu_time_type=usertime') CALL stallingloop CALL CPU_TIME(T2) print *, 'The total user time from the start of the program is', T2, 'seconds'.
関連情報
+-----------------------------End of Fortran 95------------------------------+