Lines Matching full:cmd_data
198 #define MAINLOOP(cmd_data, BENCH, COMPUTE_AVG, PRINT_ITER, PRINT_AVG) \
200 int iters = (cmd_data).args[1]; \
201 bool print_average = (cmd_data).print_average; \
202 bool print_each_iter = (cmd_data).print_each_iter; \
228 #define MAINLOOP_DATA(name, cmd_data, size, BENCH) \
229 size_t copies = (cmd_data).data_size/(size); \
231 MAINLOOP(cmd_data, \
241 #define MAINLOOP_COLD(name, cmd_data, size, num_incrs, BENCH) \
248 if (num_buffers * (size) < static_cast<size_t>((cmd_data).data_size)) { \
249 copies = (cmd_data).data_size / (num_buffers * (size)); \
256 MAINLOOP(cmd_data, \
273 #define BENCH_ONE_BUF(name, cmd_data, INIT, BENCH) \
274 size_t size = (cmd_data).args[0]; \
275 uint8_t *buf = allocateAlignedMemory(size, (cmd_data).dst_align, (cmd_data).dst_or_mask); \
279 MAINLOOP_DATA(name, cmd_data, size, BENCH);
287 #define BENCH_TWO_BUFS(name, cmd_data, INIT, BENCH) \
288 size_t size = (cmd_data).args[0]; \
289 uint8_t *buf1 = allocateAlignedMemory(size, (cmd_data).src_align, (cmd_data).src_or_mask); \
293 if ((cmd_data).dst_str_size > 0) \
294 total_size += (cmd_data).dst_str_size; \
295 uint8_t *buf2 = allocateAlignedMemory(total_size, (cmd_data).dst_align, (cmd_data).dst_or_mask); \
299 MAINLOOP_DATA(name, cmd_data, size, BENCH);
314 #define COLD_ONE_BUF(name, cmd_data, INIT, BENCH) \
315 size_t size = (cmd_data).args[0]; \
316 size_t incr = getAlignmentIncrement(size, (cmd_data).dst_align); \
317 size_t num_buffers = (cmd_data).cold_data_size / incr; \
319 uint8_t *buffer = getColdBuffer(num_buffers, incr, (cmd_data).dst_align, (cmd_data).dst_or_mask); \
322 size_t num_incrs = (cmd_data).cold_stride_size / incr + 1; \
327 MAINLOOP_COLD(name, (cmd_data), size, num_incrs, \
347 #define COLD_TWO_BUFS(name, cmd_data, INIT, BENCH) \
348 size_t size = (cmd_data).args[0]; \
349 size_t buf1_incr = getAlignmentIncrement(size, (cmd_data).src_align); \
351 if ((cmd_data).dst_str_size > 0) \
352 total_size += (cmd_data).dst_str_size; \
353 size_t buf2_incr = getAlignmentIncrement(total_size, (cmd_data).dst_align); \
355 size_t num_buffers = (cmd_data).cold_data_size / max_incr; \
358 uint8_t *buffer1 = getColdBuffer(num_buffers, buf1_incr, (cmd_data).src_align, (cmd_data).src_or_mask); \
361 uint8_t *buffer2 = getColdBuffer(num_buffers, buf2_incr, (cmd_data).dst_align, (cmd_data).dst_or_mask); \
365 size_t num_incrs = (cmd_data).cold_stride_size / min_incr + 1; \
372 MAINLOOP_COLD(name, (cmd_data), size, num_incrs, \
381 int benchmarkSleep(const char* /*name*/, const command_data_t &cmd_data, void_func_t /*func*/) {
382 int delay = cmd_data.args[0];
383 MAINLOOP(cmd_data, sleep(delay),
393 int benchmarkMemset(const char *name, const command_data_t &cmd_data, void_func_t func) {
395 BENCH_ONE_BUF(name, cmd_data, ;, memset_func(buf, i, size));
400 int benchmarkMemsetCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
402 COLD_ONE_BUF(name, cmd_data, ;, memset_func(buf, l, size));
407 int benchmarkMemcpy(const char *name, const command_data_t &cmd_data, void_func_t func) {
410 BENCH_TWO_BUFS(name, cmd_data,
418 int benchmarkMemcpyCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
421 COLD_TWO_BUFS(name, cmd_data,
429 int benchmarkMemmoveBackwards(const char *name, const command_data_t &cmd_data, void_func_t func) {
432 size_t size = cmd_data.args[0];
433 size_t alloc_size = size * 2 + 3 * cmd_data.dst_align;
434 uint8_t* src = allocateAlignedMemory(size, cmd_data.src_align, cmd_data.src_or_mask);
438 uint8_t* dst = getAlignedMemory(src+1, cmd_data.dst_align, cmd_data.dst_or_mask);
441 MAINLOOP_DATA(name, cmd_data, size, memmove_func(dst, src, size));
445 int benchmarkMemread(const char *name, const command_data_t &cmd_data, void_func_t /*func*/) {
446 int size = cmd_data.args[0];
456 MAINLOOP_DATA(name, cmd_data, size,
463 int benchmarkStrcmp(const char *name, const command_data_t &cmd_data, void_func_t func) {
467 BENCH_TWO_BUFS(name, cmd_data,
476 int benchmarkStrcmpCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
480 COLD_TWO_BUFS(name, cmd_data,
493 int benchmarkStrlen(const char *name, const command_data_t &cmd_data, void_func_t func) {
496 BENCH_ONE_BUF(name, cmd_data,
507 int benchmarkStrlenCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
510 COLD_ONE_BUF(name, cmd_data,
523 int benchmarkStrcat(const char *name, const command_data_t &cmd_data, void_func_t func) {
526 int dst_str_size = cmd_data.dst_str_size;
532 BENCH_TWO_BUFS(name, cmd_data,
540 int benchmarkStrcatCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
543 int dst_str_size = cmd_data.dst_str_size;
549 COLD_TWO_BUFS(name, cmd_data,
562 int benchmarkStrcpy(const char *name, const command_data_t &cmd_data, void_func_t func) {
565 BENCH_TWO_BUFS(name, cmd_data,
573 int benchmarkStrcpyCold(const char *name, const command_data_t &cmd_data, void_func_t func) {
576 COLD_TWO_BUFS(name, cmd_data,
669 function_t *processOptions(int argc, char **argv, command_data_t *cmd_data) {
673 cmd_data->print_average = false;
674 cmd_data->print_each_iter = true;
675 cmd_data->dst_align = 0;
676 cmd_data->src_align = 0;
677 cmd_data->src_or_mask = 0;
678 cmd_data->dst_or_mask = 0;
679 cmd_data->num_args = 0;
680 cmd_data->cpu_to_lock = -1;
681 cmd_data->data_size = DEFAULT_DATA_SIZE;
682 cmd_data->dst_str_size = -1;
683 cmd_data->cold_data_size = DEFAULT_COLD_DATA_SIZE;
684 cmd_data->cold_stride_size = DEFAULT_COLD_STRIDE_SIZE;
686 cmd_data->args[i] = -1;
693 cmd_data->print_average = true;
695 cmd_data->print_each_iter = false;
697 save_value = &cmd_data->dst_align;
699 save_value = &cmd_data->src_align;
701 save_value = &cmd_data->dst_or_mask;
703 save_value = &cmd_data->src_or_mask;
705 save_value = &cmd_data->cpu_to_lock;
707 save_value = &cmd_data->data_size;
709 save_value = &cmd_data->dst_str_size;
711 save_value = &cmd_data->cold_data_size;
713 save_value = &cmd_data->cold_stride_size;
741 } else if (cmd_data->num_args > MAX_ARGS) {
745 cmd_data->args[cmd_data->num_args++] = atoi(argv[i]);
750 if (cmd_data->num_args != 1 && cmd_data->num_args != 2) {
753 } else if (cmd_data->dst_align < 0) {
756 } else if (cmd_data->src_align < 0) {
759 } else if (cmd_data->data_size <= 0) {
762 } else if ((cmd_data->dst_align & (cmd_data->dst_align - 1))) {
765 } else if ((cmd_data->src_align & (cmd_data->src_align - 1))) {
768 } else if (!cmd_data->src_align && cmd_data->src_or_mask) {
771 } else if (!cmd_data->dst_align && cmd_data->dst_or_mask) {
774 } else if (cmd_data->src_or_mask > cmd_data->src_align) {
777 } else if (cmd_data->dst_or_mask > cmd_data->dst_align) {
827 command_data_t cmd_data;
829 function_t *command = processOptions(argc, argv, &cmd_data);
835 if (!raisePriorityAndLock(cmd_data.cpu_to_lock)) {
840 return (*command->ptr)(command->name, cmd_data, command->func);