# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1323625413 -3600
# Node ID 0ab493e5250e6329b5036233ed05ad0fb2b576fd
# Parent  4eab99ff2666fb7a53bdf3f9d5ac99a347d0e829
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.

diff -r 4eab99ff2666 -r 0ab493e5250e CMakeLists.txt
--- a/CMakeLists.txt	Sun Dec 11 16:08:52 2011 +0100
+++ b/CMakeLists.txt	Sun Dec 11 18:43:33 2011 +0100
@@ -12,6 +12,10 @@
 SET(PROJECT_VERSION "hg-tip"
     CACHE STRING "${PROJECT_NAME} version string")
 
+GET_FILENAME_COMPONENT(BUILD_DIR_NAME ${CMAKE_BINARY_DIR} NAME)
+
+SET(BENCHMARK_BUILD_ID ${BUILD_DIR_NAME} CACHE STRING "Benchmark build id")
+
 ## Do not edit this.
 PROJECT(${PROJECT_NAME})
 
diff -r 4eab99ff2666 -r 0ab493e5250e tests/benchmark_tools.h
--- a/tests/benchmark_tools.h	Sun Dec 11 16:08:52 2011 +0100
+++ b/tests/benchmark_tools.h	Sun Dec 11 18:43:33 2011 +0100
@@ -28,13 +28,14 @@
 extern std::string instance_name;
 
 extern const std::string DATADIR_PATH;
-
+extern const std::string BENCHMARK_BUILD_ID;
 
 inline void logTime(const std::string &_instance_name,
 		    const std::string &subtest_name,
 		    const lemon::TimeStamp &time)
 {
-  std::cout << "*** " << test_name
+  std::cout << "*** " << BENCHMARK_BUILD_ID 
+	    << ' ' << test_name
 	    << ' ' << _instance_name
 	    << ' ' << subtest_name
 	    << ' ' << std::setiosflags(std::ios::fixed) << std::setprecision(4)
diff -r 4eab99ff2666 -r 0ab493e5250e tests/paths.cc.cmake
--- a/tests/paths.cc.cmake	Sun Dec 11 16:08:52 2011 +0100
+++ b/tests/paths.cc.cmake	Sun Dec 11 18:43:33 2011 +0100
@@ -2,3 +2,4 @@
 #include <string>
 
 const std::string DATADIR_PATH = "@DATADIR_PATH@";
+const std::string BENCHMARK_BUILD_ID = "@BENCHMARK_BUILD_ID@";