Timer API

API for reading and manipulating the machine timer.

Functions

int metal_timer_get_cyclecount(int hartid, unsigned long long *cyclecount)

Read the machine cycle count.

Return

0 upon success

Parameters
  • hartid: The hart ID to read the cycle count of

  • cyclecount: The variable to hold the value

int metal_timer_get_timebase_frequency(int hartid, unsigned long long *timebase)

Get the machine timebase frequency.

Return

0 upon success

Parameters
  • hartid: The hart ID to read the timebase of

  • timebase: The variable to hold the value

int metal_timer_set_tick(int hartid, int second)

Set the machine timer tick interval in seconds.

Return

0 upon success

Parameters
  • hartid: The hart ID to read the timebase of

  • second: The number of seconds to set the tick interval to