| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* -*- c++ -*- */ | ||
| 2 | /* | ||
| 3 | * Copyright 2013, 2016, 2018 Free Software Foundation, Inc. | ||
| 4 | * | ||
| 5 | * This file is part of VOLK | ||
| 6 | * | ||
| 7 | * SPDX-License-Identifier: LGPL-3.0-or-later | ||
| 8 | */ | ||
| 9 | |||
| 10 | #if HAVE_CONFIG_H | ||
| 11 | #include <config.h> | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #include <volk/constants.h> // for volk_available_machines, volk_c_com... | ||
| 15 | #include <iostream> // for operator<<, endl, cout, ostream | ||
| 16 | #include <string> // for string | ||
| 17 | |||
| 18 | #include "volk/volk.h" // for volk_get_alignment, volk_get_machine | ||
| 19 | #include "volk_option_helpers.h" // for option_list, option_t | ||
| 20 | |||
| 21 | ✗ | void print_alignment() | |
| 22 | { | ||
| 23 | ✗ | std::cout << "Alignment in bytes: " << volk_get_alignment() << std::endl; | |
| 24 | ✗ | } | |
| 25 | |||
| 26 | ✗ | void print_malloc() | |
| 27 | { | ||
| 28 | // You don't want to change the volk_malloc code, so just copy the if/else | ||
| 29 | // structure from there and give an explanation for the implementations | ||
| 30 | ✗ | std::cout << "Used malloc implementation: "; | |
| 31 | #if HAVE_POSIX_MEMALIGN | ||
| 32 | std::cout << "posix_memalign" << std::endl; | ||
| 33 | #elif defined(_MSC_VER) | ||
| 34 | std::cout << "_aligned_malloc" << std::endl; | ||
| 35 | #else | ||
| 36 | ✗ | std::cout << "C11 aligned_alloc" << std::endl; | |
| 37 | #endif | ||
| 38 | ✗ | } | |
| 39 | |||
| 40 | |||
| 41 | ✗ | int main(int argc, char** argv) | |
| 42 | { | ||
| 43 | |||
| 44 | ✗ | option_list our_options("volk-config-info"); | |
| 45 | ✗ | our_options.add( | |
| 46 | ✗ | option_t("prefix", "", "print the VOLK installation prefix", volk_prefix())); | |
| 47 | ✗ | our_options.add( | |
| 48 | ✗ | option_t("cc", "", "print the VOLK C compiler version", volk_c_compiler())); | |
| 49 | ✗ | our_options.add( | |
| 50 | ✗ | option_t("cflags", "", "print the VOLK CFLAGS", volk_compiler_flags())); | |
| 51 | ✗ | our_options.add(option_t( | |
| 52 | "all-machines", "", "print VOLK machines built", volk_available_machines())); | ||
| 53 | ✗ | our_options.add(option_t("avail-machines", | |
| 54 | "", | ||
| 55 | "print VOLK machines on the current " | ||
| 56 | "platform", | ||
| 57 | volk_list_machines)); | ||
| 58 | ✗ | our_options.add(option_t("machine", | |
| 59 | "", | ||
| 60 | "print the current VOLK machine that will be used", | ||
| 61 | volk_get_machine())); | ||
| 62 | ✗ | our_options.add( | |
| 63 | ✗ | option_t("alignment", "", "print the memory alignment", print_alignment)); | |
| 64 | ✗ | our_options.add(option_t("malloc", | |
| 65 | "", | ||
| 66 | "print the malloc implementation used in volk_malloc", | ||
| 67 | print_malloc)); | ||
| 68 | ✗ | our_options.add(option_t("version", "v", "print the VOLK version", volk_version())); | |
| 69 | |||
| 70 | ✗ | our_options.parse(argc, argv); | |
| 71 | |||
| 72 | ✗ | return 0; | |
| 73 | ✗ | } | |
| 74 |