GCC Wikia
Advertisement

このページを編集する際は,編集に関する方針に従ってください.[]

概要[]

引数[]

実装[]

185 /* Fill the current times into TIME.  The definition of this function
186    also defines any or all of the HAVE_USER_TIME, HAVE_SYS_TIME, and
187    HAVE_WALL_TIME macros.  */
188 
189 static void
190 get_time (struct timevar_time_def *now)
191 {

  • nowの値を初期化

192   now->user = 0;
193   now->sys  = 0;
194   now->wall = 0;
195   now->ggc_mem = timevar_ggc_mem_total;
196 

197   if (!timevar_enable)
198     return;
199 



  • nowに値をいれていく

200   {
201 #ifdef USE_TIMES
202     struct tms tms;
203     now->wall = times (&tms)  * ticks_to_msec;
204     now->user = tms.tms_utime * ticks_to_msec;
205     now->sys  = tms.tms_stime * ticks_to_msec;
206 #endif

207 #ifdef USE_GETRUSAGE
208     struct rusage rusage;
209     getrusage (RUSAGE_SELF, &rusage);
210     now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
211     now->sys  = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
212 #endif
213 #ifdef USE_CLOCK
214     now->user = clock () * clocks_to_msec;
215 #endif
216   }


217 }



リンク元

Advertisement