GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
xt_toc(3) FreeBSD Library Functions Manual xt_toc(3)

#include <xtend/time.h>
-lxtend

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

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()

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 microseconds, 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.

The time difference in microseconds

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);

xt_tic(3), difftimeofday(3), gettimeofday(2)


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.