USRP_Server  2.0
A flexible, GPU-accelerated radio-frequency readout software.
USRP_server_diagnostic.cpp
Go to the documentation of this file.
2 
3 //Set the htread name reported in the logging.
4 void set_this_thread_name(std::string thread_name){
5 
6  boost::log::core::get()->add_thread_attribute("ThreadName",
7  boost::log::attributes::constant< std::string >(thread_name));
8 
9  pthread_setname_np(pthread_self(), thread_name.c_str());
10 
11 }
12 
13 //print on screen error description
14 void interptet_rx_error(uhd::rx_metadata_t::error_code_t error){
15 
16  switch(error){
17 
18  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_NONE:
19  print_warning("RX error: Interpreter called on a error free packet.");
20  break;
21  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_TIMEOUT:
22  print_warning("RX error: No packet received, implementation timed-out.");
23  break;
24  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_LATE_COMMAND:
25  print_warning("RX error: A stream command was issued in the past.");
26  break;
27  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_BROKEN_CHAIN:
28  print_warning("RX error: Expected another stream command.");
29  break;
30  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_OVERFLOW:
31  print_warning("RX error: An internal receive buffer has filled or a sequence error has been detected (see next warning).");
32  break;
33  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_ALIGNMENT:
34  print_warning("RX error: Multi-channel alignment failed.");
35  break;
36  case uhd::rx_metadata_t::error_code_t::ERROR_CODE_BAD_PACKET:
37  print_warning("RX error: The packet could not be parsed.");
38  break;
39 
40  }
41 
42 }
43 
44 int get_rx_errors(uhd::rx_metadata_t *metadata, bool verbose){
45 
46  //initialize error counter
47  int error = 0;
48 
49  //maximum result will be one in this configuration
50  if(metadata->error_code != uhd::rx_metadata_t::error_code_t::ERROR_CODE_NONE){
51  error=1;
52  if(verbose){
53  interptet_rx_error(metadata->error_code);
54  if(metadata->out_of_sequence)print_warning("RX error: was a sequence error.");
55  }
56  }
57  //if(metadata->fragment_offset!=0)print_warning("RX metadata shows fragmentation of the single packet transmission. Try reducing the buffer length.");
58  if(metadata->more_fragments)print_error("RX buffer mismatch!");
59 
60  return error;
61 }
62 
63 int get_tx_error(uhd::async_metadata_t *async_md, bool verbose){
64  int error = 0;
65  switch(async_md->event_code){
66  /*
67  case 0 :
68  if(verbose)print_warning("TX async metadata non init");
69  break;
70  */
71  case uhd::async_metadata_t::EVENT_CODE_TIME_ERROR:
72  if(verbose)print_warning("TX thread encountered a time error");
73  error++;
74  break;
75 
76  case uhd::async_metadata_t::EVENT_CODE_BURST_ACK:
77  break;
78 
79  case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW:
80  if(verbose)print_warning("TX thread encountered an undeflow");
81  error++;
82  break;
83  case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR:
84  if(verbose)print_warning("TX thread encountered a sequence error");
85  error++;
86  break;
87  case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET:
88  if(verbose)print_warning("TX thread encountered an undeflow in packet");
89  error++;
90  break;
91  case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST:
92  if(verbose)print_warning("TX thread encountered a sequence error in burst");
93  error++;
94  break;
95  default:
96  if(verbose){
97  std::stringstream ss;
98  ss << boost::format("TX thread got unexpected event code 0x%x.\n") % async_md->event_code << std::endl;
99  print_error(ss.str());
100  }
101  error++;
102  break;
103  }
104  return error;
105 
106 }
107 
108 void print_params(usrp_param my_parameter){
109 
110  bool A_TXRX = true;
111  bool B_TXRX = true;
112  bool A_RX2 = true;
113  bool B_RX2 = true;
114 
115  std::stringstream ss;
116  boost::format position_formatting("%=1.1e");
117 
118  ss << "\033[40;1;37m A N A L O G P A R A M E T E R S \033[0m"<<std::endl;
119  ss <<"------------------------------------------------------------------------"<<std::endl;
120  ss <<" device on-server ID: "<< my_parameter.usrp_number << " "<<std::endl;
121  ss <<"------------------------------------------------------------------------"<<std::endl;
122  ss << " board-> \033[40;1;37m RF A \033[0m";
123  ss << " \033[40;1;37m RF B \033[0m"<<std::endl<<std::endl;
124  ss << " ant-> " << "\033[40;1;32m TX/RX \033[0m ";
125  ss << "\033[40;1;32m RX2 \033[0m ";
126  ss << "\033[40;1;32m TX/RX \033[0m ";
127  ss << "\033[40;1;32m RX2 \033[0m "<<std::endl<<std::endl;
128  ss <<" param "<<std::endl;
129 
130  ss << "\033[47;1;30m MODE \033[0m"<<"\t ";
131 
132  ss << ant_mode_to_str(my_parameter.A_TXRX.mode)<< "\t\t";
133  ss << ant_mode_to_str(my_parameter.A_RX2.mode)<< "\t\t";
134  ss << ant_mode_to_str(my_parameter.B_TXRX.mode)<< "\t\t";
135  ss << ant_mode_to_str(my_parameter.B_RX2.mode)<< std::endl;
136 
137  ss << std::scientific;
138 
139  if(my_parameter.A_TXRX.mode == OFF) A_TXRX = false;
140  if(my_parameter.B_TXRX.mode == OFF) B_TXRX = false;
141  if(my_parameter.A_RX2.mode == OFF) A_RX2 = false;
142  if(my_parameter.B_RX2.mode == OFF) B_RX2 = false;
143 
144  ss << "\033[47;1;30m RATE \033[0m"<<" ";
145 
146  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.rate/1e6)).str():(std::string)" - ") << " ";
147  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.rate/1e6)).str():(std::string)" - ") << " ";
148  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.rate/1e6)).str():(std::string)" - ") << " ";
149  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.rate/1e6)).str():(std::string)" - ") << "\t[MHz]"<<std::endl;
150 
151 
152  ss << "\033[47;1;30m GAIN \033[0m"<<" ";
153 
154  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.gain/1.)).str():(std::string)" - ") << " ";
155  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.gain/1.)).str():(std::string)" - ") << " ";
156  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.gain/1.)).str():(std::string)" - ") << " ";
157  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.gain/1.)).str():(std::string)" - ") << "\t[dB]"<<std::endl;
158 
159  ss << "\033[47;1;30m TONE \033[0m"<<" ";
160 
161  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.tone/1e6)).str():(std::string)" - ") << " ";
162  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.tone/1e6)).str():(std::string)" - ") << " ";
163  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.tone/1e6)).str():(std::string)" - ") << " ";
164  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.tone/1e6)).str():(std::string)" - ") << "\t[MHz]"<<std::endl;
165 
166  ss << "\033[47;1;30m DELAY \033[0m"<<" ";
167 
168  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.delay*1e3)).str():(std::string)" - ") << " ";
169  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.delay*1e3)).str():(std::string)" - ") << " ";
170  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.delay*1e3)).str():(std::string)" - ") << " ";
171  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.delay*1e3)).str():(std::string)" - ") << "\t[msec]"<<std::endl;
172 
173  ss << "\033[47;1;30m BW \033[0m"<<" ";
174 
175  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.bw/1e6)).str():(std::string)" - ") << " ";
176  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.bw/1e6)).str():(std::string)" - ") << " ";
177  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.bw/1e6)).str():(std::string)" - ") << " ";
178  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.bw/1e6)).str():(std::string)" - ") << "\t[MHz]"<<std::endl;
179 
180  ss << "\033[47;1;30m #SIGs \033[0m"<<" ";
181 
182  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.wave_type.size()/1.)).str():(std::string)" - ") << " ";
183  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.wave_type.size()/1.)).str():(std::string)" - ") << " ";
184  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.wave_type.size()/1.)).str():(std::string)" - ") << " ";
185  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.wave_type.size()/1.)).str():(std::string)" - ") << "\t[#]"<<std::endl;
186 
187  ss << "\033[47;1;30m #samp \033[0m"<<" ";
188 
189  ss << (A_TXRX?(position_formatting % (my_parameter.A_TXRX.samples/1.)).str():(std::string)" - ") << " ";
190  ss << (A_RX2?(position_formatting % (my_parameter.A_RX2.samples/1.)).str():(std::string)" - ") << " ";
191  ss << (B_TXRX?(position_formatting % (my_parameter.B_TXRX.samples/1.)).str():(std::string)" - ") << " ";
192  ss << (B_RX2?(position_formatting % (my_parameter.B_RX2.samples/1.)).str():(std::string)" - ") << "\t[#]"<<std::endl;
193 
194  ss << "\033[47;1;30m tun_m \033[0m"<<" ";
195  ss << (A_TXRX?(my_parameter.A_TXRX.tuning_mode?"fractio":"integer"):(std::string)" - ") << " ";
196  ss << (A_RX2?(my_parameter.A_TXRX.tuning_mode?"fractio":"integer"):(std::string)" - ") << " ";
197  ss << (B_TXRX?(my_parameter.A_TXRX.tuning_mode?"fractio":"integer"):(std::string)" - ") << " ";
198  ss << (B_RX2?(my_parameter.A_TXRX.tuning_mode?"fractio":"integer"):(std::string)" - ") << "\t[-]"<<std::endl;
199 
200  ss << std::endl;
201  ss << "\033[40;1;37m S I G N A L S P A R A M E T E R S \033[0m"<<std::endl<<std::endl;
202 
203  if(A_TXRX){
204 
205  ss << "\033[40;1;32mRF A TX/RX No. of signals: ";
206  ss << my_parameter.A_TXRX.wave_type.size()<<" \033[0m"<<std::endl<<std::endl;
207  ss << "\033[40;1;32mRF Buffer lenght: "<<my_parameter.A_TXRX.buffer_len;
208  if(my_parameter.A_TXRX.wave_type[0] != CHIRP and my_parameter.A_TXRX.mode == RX){
209  ss << " PFB points: "<<my_parameter.A_TXRX.fft_tones;
210  ss << " PFB average: "<< my_parameter.A_TXRX.pf_average<<" \033[0m"<<std::endl<<std::endl;
211  }else{
212  ss <<" "<<" \033[0m"<<std::endl<<std::endl;
213  }
214 
215  ss << "\033[47;1;30m No \033[0m"<<" "<< "\033[47;1;30m AMP \033[0m"<<" "<<"\033[47;1;30m FREQ \033[0m"<<" ";
216  ss << "\033[47;1;30m 2 FRQ \033[0m"<<" "<< "\033[47;1;30m STEPS \033[0m"<<" "<<"\033[47;1;30m LAPSE \033[0m"<< "";
217  ss << "\033[47;1;30m TYPE \033[0m"<<std::endl;
218  for(size_t i = 0; i<my_parameter.A_TXRX.wave_type.size();i++){
219 
220  ss << " "<<(position_formatting % (i)).str() <<" ";
221  ss << (position_formatting % (my_parameter.A_TXRX.ampl[i]/1.)).str() <<" ";
222  ss << (position_formatting % (my_parameter.A_TXRX.freq[i]/1e6)).str() <<" ";
223  try{
224  ss << ((my_parameter.A_TXRX.wave_type[i] == CHIRP )?((position_formatting % (my_parameter.A_TXRX.chirp_f.at(i)/1e6)).str()):(std::string)(" - "))<<" ";
225  ss << ((my_parameter.A_TXRX.wave_type[i] == CHIRP )?((position_formatting % (my_parameter.A_TXRX.swipe_s.at(i)/1.)).str()):(std::string) " - ") <<" ";
226  ss << ((my_parameter.A_TXRX.wave_type[i] == CHIRP )?((position_formatting % (my_parameter.A_TXRX.chirp_t.at(i)*1e3)).str()):(std::string) " - ") <<" ";
227  }catch(std::exception& error){
228  print_error("Cannot print parameters! description of CHIRP signals inside global param is not coehrent!");
229  return ;
230  }
231  ss << w_type_to_str(my_parameter.A_TXRX.wave_type[i]) <<std::endl;
232  }
233  ss << " [#] [linear] [MHZ] [MHz] [#] [msec]"<<std::endl<<std::endl;
234 
235  }
236  if(A_RX2){
237  ss << "\033[40;1;32mRF A RX2 No. of signals: ";
238  ss << my_parameter.A_RX2.wave_type.size()<<" \033[0m"<<std::endl<<std::endl;
239  ss << "\033[40;1;32mRF Buffer lenght: "<<my_parameter.A_RX2.buffer_len;
240  if(my_parameter.A_RX2.wave_type[0] != CHIRP and my_parameter.A_RX2.mode == RX){
241  ss << " PFB points: "<<my_parameter.A_RX2.fft_tones;
242  ss << " PFB average: "<< my_parameter.A_RX2.pf_average<<" \033[0m"<<std::endl<<std::endl;
243  }else{
244  ss <<" "<<" \033[0m"<<std::endl<<std::endl;
245  }
246  ss << "\033[47;1;30m No \033[0m"<<" "<< "\033[47;1;30m AMP \033[0m"<<" "<<"\033[47;1;30m FREQ \033[0m"<<" ";
247  ss << "\033[47;1;30m 2 FRQ \033[0m"<<" "<< "\033[47;1;30m STEPS \033[0m"<<" "<<"\033[47;1;30m LAPSE \033[0m"<< "";
248  ss << "\033[47;1;30m TYPE \033[0m"<<std::endl;
249  for(size_t i = 0; i<my_parameter.A_RX2.wave_type.size();i++){
250  ss << " "<<(position_formatting % (i)).str() <<" ";
251  ss << (position_formatting % (my_parameter.A_RX2.ampl[i]/1.)).str() <<" ";
252  ss << (position_formatting % (my_parameter.A_RX2.freq[i]/1e6)).str() <<" ";
253  try{
254  ss << ((my_parameter.A_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.A_RX2.chirp_f.at(i)/1e6)).str()):(std::string)(" - "))<<" ";
255  ss << ((my_parameter.A_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.A_RX2.swipe_s.at(i)/1.)).str()):(std::string) " - ") <<" ";
256  ss << ((my_parameter.A_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.A_RX2.chirp_t.at(i)*1e3)).str()):(std::string) " - ") <<" ";
257  }catch(std::exception& error){
258  print_error("Cannot print parameters! description of CHIRP signals inside global param is not coehrent!");
259  return ;
260  }
261  ss << w_type_to_str(my_parameter.A_RX2.wave_type[i]) <<std::endl;
262  }
263  ss << " [#] [linear] [MHZ] [MHz] [#] [msec]"<<std::endl<<std::endl;
264 
265  }
266  if(B_TXRX){
267  ss << "\033[40;1;32mRF B TX/RX No. of signals: ";
268  ss << my_parameter.B_TXRX.wave_type.size()<<" \033[0m"<<std::endl<<std::endl;
269  ss << "\033[40;1;32mRF Buffer lenght: "<<my_parameter.B_TXRX.buffer_len;
270  if(my_parameter.B_TXRX.wave_type[0] != CHIRP and my_parameter.B_TXRX.mode == RX){
271  ss << " PFB points: "<<my_parameter.B_TXRX.fft_tones;
272  ss << " PFB average: "<< my_parameter.B_TXRX.pf_average<<" \033[0m"<<std::endl<<std::endl;
273  }else{
274  ss <<" "<<" \033[0m"<<std::endl<<std::endl;
275  }
276  ss << "\033[47;1;30m No \033[0m"<<" "<< "\033[47;1;30m AMP \033[0m"<<" "<<"\033[47;1;30m FREQ \033[0m"<<" ";
277  ss << "\033[47;1;30m 2 FRQ \033[0m"<<" "<< "\033[47;1;30m STEPS \033[0m"<<" "<<"\033[47;1;30m LAPSE \033[0m"<< "";
278  ss << "\033[47;1;30m TYPE \033[0m"<<std::endl;
279 
280 
281  for(size_t i = 0; i<my_parameter.B_TXRX.wave_type.size();i++){
282  ss << " "<<(position_formatting % (i)).str() <<" ";
283  ss << (position_formatting % (my_parameter.B_TXRX.ampl[i]/1.)).str() <<" ";
284  ss << (position_formatting % (my_parameter.B_TXRX.freq[i]/1e6)).str() <<" ";
285  try{
286  ss << ((my_parameter.B_TXRX.wave_type[i] == CHIRP )?((position_formatting % (my_parameter.B_TXRX.chirp_f.at(i)/1e6)).str()):(std::string)(" - "))<<" ";
287  ss << ((my_parameter.B_TXRX.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.B_TXRX.swipe_s.at(i)/1.)).str()):(std::string) " - ") <<" ";
288  ss << ((my_parameter.B_TXRX.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.B_TXRX.chirp_t.at(i)*1e3)).str()):(std::string) " - ") <<" ";
289  }catch(std::exception& error){
290  print_error("Cannot print parameters! description of SWIPE signals inside global param is not coehrent!");
291  return ;
292  }
293  ss << w_type_to_str(my_parameter.B_TXRX.wave_type[i]) <<std::endl;
294  }
295  ss << " [#] [linear] [MHZ] [MHz] [#] [msec]"<<std::endl<<std::endl;
296 
297  }
298  if(B_RX2){
299  ss << "\033[40;1;32mRF B RX2 No. of signals: ";
300  ss << my_parameter.B_RX2.wave_type.size()<<" \033[0m"<<std::endl<<std::endl;
301  ss << "\033[40;1;32mRF Buffer lenght: "<<my_parameter.B_RX2.buffer_len;
302  if(my_parameter.B_RX2.wave_type[0] != CHIRP and my_parameter.B_RX2.mode == RX){
303  ss << " PFB points: "<<my_parameter.B_RX2.fft_tones;
304  ss << " PFB average: "<< my_parameter.B_RX2.pf_average<<" \033[0m"<<std::endl<<std::endl;
305  }else{
306  ss <<" "<<" \033[0m"<<std::endl<<std::endl;
307  }
308  ss << "\033[47;1;30m No \033[0m"<<" "<< "\033[47;1;30m AMP \033[0m"<<" "<<"\033[47;1;30m FREQ \033[0m"<<" ";
309  ss << "\033[47;1;30m 2 FRQ \033[0m"<<" "<< "\033[47;1;30m STEPS \033[0m"<<" "<<"\033[47;1;30m LAPSE \033[0m"<< "";
310  ss << "\033[47;1;30m TYPE \033[0m"<<std::endl;
311  for(size_t i = 0; i<my_parameter.B_RX2.wave_type.size();i++){
312  ss << " "<<(position_formatting % (i)).str() <<" ";
313  ss << (position_formatting % (my_parameter.B_RX2.ampl[i]/1.)).str() <<" ";
314  ss << (position_formatting % (my_parameter.B_RX2.freq[i]/1e6)).str() <<" ";
315  try{
316  ss << ((my_parameter.B_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.B_RX2.chirp_f.at(i)/1e6)).str()):(std::string)(" - "))<<" ";
317  ss << ((my_parameter.B_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.B_RX2.swipe_s.at(i)/1.)).str()):(std::string) " - ") <<" ";
318  ss << ((my_parameter.B_RX2.wave_type[i] == CHIRP)?((position_formatting % (my_parameter.B_RX2.chirp_t.at(i)*1e3)).str()):(std::string) " - ") <<" ";
319  }catch(std::exception& error){
320  print_error("Cannot print parameters! description of SWIPE signals inside global param is not coehrent!");
321  return ;
322  }
323  ss << w_type_to_str(my_parameter.B_RX2.wave_type[i]) <<std::endl;
324  }
325  ss << " [#] [linear] [MHZ] [MHz] [#] [msec]"<<std::endl<<std::endl;
326 
327  }
328  std::cout << ss.str();
329 
330 }
331 
332 
334  start_t = boost::chrono::high_resolution_clock::now();
335 
336 }
337 
339  start_t = boost::chrono::high_resolution_clock::now();
340  elapsed_time = get_time();
341  state = true;
342 }
343 
345  double y = get_time();
346  double x = y - elapsed_time;
347  if(state){
348  total_time+=x;
349  state = false;
350  }
351 }
352 
354  start_t = boost::chrono::high_resolution_clock::now();
355  total_time = 0;
356  state = false;
357 }
358 
360  if(state){
361  print_warning("Getting a running stopwatch value");
362  }
363  return total_time;
364 }
365 
367  acc.push_back(total_time);
368  if(state){
369  print_warning("Storing a running stopwatch value");
370  }
371 }
372 
374  if(state){
375  print_warning("Getting the average of a running stopwatch");
376  }
377  double avg = 0;
378  for(size_t i = 0; i < acc.size(); i++){
379  avg += acc[i];
380  }
381  avg/=acc.size();
382  return avg;
383 }
384 
386  stop();
387  store();
388  reset();
389 }
390 
391 double stop_watch::get_time(){
392  boost::chrono::nanoseconds ns = boost::chrono::high_resolution_clock::now() - start_t;
393  return 1e-9 * ns.count();
394 }
395 
396 // The formatting logic for the severity level
397 template< typename CharT, typename TraitsT >
398 inline std::basic_ostream< CharT, TraitsT >& operator<< (
399  std::basic_ostream< CharT, TraitsT >& strm, severity_level lvl)
400 {
401  static const char* const str[] =
402  {
403  "DEBUG",
404  "INFO",
405  "WARNING",
406  "ERROR",
407  "CRITICAL",
408  "TRACE"
409  };
410  if (static_cast< std::size_t >(lvl) < (sizeof(str) / sizeof(*str)))
411  strm << str[lvl];
412  else
413  strm << static_cast< int >(lvl);
414  return strm;
415 }
416 
417 
418 boost::shared_ptr< file_sink > pLogSink;
419 
420 
421 void init_logger(){
422  boost::log::register_simple_formatter_factory< boost::log::trivial::severity_level, char >("Severity");
423  pLogSink = logging::add_file_log
424  (
425  keywords::file_name = "logs/%Y%m%d_%H%M%S_%5N.log",
426  keywords::rotation_size = 10 * 1024 * 1024,
427  keywords::auto_flush = true,
428  keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),
429  keywords::format = "%TimeStamp%;%ThreadName%;%Severity%;%Message%"
430  );
431  logging::core::get()->add_global_attribute("ThreadName", boost::log::attributes::constant<std::string> ("Unknown"));
432 
433  /*
434  logging::core::get()->set_filter
435  (
436  logging::trivial::severity >= logging::trivial::info
437  );
438  */
439 }
std::string ant_mode_to_str(ant_mode enumerator)
void interptet_rx_error(uhd::rx_metadata_t::error_code_t error)
boost::shared_ptr< file_sink > pLogSink
Shared pointer to the logfile writer object.
std::string w_type_to_str(w_type enumerator)
void print_error(std::string text)
std::basic_ostream< CharT, TraitsT > & operator<<(std::basic_ostream< CharT, TraitsT > &strm, severity_level lvl)
void set_this_thread_name(std::string thread_name)
Set the htread name reported in the logging.
void print_params(usrp_param my_parameter)
Print parameters on the terminal in a readable way.
int get_rx_errors(uhd::rx_metadata_t *metadata, bool verbose)
void print_warning(std::string text)
void init_logger()
initialize the logger for the server. Creates or access the folder logs. each time the server starts...
int get_tx_error(uhd::async_metadata_t *async_md, bool verbose)
Interpret tx errors from the async usrp comunication.