Create HidlInstrumentor to wrap the instrumentation related code.

Merged-In:Iffd12f223424617fa9dc9879f34c84e29cd18499
Bug: 32141398
Test: make libhidl
Change-Id: Iffd12f223424617fa9dc9879f34c84e29cd18499
diff --git a/HidlSupport.cpp b/HidlSupport.cpp
index 5307770..98c235c 100644
--- a/HidlSupport.cpp
+++ b/HidlSupport.cpp
@@ -123,8 +123,17 @@
 const size_t hidl_string::kOffsetOfBuffer = offsetof(hidl_string, mBuffer);
 
 
+// ----------------------------------------------------------------------
+// HidlInstrumentor implementation.
+HidlInstrumentor::HidlInstrumentor(const std::string &prefix) {
+    mEnableInstrumentation = property_get_bool("hal.instrumentation.enable",
+                                               false);
+    registerInstrumentationCallbacks(prefix, &mInstrumentationCallbacks);
+}
 
-void registerInstrumentationCallbacks(
+HidlInstrumentor:: ~HidlInstrumentor() {}
+
+void HidlInstrumentor::registerInstrumentationCallbacks(
         const std::string &profilerPrefix,
         std::vector<InstrumentationCallback> *instrumentationCallbacks) {
 #ifdef LIBHIDL_TARGET_DEBUGGABLE
@@ -177,7 +186,7 @@
 #endif
 }
 
-bool isInstrumentationLib(
+bool HidlInstrumentor::isInstrumentationLib(
         const std::string &profiler_prefix,
         const dirent *file) {
 #ifdef LIBHIDL_TARGET_DEBUGGABLE