8#ifndef INCLUDED_BALM_METRICS
9#define INCLUDED_BALM_METRICS
545#include <balscm_version.h>
565#define BALM_METRICS_IF_CATEGORY_ENABLED(CATEGORY) \
566 BALM_METRICS_IF_CATEGORY_ENABLED_IMP( \
567 CATEGORY, BALM_METRICS_UNIQUE_NAME(categoryHolder))
575#define BALM_METRICS_UPDATE(CATEGORY, METRIC1, VALUE1) do { \
576 using namespace BloombergLP; \
577 typedef balm::Metrics_Helper Helper; \
578 static balm::CategoryHolder holder = { false, 0, 0 }; \
579 static balm::Collector *collector1 = 0; \
580 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
581 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
582 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
583 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
584 Helper::initializeCategoryHolder(&holder, CATEGORY); \
586 if (holder.enabled()) { \
587 collector1->update(VALUE1); \
591#define BALM_METRICS_UPDATE2(CATEGORY, METRIC1, VALUE1, METRIC2, VALUE2) do { \
592 using namespace BloombergLP; \
593 typedef balm::Metrics_Helper Helper; \
594 static balm::CategoryHolder holder = { false, 0, 0 }; \
595 static balm::Collector *collector1 = 0; \
596 static balm::Collector *collector2 = 0; \
597 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
598 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
599 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
600 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
601 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
602 collector2 = Helper::getCollector(CATEGORY, METRIC2); \
603 Helper::initializeCategoryHolder(&holder, CATEGORY); \
605 if (holder.enabled()) { \
606 collector1->update(VALUE1); \
607 collector2->update(VALUE2); \
611#define BALM_METRICS_UPDATE3(CATEGORY, \
618 using namespace BloombergLP; \
619 typedef balm::Metrics_Helper Helper; \
620 static balm::CategoryHolder holder = { false, 0, 0 }; \
621 static balm::Collector *collector1 = 0; \
622 static balm::Collector *collector2 = 0; \
623 static balm::Collector *collector3 = 0; \
624 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
625 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
626 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
627 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
628 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
629 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
630 collector2 = Helper::getCollector(CATEGORY, METRIC2); \
631 collector3 = Helper::getCollector(CATEGORY, METRIC3); \
632 Helper::initializeCategoryHolder(&holder, CATEGORY); \
634 if (holder.enabled()) { \
635 collector1->update(VALUE1); \
636 collector2->update(VALUE2); \
637 collector3->update(VALUE3); \
641#define BALM_METRICS_UPDATE4(CATEGORY, \
650 using namespace BloombergLP; \
651 typedef balm::Metrics_Helper Helper; \
652 static balm::CategoryHolder holder = { false, 0, 0 }; \
653 static balm::Collector *collector1 = 0; \
654 static balm::Collector *collector2 = 0; \
655 static balm::Collector *collector3 = 0; \
656 static balm::Collector *collector4 = 0; \
657 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
658 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
659 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
660 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
661 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
662 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
663 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
664 collector2 = Helper::getCollector(CATEGORY, METRIC2); \
665 collector3 = Helper::getCollector(CATEGORY, METRIC3); \
666 collector4 = Helper::getCollector(CATEGORY, METRIC4); \
667 Helper::initializeCategoryHolder(&holder, CATEGORY); \
669 if (holder.enabled()) { \
670 collector1->update(VALUE1); \
671 collector2->update(VALUE2); \
672 collector3->update(VALUE3); \
673 collector4->update(VALUE4); \
677#define BALM_METRICS_UPDATE5(CATEGORY, \
688 using namespace BloombergLP; \
689 typedef balm::Metrics_Helper Helper; \
690 static balm::CategoryHolder holder = { false, 0, 0 }; \
691 static balm::Collector *collector1 = 0; \
692 static balm::Collector *collector2 = 0; \
693 static balm::Collector *collector3 = 0; \
694 static balm::Collector *collector4 = 0; \
695 static balm::Collector *collector5 = 0; \
696 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
697 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
698 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
699 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
700 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
701 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
702 Helper::logEmptyName(METRIC5, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
703 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
704 collector2 = Helper::getCollector(CATEGORY, METRIC2); \
705 collector3 = Helper::getCollector(CATEGORY, METRIC3); \
706 collector4 = Helper::getCollector(CATEGORY, METRIC4); \
707 collector5 = Helper::getCollector(CATEGORY, METRIC5); \
708 Helper::initializeCategoryHolder(&holder, CATEGORY); \
710 if (holder.enabled()) { \
711 collector1->update(VALUE1); \
712 collector2->update(VALUE2); \
713 collector3->update(VALUE3); \
714 collector4->update(VALUE4); \
715 collector5->update(VALUE5); \
719#define BALM_METRICS_UPDATE6(CATEGORY, \
732 using namespace BloombergLP; \
733 typedef balm::Metrics_Helper Helper; \
734 static balm::CategoryHolder holder = { false, 0, 0 }; \
735 static balm::Collector *collector1 = 0; \
736 static balm::Collector *collector2 = 0; \
737 static balm::Collector *collector3 = 0; \
738 static balm::Collector *collector4 = 0; \
739 static balm::Collector *collector5 = 0; \
740 static balm::Collector *collector6 = 0; \
741 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
742 Helper::logEmptyName(CATEGORY, Helper::e_TYPE_CATEGORY, \
743 __FILE__, __LINE__); \
744 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
745 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
746 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
747 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
748 Helper::logEmptyName(METRIC5, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
749 Helper::logEmptyName(METRIC6, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
750 collector1 = Helper::getCollector(CATEGORY, METRIC1); \
751 collector2 = Helper::getCollector(CATEGORY, METRIC2); \
752 collector3 = Helper::getCollector(CATEGORY, METRIC3); \
753 collector4 = Helper::getCollector(CATEGORY, METRIC4); \
754 collector5 = Helper::getCollector(CATEGORY, METRIC5); \
755 collector6 = Helper::getCollector(CATEGORY, METRIC6); \
756 Helper::initializeCategoryHolder(&holder, CATEGORY); \
758 if (holder.enabled()) { \
759 collector1->update(VALUE1); \
760 collector2->update(VALUE2); \
761 collector3->update(VALUE3); \
762 collector4->update(VALUE4); \
763 collector5->update(VALUE5); \
764 collector6->update(VALUE6); \
768#define BALM_METRICS_TYPED_UPDATE(CATEGORY, METRIC, VALUE, PREFERRED_TYPE) \
770 using namespace BloombergLP; \
771 typedef balm::Metrics_Helper Helper; \
772 static balm::CategoryHolder holder = { false, 0, 0 }; \
773 static balm::Collector *collector1 = 0; \
774 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
775 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
776 Helper::logEmptyName(METRIC, Helper::e_TYPE_METRIC, __FILE__, __LINE__); \
777 collector1 = Helper::getCollector(CATEGORY, METRIC); \
778 Helper::setPublicationType(collector1->metricId(), PREFERRED_TYPE); \
779 Helper::initializeCategoryHolder(&holder, CATEGORY); \
781 if (holder.enabled()) { \
782 collector1->update(VALUE); \
786#define BALM_METRICS_DYNAMIC_UPDATE(CATEGORY, METRIC, VALUE) do { \
787 using namespace BloombergLP; \
788 if (balm::DefaultMetricsManager::instance()) { \
789 balm::CollectorRepository& repository = \
790 balm::DefaultMetricsManager::instance()->collectorRepository(); \
791 balm::Collector *collector = repository.getDefaultCollector( \
792 (CATEGORY), (METRIC));\
793 if (collector->metricId().category()->enabled()) { \
794 collector->update((VALUE)); \
803#define BALM_METRICS_INT_UPDATE(CATEGORY, METRIC1, VALUE1) do { \
804 using namespace BloombergLP; \
805 typedef balm::Metrics_Helper Helper; \
806 static balm::CategoryHolder holder = { false, 0, 0 }; \
807 static balm::IntegerCollector *collector1 = 0; \
808 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
809 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
810 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
811 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
812 Helper::initializeCategoryHolder(&holder, CATEGORY); \
814 if (holder.enabled()) { \
815 collector1->update(VALUE1); \
819#define BALM_METRICS_INT_UPDATE2(CATEGORY, \
824 using namespace BloombergLP; \
825 typedef balm::Metrics_Helper Helper; \
826 static balm::CategoryHolder holder = { false, 0, 0 }; \
827 static balm::IntegerCollector *collector1 = 0; \
828 static balm::IntegerCollector *collector2 = 0; \
829 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
830 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
831 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
832 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
833 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
834 collector2 = Helper::getIntegerCollector(CATEGORY, METRIC2); \
835 Helper::initializeCategoryHolder(&holder, CATEGORY); \
837 if (holder.enabled()) { \
838 collector1->update(VALUE1); \
839 collector2->update(VALUE2); \
843#define BALM_METRICS_INT_UPDATE3(CATEGORY, \
850 using namespace BloombergLP; \
851 typedef balm::Metrics_Helper Helper; \
852 static balm::CategoryHolder holder = { false, 0, 0 }; \
853 static balm::IntegerCollector *collector1 = 0; \
854 static balm::IntegerCollector *collector2 = 0; \
855 static balm::IntegerCollector *collector3 = 0; \
856 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
857 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
858 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
859 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
860 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
861 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
862 collector2 = Helper::getIntegerCollector(CATEGORY, METRIC2); \
863 collector3 = Helper::getIntegerCollector(CATEGORY, METRIC3); \
864 Helper::initializeCategoryHolder(&holder, CATEGORY); \
866 if (holder.enabled()) { \
867 collector1->update(VALUE1); \
868 collector2->update(VALUE2); \
869 collector3->update(VALUE3); \
873#define BALM_METRICS_INT_UPDATE4(CATEGORY, \
882 using namespace BloombergLP; \
883 typedef balm::Metrics_Helper Helper; \
884 static balm::CategoryHolder holder = { false, 0, 0 }; \
885 static balm::IntegerCollector *collector1 = 0; \
886 static balm::IntegerCollector *collector2 = 0; \
887 static balm::IntegerCollector *collector3 = 0; \
888 static balm::IntegerCollector *collector4 = 0; \
889 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
890 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
891 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
892 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
893 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
894 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
895 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
896 collector2 = Helper::getIntegerCollector(CATEGORY, METRIC2); \
897 collector3 = Helper::getIntegerCollector(CATEGORY, METRIC3); \
898 collector4 = Helper::getIntegerCollector(CATEGORY, METRIC4); \
899 Helper::initializeCategoryHolder(&holder, CATEGORY); \
901 if (holder.enabled()) { \
902 collector1->update(VALUE1); \
903 collector2->update(VALUE2); \
904 collector3->update(VALUE3); \
905 collector4->update(VALUE4); \
909#define BALM_METRICS_INT_UPDATE5(CATEGORY, \
920 using namespace BloombergLP; \
921 typedef balm::Metrics_Helper Helper; \
922 static balm::CategoryHolder holder = { false, 0, 0 }; \
923 static balm::IntegerCollector *collector1 = 0; \
924 static balm::IntegerCollector *collector2 = 0; \
925 static balm::IntegerCollector *collector3 = 0; \
926 static balm::IntegerCollector *collector4 = 0; \
927 static balm::IntegerCollector *collector5 = 0; \
928 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
929 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
930 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
931 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
932 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
933 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
934 Helper::logEmptyName(METRIC5, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
935 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
936 collector2 = Helper::getIntegerCollector(CATEGORY, METRIC2); \
937 collector3 = Helper::getIntegerCollector(CATEGORY, METRIC3); \
938 collector4 = Helper::getIntegerCollector(CATEGORY, METRIC4); \
939 collector5 = Helper::getIntegerCollector(CATEGORY, METRIC5); \
940 Helper::initializeCategoryHolder(&holder, CATEGORY); \
942 if (holder.enabled()) { \
943 collector1->update(VALUE1); \
944 collector2->update(VALUE2); \
945 collector3->update(VALUE3); \
946 collector4->update(VALUE4); \
947 collector5->update(VALUE5); \
951#define BALM_METRICS_INT_UPDATE6(CATEGORY, \
964 using namespace BloombergLP; \
965 typedef balm::Metrics_Helper Helper; \
966 static balm::CategoryHolder holder = { false, 0, 0 }; \
967 static balm::IntegerCollector *collector1 = 0; \
968 static balm::IntegerCollector *collector2 = 0; \
969 static balm::IntegerCollector *collector3 = 0; \
970 static balm::IntegerCollector *collector4 = 0; \
971 static balm::IntegerCollector *collector5 = 0; \
972 static balm::IntegerCollector *collector6 = 0; \
973 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
974 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
975 Helper::logEmptyName(METRIC1, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
976 Helper::logEmptyName(METRIC2, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
977 Helper::logEmptyName(METRIC3, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
978 Helper::logEmptyName(METRIC4, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
979 Helper::logEmptyName(METRIC5, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
980 Helper::logEmptyName(METRIC6, Helper::e_TYPE_METRIC, __FILE__, __LINE__);\
981 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC1); \
982 collector2 = Helper::getIntegerCollector(CATEGORY, METRIC2); \
983 collector3 = Helper::getIntegerCollector(CATEGORY, METRIC3); \
984 collector4 = Helper::getIntegerCollector(CATEGORY, METRIC4); \
985 collector5 = Helper::getIntegerCollector(CATEGORY, METRIC5); \
986 collector6 = Helper::getIntegerCollector(CATEGORY, METRIC6); \
987 Helper::initializeCategoryHolder(&holder, CATEGORY); \
989 if (holder.enabled()) { \
990 collector1->update(VALUE1); \
991 collector2->update(VALUE2); \
992 collector3->update(VALUE3); \
993 collector4->update(VALUE4); \
994 collector5->update(VALUE5); \
995 collector6->update(VALUE6); \
999#define BALM_METRICS_TYPED_INT_UPDATE(CATEGORY, \
1004 using namespace BloombergLP; \
1005 typedef balm::Metrics_Helper Helper; \
1006 static balm::CategoryHolder holder = { false, 0, 0 }; \
1007 static balm::IntegerCollector *collector1 = 0; \
1008 if (0 == holder.category() && balm::DefaultMetricsManager::instance()) { \
1009 Helper::logEmptyName(CATEGORY,Helper::e_TYPE_CATEGORY,__FILE__,__LINE__);\
1010 Helper::logEmptyName(METRIC, Helper::e_TYPE_METRIC, __FILE__, __LINE__); \
1011 collector1 = Helper::getIntegerCollector(CATEGORY, METRIC); \
1012 Helper::setPublicationType(collector1->metricId(), PREFERRED_TYPE); \
1013 Helper::initializeCategoryHolder(&holder, CATEGORY); \
1015 if (holder.enabled()) { \
1016 collector1->update(VALUE); \
1020#define BALM_METRICS_DYNAMIC_INT_UPDATE(CATEGORY, METRIC, VALUE) do { \
1021 using namespace BloombergLP; \
1022 if (balm::DefaultMetricsManager::instance()) { \
1023 balm::CollectorRepository& repository = \
1024 balm::DefaultMetricsManager::instance()->collectorRepository(); \
1025 balm::IntegerCollector *collector = \
1026 repository.getDefaultIntegerCollector((CATEGORY), (METRIC)); \
1027 if (collector->metricId().category()->enabled()) { \
1028 collector->update((VALUE)); \
1033#define BALM_METRICS_INCREMENT(CATEGORY, METRIC) \
1034 BALM_METRICS_INT_UPDATE(CATEGORY, METRIC, 1)
1036#define BALM_METRICS_TYPED_INCREMENT(CATEGORY, METRIC, PREFERRED_TYPE) \
1037 BALM_METRICS_TYPED_INT_UPDATE(CATEGORY, METRIC, 1, PREFERRED_TYPE)
1039#define BALM_METRICS_DYNAMIC_INCREMENT(CATEGORY, METRIC) \
1040 BALM_METRICS_DYNAMIC_INT_UPDATE(CATEGORY, METRIC, 1)
1046#define BALM_METRICS_TIME_BLOCK(CATEGORY, METRIC, TIME_UNITS) \
1047 BALM_METRICS_TIME_BLOCK_IMP((CATEGORY), \
1050 BALM_METRICS_UNIQUE_NAME(_bAlM_CoLlEcToR))
1052#define BALM_METRICS_DYNAMIC_TIME_BLOCK(CATEGORY, METRIC, TIME_UNITS) \
1053 BALM_METRICS_DYNAMIC_TIME_BLOCK_IMP( \
1057 BALM_METRICS_UNIQUE_NAME(_bAlM_CoLlEcToR))
1059#define BALM_METRICS_TIME_BLOCK_SECONDS(CATEGORY, METRIC) \
1060 BALM_METRICS_TIME_BLOCK((CATEGORY), \
1062 BloombergLP::balm::StopwatchScopedGuard::k_SECONDS);
1064#define BALM_METRICS_TIME_BLOCK_MILLISECONDS(CATEGORY, METRIC) \
1065 BALM_METRICS_TIME_BLOCK( \
1068 BloombergLP::balm::StopwatchScopedGuard::k_MILLISECONDS);
1070#define BALM_METRICS_TIME_BLOCK_MICROSECONDS(CATEGORY, METRIC) \
1071 BALM_METRICS_TIME_BLOCK( \
1074 BloombergLP::balm::StopwatchScopedGuard::k_MICROSECONDS);
1076#define BALM_METRICS_TIME_BLOCK_NANOSECONDS(CATEGORY, METRIC) \
1077 BALM_METRICS_TIME_BLOCK( \
1080 BloombergLP::balm::StopwatchScopedGuard::k_NANOSECONDS);
1082#define BALM_METRICS_DYNAMIC_TIME_BLOCK_SECONDS(CATEGORY, METRIC) \
1083 BALM_METRICS_DYNAMIC_TIME_BLOCK( \
1086 BloombergLP::balm::StopwatchScopedGuard::k_SECONDS);
1088#define BALM_METRICS_DYNAMIC_TIME_BLOCK_MILLISECONDS(CATEGORY, METRIC) \
1089 BALM_METRICS_DYNAMIC_TIME_BLOCK( \
1092 BloombergLP::balm::StopwatchScopedGuard::k_MILLISECONDS);
1094#define BALM_METRICS_DYNAMIC_TIME_BLOCK_MICROSECONDS(CATEGORY, METRIC) \
1095 BALM_METRICS_DYNAMIC_TIME_BLOCK( \
1098 BloombergLP::balm::StopwatchScopedGuard::k_MICROSECONDS);
1100#define BALM_METRICS_DYNAMIC_TIME_BLOCK_NANOSECONDS(CATEGORY, METRIC) \
1101 BALM_METRICS_DYNAMIC_TIME_BLOCK( \
1104 BloombergLP::balm::StopwatchScopedGuard::k_NANOSECONDS);
1110#define BALM_METRICS_IF_CATEGORY_ENABLED_IMP(CATEGORY, HOLDER_NAME) \
1111 static BloombergLP::balm::CategoryHolder HOLDER_NAME = { false, 0, 0 }; \
1112 if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!HOLDER_NAME.category()) \
1113 && BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( \
1114 BloombergLP::balm::DefaultMetricsManager::instance() != 0)) {\
1115 BloombergLP::balm::Metrics_Helper::initializeCategoryHolder( \
1116 &HOLDER_NAME, CATEGORY); \
1118 if (HOLDER_NAME.enabled())
1127#define BALM_METRICS_TIME_BLOCK_IMP(CATEGORY, \
1131 static BloombergLP::balm::Collector *VARIABLE_NAME = 0; \
1132 if (BloombergLP::balm::DefaultMetricsManager::instance()) { \
1133 using namespace BloombergLP; \
1134 typedef balm::Metrics_Helper Helper; \
1135 static balm::CategoryHolder holder = { false, 0, 0 }; \
1136 if (0 == holder.category()) { \
1137 balm::CollectorRepository& repository = \
1138 balm::DefaultMetricsManager::instance()->collectorRepository(); \
1139 VARIABLE_NAME = repository.getDefaultCollector((CATEGORY), \
1141 Helper::initializeCategoryHolder(&holder, CATEGORY); \
1145 VARIABLE_NAME = 0; \
1147 BloombergLP::balm::StopwatchScopedGuard \
1148 BALM_METRICS_UNIQUE_NAME(__bAlM_gUaRd)(VARIABLE_NAME, TIME_UNITS);
1157#define BALM_METRICS_DYNAMIC_TIME_BLOCK_IMP(CATEGORY, \
1161 BloombergLP::balm::Collector *VARIABLE_NAME = 0; \
1162 if (BloombergLP::balm::DefaultMetricsManager::instance()) { \
1163 using namespace BloombergLP; \
1164 balm::CollectorRepository& repository = \
1165 balm::DefaultMetricsManager::instance()->collectorRepository(); \
1166 VARIABLE_NAME = repository.getDefaultCollector((CATEGORY), \
1169 BloombergLP::balm::StopwatchScopedGuard \
1170 BALM_METRICS_UNIQUE_NAME(__bAlM_gUaRd)(VARIABLE_NAME, TIME_UNITS);
1176#if defined(BSLS_PLATFORM_CMP_MSVC)
1179# define BALM_METRICS_UNIQNUM __COUNTER__
1181# define BALM_METRICS_UNIQNUM __LINE__
1190#define BALM_METRICS_CAT(X, Y) BALM_METRICS_CAT_IMP(X, Y)
1191#define BALM_METRICS_CAT_IMP(X, Y) X##Y
1199#define BALM_METRICS_UNIQUE_NAME(X) \
1200 BALM_METRICS_CAT(X, BALM_METRICS_UNIQNUM)
1223#ifndef BDE_OMIT_INTERNAL_DEPRECATED
1236 const char *category);
1243 const char *metric);
1250 const char *metric);
1281 const char *category)
1318#if !defined(BSL_DOUBLE_UNDERSCORE_XLAT) || 1 == BSL_DOUBLE_UNDERSCORE_XLAT
1319#define BALM_METRICS__UNIQUE_NAME(X) BALM_METRICS_UNIQUE_NAME(X)
Definition balm_category.h:257
IntegerCollector * getDefaultIntegerCollector(const char *category, const char *metricName)
Definition balm_collectorrepository.h:444
Collector * getDefaultCollector(const char *category, const char *metricName)
Definition balm_collectorrepository.h:437
Definition balm_collector.h:152
Definition balm_integercollector.h:151
Definition balm_metricid.h:162
Definition balm_metricregistry.h:180
const Category * getCategory(const char *category)
void setPreferredPublicationType(const MetricId &metric, PublicationType::Value type)
void registerCategoryHolder(const Category *category, CategoryHolder *holder)
Definition balm_metricsmanager.h:490
CollectorRepository & collectorRepository()
Definition balm_metricsmanager.h:1013
MetricRegistry & metricRegistry()
Definition balm_metricsmanager.h:1019
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition balm_bdlmmetricsadapter.h:141
static MetricsManager * instance()
Definition balm_defaultmetricsmanager.h:296
Definition balm_metrics.h:1214
static void logEmptyName(const char *name, NameType type, const char *file, int line)
static void setPublicationType(const MetricId &id, PublicationType::Value type)
Definition balm_metrics.h:1307
static Collector * getCollector(const char *category, const char *metric)
Definition balm_metrics.h:1289
NameType
Definition balm_metrics.h:1217
@ e_TYPE_CATEGORY
Definition balm_metrics.h:1221
@ e_TYPE_METRIC
Definition balm_metrics.h:1222
@ TYPE_CATEGORY
Definition balm_metrics.h:1224
@ TYPE_METRIC
Definition balm_metrics.h:1225
static void initializeCategoryHolder(CategoryHolder *holder, const char *category)
Definition balm_metrics.h:1280
static IntegerCollector * getIntegerCollector(const char *category, const char *metric)
Definition balm_metrics.h:1298
Value
Definition balm_publicationtype.h:81