You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@orc.apache.org by GitBox <gi...@apache.org> on 2022/08/03 14:47:14 UTC

[GitHub] [orc] wgtmac commented on a diff in pull request #1206: ORC-1232:[C++] disable the metrics collector at compile phase

wgtmac commented on code in PR #1206:
URL: https://github.com/apache/orc/pull/1206#discussion_r936755932


##########
c++/src/Utils.hh:
##########
@@ -60,16 +60,27 @@ public:
   }
 };
 
-#define SCOPED_STOPWATCH(METRICS_PTR, LATENCY_VAR, COUNT_VAR)         \
-  AutoStopwatch measure(                                              \
-    (METRICS_PTR == nullptr ? nullptr : &METRICS_PTR->LATENCY_VAR),   \
+#if ENABLE_METRICS
+#define SCOPED_STOPWATCH(METRICS_PTR, LATENCY_VAR, COUNT_VAR)               \
+  AutoStopwatch measure(                                                    \
+    (METRICS_PTR == nullptr ? nullptr : &METRICS_PTR->LATENCY_VAR),         \
     (METRICS_PTR == nullptr ? nullptr : &METRICS_PTR->COUNT_VAR))
 
-#define SCOPED_MINUS_STOPWATCH(METRICS_PTR, LATENCY_VAR)              \
-  AutoStopwatch measure(                                              \
-    (METRICS_PTR == nullptr ? nullptr : &METRICS_PTR->LATENCY_VAR),   \
+#define SCOPED_MINUS_STOPWATCH(METRICS_PTR, LATENCY_VAR)                    \
+  AutoStopwatch measure(                                                    \
+    (METRICS_PTR == nullptr ? nullptr : &METRICS_PTR->LATENCY_VAR),         \
     nullptr, true)
+#else
+#define SCOPED_STOPWATCH(METRICS_PTR, LATENCY_VAR, COUNT_VAR)               \

Review Comment:
   If we define the macro as below, the change would be trivial. We can always assign metrics to getDefaultReaderMetrics() and it will not get updated if the macro is disabled.
   
   `#define SCOPED_STOPWATCH(METRICS_PTR, LATENCY_VAR, COUNT_VAR) `
   `#define SCOPED_MINUS_STOPWATCH(METRICS_PTR, LATENCY_VAR)`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org