Add build id field to running time logs default tip
authorAlpar Juttner <alpar@cs.elte.hu>
Sun, 11 Dec 2011 18:43:33 +0100
changeset 130ab493e5250e
parent 12 4eab99ff2666
Add build id field to running time logs

Configurable by BENCHMARK_BUILD_ID cmake variable,
which defaults to the last component of the build directory.
CMakeLists.txt
tests/benchmark_tools.h
tests/paths.cc.cmake
     1.1 --- a/CMakeLists.txt	Sun Dec 11 16:08:52 2011 +0100
     1.2 +++ b/CMakeLists.txt	Sun Dec 11 18:43:33 2011 +0100
     1.3 @@ -12,6 +12,10 @@
     1.4  SET(PROJECT_VERSION "hg-tip"
     1.5      CACHE STRING "${PROJECT_NAME} version string")
     1.6  
     1.7 +GET_FILENAME_COMPONENT(BUILD_DIR_NAME ${CMAKE_BINARY_DIR} NAME)
     1.8 +
     1.9 +SET(BENCHMARK_BUILD_ID ${BUILD_DIR_NAME} CACHE STRING "Benchmark build id")
    1.10 +
    1.11  ## Do not edit this.
    1.12  PROJECT(${PROJECT_NAME})
    1.13  
     2.1 --- a/tests/benchmark_tools.h	Sun Dec 11 16:08:52 2011 +0100
     2.2 +++ b/tests/benchmark_tools.h	Sun Dec 11 18:43:33 2011 +0100
     2.3 @@ -28,13 +28,14 @@
     2.4  extern std::string instance_name;
     2.5  
     2.6  extern const std::string DATADIR_PATH;
     2.7 -
     2.8 +extern const std::string BENCHMARK_BUILD_ID;
     2.9  
    2.10  inline void logTime(const std::string &_instance_name,
    2.11  		    const std::string &subtest_name,
    2.12  		    const lemon::TimeStamp &time)
    2.13  {
    2.14 -  std::cout << "*** " << test_name
    2.15 +  std::cout << "*** " << BENCHMARK_BUILD_ID 
    2.16 +	    << ' ' << test_name
    2.17  	    << ' ' << _instance_name
    2.18  	    << ' ' << subtest_name
    2.19  	    << ' ' << std::setiosflags(std::ios::fixed) << std::setprecision(4)
     3.1 --- a/tests/paths.cc.cmake	Sun Dec 11 16:08:52 2011 +0100
     3.2 +++ b/tests/paths.cc.cmake	Sun Dec 11 18:43:33 2011 +0100
     3.3 @@ -2,3 +2,4 @@
     3.4  #include <string>
     3.5  
     3.6  const std::string DATADIR_PATH = "@DATADIR_PATH@";
     3.7 +const std::string BENCHMARK_BUILD_ID = "@BENCHMARK_BUILD_ID@";