Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_toc(3)		    Library Functions Manual		       xt_toc(3)

NAME
     xt_toc() - Report time since last xt_tic()

LIBRARY
     #include <xtend/time.h>
     -lxtend

SYNOPSIS
     unsigned long xt_toc(FILE *stream, const char *message,
     struct timeval *start_time, struct rusage *start_usage)

ARGUMENTS
     stream	 FILE stream to which output is sent
     message	 Optional message to print before time stats, or NULL
     start_time  A struct timeval structure populated by xt_tic()

DESCRIPTION
     xt_toc()  reports	the  elapsed  time,  user  time,  and  system time since
     start_time and start_usage, which should have been populated  by  xt_tic(3)
     at  the  beginning of the interval being measured.  Time is reported in mi-
     croseconds, and if elapsed time is greater than one  second,  days,  hours,
     and seconds are also reported.

     The  xt_tic()  and  xt_toc() functions are used to accurately determine the
     elapsed time of a segment of code, such as a loop that is suspected  to  be
     costly.   xt_tic()  is  inserted  into the program just before the code and
     xt_toc() immediately after.

RETURN VALUES
     The time difference in microseconds

EXAMPLES
     struct timeval  start_time;
     struct rusage   start_usage;

     xt_tic(&start_time, &start_usage);
     // Code for which elapsed time is to be measured
     for (c = 0; c < bignum; ++c)
     {
	 ...
     }
     xt_toc(stderr, "Elapsed time for loop:n", &start_time, &start_usage);

SEE ALSO
     xt_tic(3), xt_difftimeofday(3), gettimeofday(2)

								       xt_toc(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_toc&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help