LIBPAF(2014-04-13)

NAME
The Power Architecture Facilities - Timebase header

SYNOPSIS
#include <paf/tb.h>

uint64_t paf_timing_now(void);

void paf_timing_accum(uint64_t *sum, uint64_t diff);

uint64_t paf_timing_diff(uint64_t start, uint64_t end);

DESCRIPTION
The Time Base header tb.h provides a mechanism to read the Time Base Register (TB) available on Power Architecture. This register follows the layout specified in the corresponding Power ISA.

The function paf_timing_now() reads the current value of the Time Base Register.

The function paf_timing_accum() adds time difference to variable *sum The function paf_timing_diff() computes difference between two times.

RETURN VALUE
paf_timing_now() returns the current value of the Time Base Register. paf_timing_diff() returns the difference between two times.

EXAMPLES

  Program source
#include <stdio.h>
#include <paf/tb.h>
int
main ()
{
  int i, j;
  uint64_t load_time, start, stop, sum = 0;
  for (i = 0; i < 3; i++)
    {
      start = paf_timing_now ();
      for (j = 0; j < 1000; j++);
      stop = paf_timing_now ();
      load_time = paf_timing_diff (start, stop);
      paf_timing_accum (&sum, load_time);
      printf ("Time taken by the for loop is %ld ticks, load_time);
    }
  printf ("Total time taken is %ld ticks,sum);
  return 0;
}

REFERENCES

Power ISA™ Version 2.05

Power ISA™ Version 2.06

Power ISA™ Version 2.06+

Power ISA™ Version 2.07

REPORTING BUGS

Email bug reports to Rajalakshmi S<raji@linux.vnet.ibm.com>.

AUTHORS
This manual page was written by Rajalakshmi S<raji@linux.vnet.ibm.com> and Adhemerval Zanella <azanella@linux.vnet.ibm.com>.