| 179 | } // namespace |
| 180 | |
| 181 | int |
| 182 | main(int argc, char *argv[]) |
| 183 | { |
| 184 | Catch::Session session; |
| 185 | |
| 186 | using namespace Catch::clara; |
| 187 | |
| 188 | bool opt_enable_hugepage = false; |
| 189 | |
| 190 | auto cli = session.cli() | |
| 191 | Opt(affinity, "type")["--ts-affinity"]("thread affinity type [0-4]\n" |
| 192 | "0 = HWLOC_OBJ_MACHINE (default)\n" |
| 193 | "1 = HWLOC_OBJ_NODE\n" |
| 194 | "2 = HWLOC_OBJ_SOCKET\n" |
| 195 | "3 = HWLOC_OBJ_CORE\n" |
| 196 | "4 = HWLOC_OBJ_PU") | |
| 197 | Opt(nloop, "n")["--ts-nloop"]("number of loop\n" |
| 198 | "(default: 1000000)") | |
| 199 | Opt(nthreads, "n")["--ts-nthreads"]("number of threads\n" |
| 200 | "(default: 1)") | |
| 201 | Opt(opt_enable_hugepage, "yes|no")["--ts-hugepage"]("enable hugepage\n" |
| 202 | "(default: no)") | |
| 203 | Opt(thread_assiging_order, "n")["--ts-thread-order"]("thread assiging order [0-1]\n" |
| 204 | "0: use both of sibling of hyper-thread first (default)\n" |
| 205 | "1: use a side of sibling of hyper-thread first") | |
| 206 | Opt(debug_enabled, "yes|no")["--ts-debug"]("enable debuge mode\n"); |
| 207 | |
| 208 | session.cli(cli); |
| 209 | |
| 210 | int returnCode = session.applyCommandLine(argc, argv); |
| 211 | if (returnCode != 0) { |
| 212 | return returnCode; |
| 213 | } |
| 214 | |
| 215 | if (debug_enabled) { |
| 216 | std::cout << "nloop = " << nloop << std::endl; |
| 217 | |
| 218 | if (opt_enable_hugepage) { |
| 219 | std::cout << "hugepage enabled"; |
| 220 | #ifdef MAP_HUGETLB |
| 221 | ats_hugepage_init(true); |
| 222 | std::cout << " ats_pagesize=" << ats_pagesize(); |
| 223 | std::cout << " ats_hugepage_size=" << ats_hugepage_size(); |
| 224 | std::cout << std::endl; |
| 225 | #else |
| 226 | std::cout << "MAP_HUGETLB not defined" << std::endl; |
| 227 | #endif |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | return session.run(); |
| 232 | } |
nothing calls this directly
no test coverage detected