当前位置: 首页>>代码示例>>C++>>正文


C++ CPUTimer::getTime方法代码示例

本文整理汇总了C++中CPUTimer::getTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUTimer::getTime方法的具体用法?C++ CPUTimer::getTime怎么用?C++ CPUTimer::getTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPUTimer的用法示例。


在下文中一共展示了CPUTimer::getTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: benchmark_ts_PLP

void benchmark_ts_PLP(tsppi::TsPpiGraph& tsppi, bool printHist=false)
{
    CPUTimer timer;

    double naive_time, fast_time;

    LOG("Start Benchmark: Naive");
    timer.start();
    std::vector<NetworKit::Partition > partitions = tsppi::algo::subgraph_PLP(tsppi.subgraphs);
    timer.stop();
    naive_time = timer.getTime();
    LOG("Time for Naive: " << timer.getTime() << " s");

    LOG("Start Benchmark: Fast");
    timer.start();
    std::vector<NetworKit::Partition > partitions_2 = tsppi::algo::subgraph_PLP_vec(tsppi.subgraphs);
    timer.stop();
    fast_time = timer.getTime();
    LOG("Time for Fast: " << timer.getTime() << " s");


    // print histogram
    if (printHist)
    {
        std::cout << "Histogram of cluster sizes for Naive:" << std::endl;
        clusterSizeHist(partitions);
        std::cout << "Histogram of cluster sizes for fast:" << std::endl;
        clusterSizeHist(partitions_2);
    }

    // print timings
    std::cout << naive_time << ";" << fast_time;
}
开发者ID:gattofrancesco,项目名称:tsppi,代码行数:33,代码来源:benchmark.cpp

示例2: benchmark_ts_clustercoeff

void benchmark_ts_clustercoeff(tsppi::TsPpiGraph& tsppi)
{
    CPUTimer timer;

    double naive_time, fast_time, faster_time;

    LOG("Start Benchmark: Naive");
    timer.start();
    std::vector<std::vector<double> > naive_ts_bw = tsppi::algo::subgraph_cc(tsppi.subgraphs);
    timer.stop();
    naive_time = timer.getTime();
    LOG("Time for Naive: " << timer.getTime() << " s");

    LOG("Start Benchmark: Fast");
    timer.start();
    std::vector<std::vector<double> > fast_ts_bw = tsppi::algo::subgraph_cc_neighbor_comb(tsppi.subgraphs);
    timer.stop();
    fast_time = timer.getTime();
    LOG("Time for Fast: " << timer.getTime() << " s");

    LOG("Start Benchmark: Fast");
    timer.start();
    std::vector<std::vector<double> > faster_ts_bw = tsppi::algo::subgraph_cc_neighbor_comb_vec(tsppi.subgraphs);
    timer.stop();
    faster_time = timer.getTime();
    LOG("Time for Fast: " << timer.getTime() << " s");

    std::cout << naive_time << ";" << fast_time << ";" << faster_time;
}
开发者ID:gattofrancesco,项目名称:tsppi,代码行数:29,代码来源:benchmark.cpp

示例3: benchmark_ts_betweenness

void benchmark_ts_betweenness(tsppi::TsPpiGraph& tsppi)
{
    CPUTimer timer;

    double naive_time, fast_time;

    LOG("Start Benchmark: Naive");
    timer.start();
    std::vector<std::vector<double> > naive_ts_bw = tsppi::algo::subgraph_betweenness(tsppi.subgraphs);
    timer.stop();
    naive_time = timer.getTime();
    LOG("Time for Naive: " << timer.getTime() << " s");

    LOG("Start Benchmark: Fast");
    timer.start();
    std::vector<std::vector<double> > fast_ts_bw = tsppi::algo::subgraph_betweenness_fast(tsppi.subgraphs);
    timer.stop();
    fast_time = timer.getTime();
    LOG("Time for Fast: " << timer.getTime() << " s");

    std::cout << naive_time << ";" << fast_time;
}
开发者ID:gattofrancesco,项目名称:tsppi,代码行数:22,代码来源:benchmark.cpp


注:本文中的CPUTimer::getTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。