POV-Ray : Newsgroups : povray.unix : Solaris CPU time accounting : Solaris CPU time accounting Server Time: 21 Nov 2017 19:06:40 GMT
  Solaris CPU time accounting  
From: John Martin
Date: 26 Mar 2008 02:10:01
I built povray 3.7.0 beta 25b on Solaris and noticed the CPU time
accounting was wrong:

 Render Time:
   Photon Time:      0 hours  0 minutes  0 seconds (0.338 seconds)
               using 7 thread(s) with 0.-07 CPU-seconds total
   Radiosity Time:   0 hours  0 minutes  3 seconds (3.966 seconds)
               using 4 thread(s) with 0.-04 CPU-seconds total
   Trace Time:       0 hours  2 minutes 35 seconds (155.919 seconds)
               using 4 thread(s) with 0.-04 CPU-seconds total

This can be fixed by using getrusage().  A suggested source fix
is below.  The CPU time in the output will then be correct:

 Render Time:
   Photon Time:      0 hours  0 minutes  0 seconds (0.430 seconds)
               using 7 thread(s) with 1.349 CPU-seconds total
   Radiosity Time:   0 hours  0 minutes  5 seconds (5.736 seconds)
               using 4 thread(s) with 22.032 CPU-seconds total
   Trace Time:       0 hours  3 minutes 18 seconds (198.617 seconds)
               using 4 thread(s) with 782.070 CPU-seconds total


--- ./vfe/unix/platformbase.cpp Tue Mar 25 21:50:49 2008
***************
*** 196,202 ****
--- 196,206 ----
  #endif
  #ifdef HAVE_GETRUSAGE
    struct rusage ru;
+ #if defined(__sun)
+   if (getrusage(m_ThreadTimeOnly ? RUSAGE_LWP : RUSAGE_SELF, &ru) == 0)
+ #else
    if (getrusage(RUSAGE_SELF, &ru) == 0)
+ #endif
     return (unsigned POV_LONG) (1000)*(ru.ru_utime.tv_sec + ru.ru_stime.tv_sec)
      + (unsigned POV_LONG)(ru.ru_utime.tv_usec + ru.ru_stime.tv_usec)/1000;
  #endif
***************
*** 226,231 ****
--- 230,242 ----
    if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) == 0)
     return true;
  #endif
+ #ifdef HAVE_GETRUSAGE
+ #if defined(__sun)
+   struct rusage ru;
+   if (getrusage(RUSAGE_LWP, &ru) == 0)
+    return true;
+ #endif
+ #endif
    return false;
   }


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.