Lines Matching full:events
29 static int do_count_loop(struct event *events, u64 instructions, in do_count_loop() argument
42 event_read(&events[0]); in do_count_loop()
43 event_read(&events[1]); in do_count_loop()
46 difference = events[0].result.value - expected; in do_count_loop()
47 percentage = (double)difference / events[0].result.value * 100; in do_count_loop()
50 event_report(&events[0]); in do_count_loop()
51 event_report(&events[1]); in do_count_loop()
55 printf("Actual %llu\n", events[0].result.value); in do_count_loop()
59 event_reset(&events[0]); in do_count_loop()
60 event_reset(&events[1]); in do_count_loop()
67 if (difference / events[0].result.value) in do_count_loop()
74 static u64 determine_overhead(struct event *events) in determine_overhead() argument
79 do_count_loop(events, 0, 0, false); in determine_overhead()
80 overhead = events[0].result.value; in determine_overhead()
83 do_count_loop(events, 0, 0, false); in determine_overhead()
84 current = events[0].result.value; in determine_overhead()
96 struct event events[2]; in test_body() local
99 setup_event(&events[0], PERF_COUNT_HW_INSTRUCTIONS, "instructions"); in test_body()
100 setup_event(&events[1], PERF_COUNT_HW_CPU_CYCLES, "cycles"); in test_body()
102 if (event_open(&events[0])) { in test_body()
107 if (event_open_with_group(&events[1], events[0].fd)) { in test_body()
112 overhead = determine_overhead(events); in test_body()
116 FAIL_IF(do_count_loop(events, 1000000, overhead, true)); in test_body()
119 FAIL_IF(do_count_loop(events, 10000000, overhead, true)); in test_body()
122 FAIL_IF(do_count_loop(events, 100000000, overhead, true)); in test_body()
125 FAIL_IF(do_count_loop(events, 1000000000, overhead, true)); in test_body()
128 FAIL_IF(do_count_loop(events, 16000000000, overhead, true)); in test_body()
131 FAIL_IF(do_count_loop(events, 64000000000, overhead, true)); in test_body()
133 event_close(&events[0]); in test_body()
134 event_close(&events[1]); in test_body()