16 {
18 const char*
names[
NUM_EVENTS] = {
"RECV_CALLS",
"RECV_BYTES",
"RECV_USEC",
"RECV_ERR",
"RECV_INTERRUPTED",
"RECV_WOULD_BLOCK"};
20
21
23
26 fprintf(
stderr,
"PAPI_library_init version mismatch\n");
27 exit(1);
28 }
29
30
32 fprintf(
stderr,
"Error creating event set\n");
33 exit(2);
34 }
35
36 if (!
TESTS_QUIET) printf(
"This program will listen on port 3490, and write data received to standard output\n");
38 int e;
39 int event_code;
43 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
44 exit(2);
45 }
48 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
49 exit(2);
50 }
51 }
52
53 int bytes = 0;
55
56 int sockfd, n_sockfd, sin_size, len;
57 char *host_addr, *recv_msg;
58 struct sockaddr_in my_addr;
59 struct sockaddr_in their_addr;
60 my_addr.sin_family = AF_INET;
61 my_addr.sin_port = htons(
PORT);
62 my_addr.sin_addr.s_addr = INADDR_ANY;
63
64 sockfd = socket(AF_INET, SOCK_STREAM, 0);
65 if (sockfd < 0) {
66 perror("socket");
67 exit(1);
68 }
69 if ((bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))) == -1) {
70 perror("bind");
71 exit(1);
72 }
73 listen(sockfd, 10);
74 if ((n_sockfd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) == -1) {
75 perror("accept");
76 exit(1);
77 }
79
80
82 fprintf(
stderr,
"Error in PAPI_start\n");
83 exit(1);
84 }
85
86 while ((bytes = recv(n_sockfd,
buf, 1024, 0)) > 0) {
88 }
89
91
92
94 fprintf(
stderr,
"Error in PAPI_stop\n");
95 }
96
98 printf("----\n");
101 }
103 return 0;
104}
ssize_t write(int fd, const void *buf, size_t count)
const char * names[NUM_EVENTS]
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
Convert a name to a numeric hardware event code.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_pass(const char *filename)