Logging.h
Go to the documentation of this file.
00001 /* 
00002  * File:   Logging.h
00003  * Author: cwioro
00004  *
00005  * Created on August 8, 2014, 10:35 AM
00006  */
00007 
00008 #ifndef LOGGING_H
00009 #define LOGGING_H
00010 
00011 #include "Logging.h"
00012 #include "ros/ros.h"
00013 #include "structs.h"
00014 #include "functions.h"
00015 #include <boost/filesystem.hpp>
00016 
00017 class Logging
00018 {
00019     
00020 
00021 public:
00022     Logging();
00023     Logging(const Logging& orig);
00024     static void init(ros::NodeHandle* n, std::string* robot_name);
00025 
00026     static void log();
00027     static bool createLogPath();
00028     static void periodicLog(unsigned long interval_ms);
00029     static void logServiceCalls(string service_name, unsigned long time_call, unsigned long time_res, unsigned long size, bool ret_val);
00030     static void logUcPacketsSummary(unsigned long interval_ms);
00031     static void logMcPacketsSummary(unsigned long interval_ms);
00032     static void logMemoryConsumptionPackets(unsigned long interval_ms, boost::mutex* mtx_pack, list<Packet>* packets, boost::mutex* mtx_cached_mc, list<Packet>* cached_mc, boost::mutex* mtx_unack_link_frames, list<stc_frame>* unack_link_frames, boost::mutex* mtx_unack_cr_frames, list<ack_cr_info>* unack_cr_frames);
00033     static void logRoutingTable(std::list<routing_entry>* u_entries, std::list<McTree*>* m_entries);
00034     static void logRRequestInitiater(route_request* req, routing_entry* route);
00035     static void logRRequestIntermediate(RouteRequest* r);
00036     static void logTransportFrame(stc_RoutedFrame* f, routing_entry* route, unsigned long start_time, unsigned long end_time, bool success);
00037     static void logUcLinkTransmission(stc_frame f);
00038     static void logRRequestReceiver(std::string h_src, uint32_t id, uint16_t counter, uint16_t hobs, bool selected, std::list<mac> path_l);
00039     // static void logRouteRequestReceiverUpdate(RouteResponse* res);
00040     static void createLogFile(std::list<std::string>* table, std::string* filename);
00041     static void safeLogs();
00042 
00043     static uint32_t getProperty(std::string prog_name);
00044     static void increaseProperty(std::string prop_name);
00045     static void increaseProperty(std::string prop_name, uint32_t value);
00046     static void decreaseProperty(std::string prop_name);
00047     static void decreaseProperty(std::string prop_name, uint32_t value);
00048 
00049     static ros::NodeHandle* n;
00050     //  static uint32_t running_unicast_cr_threads, running_multicast_threads, running_unicast_transport_threads, running_unicast_link_threads; // running threads   
00051     static boost::mutex mtx_logging;
00052 
00053     static std::map<std::string, uint32_t> uint32_properties;
00054 
00055 
00056 
00057     static std::list<std::string> entries_r_table, entries_rreq_initi, entries_rreq_recv, entries_rreq_interm, entries_mem_consumption, entries_uc_frames, entries_mc_frames, entries_link_frames, entries_service_calls, entries_transport_frames;
00058     static std::string log_path, routing_table_file, route_req_src_file, route_req_dst_file, route_req_iterm_file, mem_consumption_file, uc_frames_file, mc_frames_file, link_frames_file, sercice_calls_file, transport_frames_file;
00059     static std::string* robot_name;
00060 
00061 
00062     virtual ~Logging();
00063 private:
00064     static bool removeRouteRequestReceiver(RouteResponse* res);
00065 
00066 };
00067 ros::NodeHandle* Logging::n = NULL;
00068 std::list<std::string> Logging::entries_r_table;
00069 std::list<std::string> Logging::entries_rreq_initi;
00070 std::list<std::string> Logging::entries_rreq_interm;
00071 std::list<std::string> Logging::entries_rreq_recv;
00072 std::list<std::string> Logging::entries_mem_consumption;
00073 std::list<std::string> Logging::entries_uc_frames;
00074 std::list<std::string> Logging::entries_mc_frames;
00075 std::list<std::string> Logging::entries_link_frames;
00076 std::list<std::string> Logging::entries_service_calls;
00077 std::list<std::string> Logging::entries_transport_frames;
00078 
00079 
00080 std::map<std::string, uint32_t> Logging::uint32_properties;
00081 
00082 std::string Logging::log_path = "";
00083 std::string* Logging::robot_name = NULL;
00084 
00085 std::string Logging::routing_table_file = "routing_table.csv";
00086 std::string Logging::route_req_src_file = "rreq_initiater.csv";
00087 std::string Logging::route_req_dst_file = "rreq_receiver.csv";
00088 std::string Logging::route_req_iterm_file = "rreq_intermediate.csv";
00089 std::string Logging::mem_consumption_file = "packet_memory_consumption.csv";
00090 std::string Logging::uc_frames_file = "unicast_datalink_transmission_summary.csv";
00091 std::string Logging::mc_frames_file = "multicast.csv";
00092 std::string Logging::link_frames_file = "unicast_link_transmission.csv";
00093 std::string Logging::sercice_calls_file = "services.csv";
00094 std::string Logging::transport_frames_file = "transport_frames.csv";
00095 
00096 /* 
00097 uint32_t Logging::running_unicast_cr_threads = 0;
00098 uint32_t Logging::running_multicast_threads = 0;
00099 uint32_t Logging::running_unicast_transport_threads = 0;
00100 uint32_t Logging::running_unicast_link_threads = 0;
00101 
00102 unicast frames sent 
00103 uint32_t Logging::num_unique_data_frames_sent = 0;
00104 uint32_t Logging::num_unique_data_frames_forwarded = 0;
00105 uint32_t Logging::num_data_frames_resent = 0;
00106 uint32_t Logging::num_data_frames_reforwarded = 0;
00107 uint32_t Logging::num_data_frames_relayed = 0;
00108 uint32_t Logging::num_acknowledgments_sent = 0;
00109 uint32_t Logging::num_acknowledgments_relayed = 0;
00110 uint32_t Logging::num_rreq_sent = 0;
00111 uint32_t Logging::num_rrep_sent = 0;
00112 uint32_t Logging::num_beacons_sent = 0;
00113 uint32_t Logging::num_relay_selection_sent = 0;
00114 uint32_t Logging::num_relay_detection_sent = 0;
00115 uint32_t Logging::num_total_frames_sent = 0;
00116 
00117 
00118 /* unicast received sent 
00119 uint32_t Logging::num_unique_data_frames_received_directly = 0;
00120 uint32_t Logging::num_unique_data_frames_received_relay = 0;
00121 uint32_t Logging::num_data_frames_received_directly = 0;
00122 uint32_t Logging::num_data_frames_received_relay = 0;
00123 uint32_t Logging::num_acknowledgments_received_directly = 0;
00124 uint32_t Logging::num_acknowledgments_received_relay = 0;
00125 uint32_t Logging::num_rreq_received = 0;
00126 uint32_t Logging::num_rrep_received = 0;
00127 uint32_t Logging::num_relay_selection_received = 0;
00128 uint32_t Logging::num_relay_detection_received = 0;
00129 uint32_t Logging::num_duplicate_frames_received = 0;
00130 uint32_t Logging::num_beacons_received = 0;
00131 uint32_t Logging::num_total_frames_received = 0;
00132 
00133 uint32_t Logging::num_total_bytes_sent = 0;
00134 uint32_t Logging::num_total_bytes_received = 0;
00135 
00136 /* mc frames sent 
00137 uint32_t Logging::num_mc_unique_data_frames_sent = 0;
00138 uint32_t Logging::num_mc_unique_data_frames_forwarded = 0;
00139 uint32_t Logging::num_mc_data_frames_resent = 0;
00140 uint32_t Logging::num_mc_data_frames_reforwarded = 0;
00141 uint32_t Logging::num_mc_data_frames_relayed = 0;
00142 uint32_t Logging::num_mc_acknowledgments_sent = 0;
00143 uint32_t Logging::num_mc_acknowledgments_relayed = 0;
00144 uint32_t Logging::num_mc_rreq_sent = 0;
00145 uint32_t Logging::num_mc_rrep_sent = 0;
00146 uint32_t Logging::num_mc_ract_sent = 0;
00147 uint32_t Logging::num_mc_relay_selection_sent = 0;
00148 uint32_t Logging::num_mc_total_frames_sent = 0;
00149 
00150 
00151 /* mc frames sent 
00152 uint32_t Logging::num_mc_unique_data_frames_received_directly = 0;
00153 uint32_t Logging::num_mc_unique_data_frames_received_relay = 0;
00154 uint32_t Logging::num_mc_data_frames_received_directly = 0;
00155 uint32_t Logging::num_mc_data_frames_received_relay = 0;
00156 uint32_t Logging::num_mc_acknowledgments_received_directly = 0;
00157 uint32_t Logging::num_mc_acknowledgments_received_relay = 0;
00158 uint32_t Logging::num_mc_rreq_received = 0;
00159 uint32_t Logging::num_mc_rrep_received = 0;
00160 uint32_t Logging::num_mc_ract_received = 0;
00161 uint32_t Logging::num_mc_relay_selection_received = 0;
00162 uint32_t Logging::num_mc_duplicate_frames_received = 0;
00163 uint32_t Logging::num_mc_total_frames_received = 0;
00164 uint32_t Logging::num_mc_total_bytes_sent = 0;
00165 uint32_t Logging::num_mc_total_bytes_received = 0;
00166  */
00167 boost::mutex Logging::mtx_logging;
00168 
00169 
00170 
00171 #endif  /* LOGGING_H */


adhoc_communication
Author(s): Guenter Cwioro , Torsten Andre
autogenerated on Thu Jun 6 2019 20:59:42