tests: add callgrind start/stop macros in benchmark programs

Change-Id: Ibd875f4275431ebcbeba2fffe319956580714553
Refs: #3610
diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp
index afd4cf7..1dc6c37 100644
--- a/tests/other/face-benchmark.cpp
+++ b/tests/other/face-benchmark.cpp
@@ -32,6 +32,10 @@
 #include <fstream>
 #include <iostream>
 
+#ifdef HAVE_VALGRIND
+#include <valgrind/callgrind.h>
+#endif
+
 namespace nfd {
 namespace tests {
 
@@ -172,6 +176,10 @@
 int
 main(int argc, char** argv)
 {
+#ifdef _DEBUG
+  std::cerr << "Benchmark compiled in debug mode is unreliable, please compile in release mode.\n";
+#endif
+
   if (argc != 2) {
     std::cerr << "Usage: " << argv[0] << " <config-file>" << std::endl;
     return 2;
@@ -179,6 +187,9 @@
 
   try {
     nfd::tests::FaceBenchmark bench{argv[1]};
+#ifdef HAVE_VALGRIND
+    CALLGRIND_START_INSTRUMENTATION;
+#endif
     nfd::getGlobalIoService().run();
   }
   catch (const std::exception& e) {