-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnoop.c
More file actions
50 lines (38 loc) · 1.05 KB
/
Copy pathnoop.c
File metadata and controls
50 lines (38 loc) · 1.05 KB
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
// SPDX-License-Identifier: Apache-2.0
#include "vaccel.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int ret;
struct vaccel_session sess;
struct vaccel_prof_region noop_stats = VACCEL_PROF_REGION_INIT("noop");
if (argc > 2) {
fprintf(stderr, "Usage: %s [iterations]\n", argv[0]);
return VACCEL_EINVAL;
}
ret = vaccel_session_init(&sess, 0);
if (ret) {
fprintf(stderr, "Could not initialize session\n");
return ret;
}
printf("Initialized session with id: %" PRId64 "\n", sess.id);
const int iter = (argc > 1) ? atoi(argv[1]) : 1;
for (int i = 0; i < iter; i++) {
vaccel_prof_region_start(&noop_stats);
ret = vaccel_noop(&sess);
vaccel_prof_region_stop(&noop_stats);
if (ret) {
fprintf(stderr, "Could not run op: %d\n", ret);
goto release_session;
}
}
release_session:
if (vaccel_session_release(&sess))
fprintf(stderr, "Could not release session\n");
vaccel_prof_region_print(&noop_stats);
vaccel_prof_region_release(&noop_stats);
return ret;
}