| 94 | } |
| 95 | |
| 96 | int main() { |
| 97 | unsigned char nops[16][15] = { |
| 98 | {0x90} |
| 99 | , {0x66,0x90} |
| 100 | , {0x0f,0x1f,0x00} |
| 101 | , {0x0f,0x1f,0x40,0x00} |
| 102 | , {0x0f,0x1f,0x44,0x00,0x00} |
| 103 | , {0x66,0x0f,0x1f,0x44,0x00,0x00} |
| 104 | , {0x0f,0x1f,0x80,0x00,0x00,0x00,0x00} |
| 105 | , {0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 106 | , {0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 107 | , {0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 108 | , {0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 109 | , {0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 110 | , {0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 111 | , {0x66,0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 112 | , {0x66,0x66,0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} |
| 113 | }; |
| 114 | |
| 115 | int total_nop_bytes = 0x800000; |
| 116 | |
| 117 | for (int i = 0; i < 15; i++) { |
| 118 | sc_fn ptr = gen_sc_fn(nops[i], i + 1, total_nop_bytes); |
| 119 | |
| 120 | uint64_t sum = 0; |
| 121 | uint64_t runs = 0; |
| 122 | |
| 123 | for (int j = 0; j < 1000; j ++) { |
| 124 | uint64_t time = ptr(); |
| 125 | sum += time; |
| 126 | runs ++; |
| 127 | } |
| 128 | double avg = (double)sum / (double)runs; |
| 129 | printf("0x%x bytes of nops of length %d took %f cycles on avg\n", total_nop_bytes, i + 1, avg); |
| 130 | } |
| 131 | } |
nothing calls this directly
no test coverage detected