Lines Matching full:events
29 static int do_count_loop(struct event *events, u64 instructions, in do_count_loop() argument
43 event_read(&events[0]); in do_count_loop()
44 event_read(&events[1]); in do_count_loop()
45 event_read(&events[2]); in do_count_loop()
47 expected = instructions + overhead + (events[2].result.value * 10); in do_count_loop()
48 difference = events[0].result.value - expected; in do_count_loop()
49 percentage = (double)difference / events[0].result.value * 100; in do_count_loop()
53 event_report(&events[0]); in do_count_loop()
54 event_report(&events[1]); in do_count_loop()
55 event_report(&events[2]); in do_count_loop()
59 printf("Actual %llu\n", events[0].result.value); in do_count_loop()
63 event_reset(&events[0]); in do_count_loop()
64 event_reset(&events[1]); in do_count_loop()
65 event_reset(&events[2]); in do_count_loop()
72 if (difference / events[0].result.value) in do_count_loop()
79 static u64 determine_overhead(struct event *events) in determine_overhead() argument
84 do_count_loop(events, 0, 0, false); in determine_overhead()
85 overhead = events[0].result.value; in determine_overhead()
88 do_count_loop(events, 0, 0, false); in determine_overhead()
89 current = events[0].result.value; in determine_overhead()
104 struct event events[3]; in test_body() local
110 setup_event(&events[0], PERF_COUNT_HW_INSTRUCTIONS, PERF_TYPE_HARDWARE, "instructions"); in test_body()
111 setup_event(&events[1], PERF_COUNT_HW_CPU_CYCLES, PERF_TYPE_HARDWARE, "cycles"); in test_body()
112 setup_event(&events[2], PM_STCX_FAIL, PERF_TYPE_RAW, "stcx_fail"); in test_body()
114 if (event_open(&events[0])) { in test_body()
119 if (event_open_with_group(&events[1], events[0].fd)) { in test_body()
124 if (event_open_with_group(&events[2], events[0].fd)) { in test_body()
129 overhead = determine_overhead(events); in test_body()
133 FAIL_IF(do_count_loop(events, 1000000, overhead, true)); in test_body()
136 FAIL_IF(do_count_loop(events, 10000000, overhead, true)); in test_body()
139 FAIL_IF(do_count_loop(events, 100000000, overhead, true)); in test_body()
142 FAIL_IF(do_count_loop(events, 1000000000, overhead, true)); in test_body()
145 FAIL_IF(do_count_loop(events, 16000000000, overhead, true)); in test_body()
148 FAIL_IF(do_count_loop(events, 64000000000, overhead, true)); in test_body()
150 event_close(&events[0]); in test_body()
151 event_close(&events[1]); in test_body()