| 1 | // SPDX-License-Identifier: BSD-2-Clausecxx . . $ `<file>/tests/workloads/pointer_chasing/pointer_chasing.h`/ |
| 2 | /* |
| 3 | * Copyright (c) 2025 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef _POINTER_CHASING_H_ |
| 7 | #define _POINTER_CHASING_H_cxx . . $ `tests/workloads/pointer_chasing/pointer_chasing.h:7:9`! |
| 8 | |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | #define CACHE_LINE_SIZEcxx . . $ `tests/workloads/pointer_chasing/pointer_chasing.h:11:9`! 64 |
| 12 | |
| 13 | typedef union ptr_nodecxx . . $ ptr_node# { |
| 14 | structcxx . . $ ptr_node#$anonymous_type_0# { |
| 15 | union ptr_nodecxx . . $ ptr_node# *nextcxx . . $ ptr_node#$anonymous_type_0#next.; |
| 16 | int valcxx . . $ ptr_node#$anonymous_type_0#val.; |
| 17 | }; |
| 18 | uint8_tcxx . . $ uint8_t# bytescxx . . $ ptr_node#bytes.[64]; |
| 19 | } ptr_nodecxx . . $ ptr_node#; |
| 20 | |
| 21 | typedef struct ptr_chasercxx . . $ ptr_chaser# { |
| 22 | uint64_tcxx . . $ uint64_t# buffcxx . . $ ptr_chaser#buff.; |
| 23 | uint64_tcxx . . $ uint64_t# spancxx . . $ ptr_chaser#span.; |
| 24 | void *headcxx . . $ ptr_chaser#head.; |
| 25 | void (*workloadcxx . . $ ptr_chaser#workload.)(struct ptr_chasercxx . . $ ptr_chaser# *); |
| 26 | } ptr_chaser_tcxx . . $ ptr_chaser_t#; |
| 27 | |
| 28 | extern void __chasing_code_loopcxx . . $ __chasing_code_loop(49f6e7a06ebc5aa8).(void); |
| 29 | __asm__(".global __chasing_code_loop ;\n\t" |
| 30 | "__chasing_code_loop: ;\n\t" |
| 31 | "mov (%rax), %rax ;\n\t" |
| 32 | "test %rax, %rax ;\n\t" |
| 33 | "jne __chasing_code_loop ;\n\t" |
| 34 | "ret ;\n\t"); |
| 35 | |
| 36 | /* |
| 37 | * Inline function used to run workload. |
| 38 | * code_ptr: holds a pointer to workload bytecode |
| 39 | * %%RAX: holds a pointer to head of data set |
| 40 | */ |
| 41 | static __attribute__((always_inline)) inline void __ptr_chasing_run_workloadcxx . . $ __ptr_chasing_run_workload(16a131f8fa5bb4ff).( |
| 42 | ptr_chaser_tcxx . . $ ptr_chaser_t# *ptr_chaser) |
| 43 | { |
| 44 | __asm__ __volatile__("call *%[code_ptr] ;\n\t" |
| 45 | : |
| 46 | : [code_ptr] "g"(ptr_chaser->workloadcxx . . $ ptr_chaser#workload.), "a"(ptr_chaser->headcxx . . $ ptr_chaser#head.) |
| 47 | :); |
| 48 | } |
| 49 | |
| 50 | int generate_linked_listcxx . . $ generate_linked_list(5f23473471784566).(ptr_chaser_tcxx . . $ ptr_chaser_t# *ptr_chaser, unsigned int seed); |
| 51 | union ptr_nodecxx . . $ ptr_node# *createLinkedListcxx . . $ createLinkedList(8d6149b11b0bc6ff).(void); |
| 52 | int ptr_chase_setupcxx . . $ ptr_chase_setup(afcd3168fc1188a4).(int argc, char *argv[]); |
| 53 | void run_ptr_chasingcxx . . $ run_ptr_chasing(49f6e7a06ebc5aa8).(void); |
| 54 | |
| 55 | #endif /* _POINTER_CHASING_H_ */ |