| 703 | BENCHMARK(BM_InEdgeIteration)->ArgPair(1 << 15, 16); |
| 704 | |
| 705 | static void BM_GraphCreation(int iters, int num_nodes, int num_edges_per_node) { |
| 706 | testing::StopTiming(); |
| 707 | const GraphDef graph_def = |
| 708 | test::CreateGraphDef(num_nodes, num_edges_per_node); |
| 709 | const auto registry = OpRegistry::Global(); |
| 710 | GraphConstructorOptions opts; |
| 711 | // Warmup step. |
| 712 | Graph graph(registry); |
| 713 | TF_CHECK_OK(ConvertGraphDefToGraph(opts, graph_def, &graph)); |
| 714 | int64 sum = 0; |
| 715 | testing::StartTiming(); |
| 716 | for (int i = 0; i < iters; ++i) { |
| 717 | Graph graph(registry); |
| 718 | TF_CHECK_OK(ConvertGraphDefToGraph(opts, graph_def, &graph)); |
| 719 | sum += graph.num_node_ids(); |
| 720 | } |
| 721 | VLOG(1) << sum; |
| 722 | testing::StopTiming(); |
| 723 | } |
| 724 | BENCHMARK(BM_GraphCreation)->ArgPair(10, 2); |
| 725 | BENCHMARK(BM_GraphCreation)->ArgPair(1 << 6, 2); |
| 726 | BENCHMARK(BM_GraphCreation)->ArgPair(1 << 9, 2); |
nothing calls this directly
no test coverage detected