For most unix variants, compilation is quite straightforward. Just
follow the instruction in the INSTALL and README documents. The following
is a quick way to get going.
When compiling your programs, you must load the ipm library. For example
gcc -O3 -o main main.c ../ipm-2.0a/libipm.aNote that you need to specify the path to the IPM library with -L option.
There following are the routines that might prove useful.
void IPM_timer_clear(IPM_timer *); // resets timerMore detailed explanation are available in the README file.
void IPM_timer_start(IPM_timer *); // starts timer
void IPM_timer_stop(IPM_timer *); // ends timer
// prints out the elapsed time.
void IPM_timer_report(const char *tag, const IPM_timer *, char *buf);
// reads the elapsed time in seconds.
double IPM_timer_report(const IPM_timer *);
Sample code. The following code measures the time spent by the routine foo(). (Excerpt from the README).
#include "IPM_timer.h" /* Get timer declarations */
extern void foo(); /* function to be timed. */
int main() {
IPM_timer t; /* Place for timer info. */
char report[IPM_TIMER_REPORT_LEN+3]; /* Place to put timer report. */
IPM_timer_clear(&t); /* Initialize interval statistics. */
IPM_timer_start(&t); /* Start measurement. */
foo(); /* Routine to be measured. */
IPM_timer_stop(&t); /* Stop measurement. */
IPM_timer_report("foo", &t, report); /* Format report string. */
puts(report); /* Output report string. */
return 0;
}
Win32 Port provided by Rich Vuduc.