PAPI 7.1.0.0
Loading...
Searching...
No Matches
broken_events.c
Go to the documentation of this file.
1/*
2 * This tests adding invalid events
3 */
4
5#include <stdio.h>
6
7#include "papi.h"
8#include "papi_test.h"
9
10#include "do_loops.h"
11
12#include "event_name_lib.h"
13
14int main( int argc, char **argv ) {
15
16 int retval;
17
18 int EventSet = PAPI_NULL;
19 int quiet=0;
20 char user_event[4096];
21 long long values[1];
22
23 /* Set TESTS_QUIET variable */
24 quiet=tests_quiet( argc, argv );
25
26 /* Init the PAPI library */
28 if ( retval != PAPI_VER_CURRENT ) {
29 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
30 }
31
32 if (get_invalid_event_name(user_event,4096)==NULL) {
33 if (!quiet) {
34 printf("No sample invalid event defined for this architecture\n");
35 }
36 test_skip( __FILE__, __LINE__, "No event", 0);
37 }
38
40 if (retval != PAPI_OK) {
41 test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
42 }
43
45 if (retval != PAPI_OK) {
46 if ( !quiet ) {
47 fprintf(stderr,"Correctly failed adding invalid event %s %s\n",user_event,PAPI_strerror(retval));
48 }
49 test_pass(__FILE__);
50
51 }
52
54
56
57 if (!quiet) {
58 printf("Read result: %lld\n",values[0]);
59 }
60
61 test_fail( __FILE__, __LINE__,"Added comma separated event somehow",0);
62
63 return 0;
64}
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char * get_invalid_event_name(char *event, int size)
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
Return codes and api definitions.
FILE * stderr
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:584
int main()
Definition: pernode.c:20
int quiet
Definition: rapl_overflow.c:19
int retval
Definition: zero_fork.c:53