DiagnosticUtils.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef _DIAGNOSTIC_UTILS_H_
00004 #define _DIAGNOSTIC_UTILS_H_
00005 
00006 #include <string>
00007 #include <vector>
00008 
00009 #include <stdint.h>
00010 
00011 namespace fesa
00012 {
00013 
00014 namespace DiagnosticUtils
00015 {
00016 
00017 const std::string fwkDiagLoggerNamePrefix = "FESA.DIAG.FWK.";
00018 const std::string userDiagLoggerNamePrefix = "FESA.DIAG.USR.";
00019 
00020 // const std::string topicNames[] = {
00021 //     "GetActionProfiling",
00022 //     "SetActionProfiling",
00023 //     "RTActionProfiling",
00024 //     "EventProfiling",
00025 //     "NotificationProfiling",
00026 //     "GetActionTracking",
00027 //     "SetActionTracking",
00028 //     "RTActionTracking",
00029 //     "EventTracking",
00030 //     "NotificationTracking",
00031 //     "PersistencyTracking",
00032 //     "TransactionTracking",
00033 //     "SubscriptionTracking",
00034 //     "SignalHandlerTracking",
00035 //     "RDATracking",
00036 //     "StartUpTracking"
00037 // };
00038 
00039 const std::string getActionProfilingStr = "GetActionProfiling";
00040 const std::string setActionProfilingStr = "SetActionProfiling";
00041 const std::string rtActionProfilingStr = "RTActionProfiling";
00042 const std::string eventProfilingStr = "EventProfiling";
00043 const std::string notificationProfilingStr = "NotificationProfiling";
00044 const std::string getActionTrackingStr = "GetActionTracking";
00045 const std::string setActionTrackingStr = "SetActionTracking";
00046 const std::string rtActionTrackingStr = "RTActionTracking";
00047 const std::string eventTrackingStr = "EventTracking";
00048 const std::string notificationTrackingStr = "NotificationTracking";
00049 const std::string persistencyTrackingStr = "PersistencyTracking";
00050 const std::string transactionTrackingStr = "TransactionTracking";
00051 const std::string subscriptionTrackingStr = "SubscriptionTracking";
00052 const std::string signalHandlerTrackingStr = "SignalHandlerTracking";
00053 const std::string rdaTrackingStr = "RDATracking";
00054 const std::string startUpTrackingStr = "StartUpTracking";
00055 
00061 typedef std::vector<std::pair<int, std::string> > DiagnosticTopics;
00062 
00063 
00067 struct DiagStateCounter
00068 {
00069     uint32_t last_;
00070     uint32_t current_;
00071     uint32_t max_;
00072 };
00073 
00077 enum State
00078 {
00079     initDiag = 1 << 0,
00080     startDiag = 1 << 1,
00081     stopDiag = 1 << 2,
00082     requestState = 1 << 3,
00083     updateFwkTopic = 1 << 4,
00084     updateCustomTopic = 1 << 5,
00085     updateTsPeriod = 1 << 6
00086 };
00087 
00091 enum FrameworkTopic
00092 {
00093     getActionProfiling = 1 << 0,
00094     setActionProfiling = 1 << 1,
00095     rtActionProfiling = 1 << 2,
00096     eventProfiling = 1 << 3,
00097     notificationProfiling = 1 << 4,
00098     getActionTracking = 1 << 5,
00099     setActionTracking = 1 << 6,
00100     rtActionTracking = 1 << 7,
00101     eventTracking = 1 << 8,
00102     notificationTracking = 1 << 9,
00103     persistencyTracking = 1 << 10,
00104     transactionTracking = 1 << 11,
00105     subscriptionTracking = 1 << 12,
00106     signalHandlerTracking = 1 << 13,
00107     rdaTracking = 1 << 14,
00108     startUpTracking = 1 << 15
00109 };
00110 
00114 enum Side
00115 {
00116     framework = 0,
00117     user = 1,
00118 };
00119 
00125 enum Action
00126 {
00127     undefined = 0,
00128     start = 1,
00129     stop = 2
00130 };
00131 
00135 enum Source
00136 {
00137     main = 0,
00138     rt = 1,
00139     server = 2,
00140     event = 3,
00141     notification = 4
00142 };
00143 
00147 struct DiagnosticMessage
00148 {
00149     Side side;
00150     std::string type;
00151     Source source;
00152     std::string fesaClass;
00153     std::string thread;
00154     int64_t count;
00155     std::string name;
00156     Action action;
00157     std::string msg;
00158 
00159     DiagnosticMessage() :
00160         side(framework),
00161         type("TRACE"),
00162         source(main),
00163         fesaClass(""),
00164         thread(""),
00165         count(0),
00166         name(""),
00167         action(undefined),
00168         msg("")
00169     {
00170     }
00171 };
00172 
00178 std::string convertFwkTopicToString(FrameworkTopic topic);
00179 
00185 std::string convertActionToString(Action action);
00186 
00192 std::string convertSideToString(Side side);
00193 
00199 std::string convertSourceToString(Source source);
00200 
00206 std::string formatMessage(const DiagnosticMessage& diagMsg);
00207 
00208 } // DiagnosticUtils
00209 
00210 } // fesa
00211 
00212 #endif // _DIAGNOSTIC_UTILS_H

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1