Once installed (see the Installation Guide), the Estime library is easy to use. In order to use it in your C code, you have to include the header file <estime.h> and compile your code with the library option -lestime. The Estime package provides a few examples.
ESTIME * estime_init() Initialization step that must be performed once. estime_t estime_get_time() Gets the current cycle count. estime_t estime_get_virtual() Gets the virtual time of the own process. ESTIME * estime_open(pid_t pid) Opens a timer for another process. estime_t estime_get_pid_virtual(ESTIME *timer) Gets the virtual time of another process. double estime_cycles_per_sec() Gets the number of cycles per second for this cpu.
Initialization step that must be performed once.
Returns:
the timer for this process or NULL on errorEffects:
initializes the library internal structures
Gets the current cycle count.
Returns:
the current cycle count
Gets the virtual time of the own process.
Returns:
the virtual time in cycles for this processRequires:
estime_init() called
Opens a timer for another process.
Returns:
a timer for the process identified by the given pid or NULL on errorRequires:
pid refers to a live process
Gets the virtual time of another process.
Returns:
the virtual time in cycles for the process of the given timerRequires:
estime_init() called && timer refers to a live process
Gets the number of cycles per second for this cpu.
Returns:
the number of cycles per second for this cpuRequires:
estime_init() called