]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/lib/test_timer_performance.c
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / tests / lib / test_timer_performance.c
index ee45ede6ac70f1985fca41c3a3fc3e3e1a67b48d..b67af19aeaa3467e6fb81d82e97119f63954b840 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with Quagga; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -56,23 +55,26 @@ int main(int argc, char **argv)
 
   /* create thread structures so they won't be allocated during the
    * time measurement */
-  for (i = 0; i < SCHEDULE_TIMERS; i++)
-    timers[i] = thread_add_timer_msec(master, dummy_func, NULL, 0);
+  for (i = 0; i < SCHEDULE_TIMERS; i++) {
+    timers[i] = NULL;
+    thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]);
+  }
   for (i = 0; i < SCHEDULE_TIMERS; i++)
     thread_cancel(timers[i]);
 
-  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_start);
+  monotime(&tv_start);
 
   for (i = 0; i < SCHEDULE_TIMERS; i++)
     {
       long interval_msec;
 
       interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS);
-      timers[i] = thread_add_timer_msec(master, dummy_func,
-                                        NULL, interval_msec);
+      timers[i] = NULL;
+      thread_add_timer_msec(master, dummy_func, NULL, interval_msec,
+                            &timers[i]);
     }
 
-  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_lap);
+  monotime(&tv_lap);
 
   for (i = 0; i < REMOVE_TIMERS; i++)
     {
@@ -84,7 +86,7 @@ int main(int argc, char **argv)
       timers[index] = NULL;
     }
 
-  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_stop);
+  monotime(&tv_stop);
 
   t_schedule = 1000 * (tv_lap.tv_sec - tv_start.tv_sec);
   t_schedule += (tv_lap.tv_usec - tv_start.tv_usec) / 1000;