]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: remove RUSAGE_T from struct thread
authorJorge Boncompte [DTI2] <jorge@dti2.net>
Mon, 7 May 2012 16:53:12 +0000 (16:53 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 22 May 2012 18:35:51 +0000 (20:35 +0200)
* thread.c: It's only temporarily used in thread_call() to calculate the
  diffs. Saves 80 bytes per copy.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/thread.c
lib/thread.h

index dd0413b3477a8c4380ab3754c4d09b92458d13b0..784b29c67c1b5f49f87ebbd96015c9a68d4afce2 100644 (file)
@@ -1146,7 +1146,7 @@ int
 thread_should_yield (struct thread *thread)
 {
   quagga_get_relative (NULL);
-  return (timeval_elapsed(relative_time, thread->ru.real) >
+  return (timeval_elapsed(relative_time, thread->real) >
          THREAD_YIELD_TIME_SLOT);
 }
 
@@ -1175,7 +1175,7 @@ void
 thread_call (struct thread *thread)
 {
   unsigned long realtime, cputime;
-  RUSAGE_T ru;
+  RUSAGE_T before, after;
 
  /* Cache a pointer to the relevant cpu history thread, if the thread
   * does not have it yet.
@@ -1194,13 +1194,14 @@ thread_call (struct thread *thread)
                     (void * (*) (void *))cpu_record_hash_alloc);
     }
 
-  GETRUSAGE (&thread->ru);
+  GETRUSAGE (&before);
+  thread->real = before.real;
 
   (*thread->func) (thread);
 
-  GETRUSAGE (&ru);
+  GETRUSAGE (&after);
 
-  realtime = thread_consumed_time (&ru, &thread->ru, &cputime);
+  realtime = thread_consumed_time (&after, &before, &cputime);
   thread->hist->real.total += realtime;
   if (thread->hist->real.max < realtime)
     thread->hist->real.max = realtime;
index dfc51e283119a2095653c6fc3f85cd37c7292449..56f4d0731309888c4031ebf90d29d784635ae0ea 100644 (file)
@@ -77,7 +77,7 @@ struct thread
     int fd;                    /* file descriptor in case of read/write. */
     struct timeval sands;      /* rest of time sands value. */
   } u;
-  RUSAGE_T ru;                 /* Indepth usage info.  */
+  struct timeval real;
   struct cpu_thread_history *hist; /* cache pointer to cpu_history */
   char* funcname;
 };