File: papi_clockres.c

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (60 lines) | stat: -rw-r--r-- 1,419 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/** file clockres.c
  *
  * @page papi_clockres
  * @brief The papi_clockres utility.
  *	@section Name
  * papi_clockres - measures and reports clock latency and resolution for PAPI timers. 
  *
  * @section Synopsis
  *	@section Description
  *	papi_clockres is a PAPI utility program that measures and reports the
  *	latency and resolution of the four PAPI timer functions:
  *	PAPI_get_real_cyc(), PAPI_get_virt_cyc(), PAPI_get_real_usec() and PAPI_get_virt_usec().
  *
  *	@section Options
  *		This utility has no command line options.
  *
  *	@section Bugs
  *	There are no known bugs in this utility.
  *	If you find a bug, it should be reported to the PAPI Mailing List at <ptools-perfapi@icl.utk.edu>.
  *
  */

#include <stdio.h>
#include <stdlib.h>

#include "papi.h"

#include "../testlib/clockcore.h"

int
main( int argc, char **argv )
{
	(void) argc;
	(void) argv;

	int retval;

	retval = PAPI_library_init( PAPI_VER_CURRENT );
	if (retval != PAPI_VER_CURRENT ) {
		fprintf(stderr,"Error with PAPI init!\n");
		return 1;
	}

	retval = PAPI_set_debug( PAPI_VERB_ECONT );
	if (retval != PAPI_OK ) {
		fprintf(stderr,"Error with PAPI_set_debug!\n");
		return 1;
	}

	printf( "Printing Clock latency and resolution.\n" );
	printf( "-----------------------------------------------\n" );

	retval=clockcore( 0 );
	if (retval<0) {
		fprintf(stderr,"Error reading clock!\n");
		return retval;
	}

	return 0;
}