#include "opj_includes.h"
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/times.h>
Difference in successive opj_clock() calls tells you the elapsed time.