[12] | 1 | /* -*- mode: C++; indent-tabs-mode: nil; -*- |
---|
| 2 | * |
---|
| 3 | * This file is a part of LEMON, a generic C++ optimization library. |
---|
| 4 | * |
---|
| 5 | * Copyright (C) 2003-2011 |
---|
| 6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
| 7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
| 8 | * |
---|
| 9 | * Permission to use, modify and distribute this software is granted |
---|
| 10 | * provided that this copyright notice appears in all copies. For |
---|
| 11 | * precise terms see the accompanying LICENSE file. |
---|
| 12 | * |
---|
| 13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
| 14 | * express or implied, and with no claim as to its suitability for any |
---|
| 15 | * purpose. |
---|
| 16 | * |
---|
| 17 | */ |
---|
| 18 | |
---|
[10] | 19 | #ifndef BENCHMARK_TOOLS_H |
---|
| 20 | #define BENCHMARK_TOOLS_H |
---|
| 21 | |
---|
| 22 | #include<string> |
---|
| 23 | #include<iostream> |
---|
| 24 | #include<iomanip> |
---|
| 25 | #include<lemon/time_measure.h> |
---|
| 26 | |
---|
[11] | 27 | extern std::string test_name; |
---|
| 28 | extern std::string instance_name; |
---|
[10] | 29 | |
---|
[11] | 30 | extern const std::string DATADIR_PATH; |
---|
[13] | 31 | extern const std::string BENCHMARK_BUILD_ID; |
---|
[11] | 32 | |
---|
| 33 | inline void logTime(const std::string &_instance_name, |
---|
| 34 | const std::string &subtest_name, |
---|
| 35 | const lemon::TimeStamp &time) |
---|
[10] | 36 | { |
---|
[13] | 37 | std::cout << "*** " << BENCHMARK_BUILD_ID |
---|
| 38 | << ' ' << test_name |
---|
[11] | 39 | << ' ' << _instance_name |
---|
| 40 | << ' ' << subtest_name |
---|
| 41 | << ' ' << std::setiosflags(std::ios::fixed) << std::setprecision(4) |
---|
[10] | 42 | << time.realTime() << ' ' |
---|
| 43 | << time.realTime()/(time.userTime()+time.systemTime()) - 1.0 |
---|
| 44 | << std::endl; |
---|
| 45 | } |
---|
| 46 | |
---|
[11] | 47 | inline void logTime(const std::string &subtest_name, |
---|
| 48 | const lemon::TimeStamp &time) |
---|
| 49 | { |
---|
| 50 | logTime(instance_name,subtest_name,time); |
---|
| 51 | } |
---|
| 52 | |
---|
[10] | 53 | #endif |
---|