main.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // Created by zx on 2020/6/18.
  3. //
  4. #include <iostream>
  5. #include "./error_code/error_code.h"
  6. //#include "LogFiles.h"
  7. #include <glog/logging.h>
  8. #include "./communication/communication_socket_base.h"
  9. #include "./tool/thread_pool.h"
  10. #include "./system/system_communication.h"
  11. #include "./system/system_executor.h"
  12. #include "./dispatch/dispatch_manager.h"
  13. #define LIVOX_NUMBER 2
  14. GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
  15. {
  16. time_t tt;
  17. time( &tt );
  18. tt = tt + 8*3600; // transform the time zone
  19. tm* t= gmtime( &tt );
  20. char buf[255]={0};
  21. sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt",
  22. t->tm_year + 1900,
  23. t->tm_mon + 1,
  24. t->tm_mday,
  25. t->tm_hour,
  26. t->tm_min,
  27. t->tm_sec);
  28. FILE* tp_file=fopen(buf,"w");
  29. fprintf(tp_file,data,strlen(data));
  30. fclose(tp_file);
  31. }
  32. #include <chrono>
  33. using namespace std;
  34. int main(int argc,char* argv[])
  35. {
  36. const char* logPath = "./";
  37. google::InitGoogleLogging("LidarMeasurement");
  38. google::SetStderrLogging(google::INFO);
  39. google::SetLogDestination(0, logPath);
  40. google::SetLogFilenameExtension("zxlog");
  41. google::InstallFailureSignalHandler();
  42. google::InstallFailureWriter(&shut_down_logging);
  43. FLAGS_colorlogtostderr = true; // Set log color
  44. FLAGS_logbufsecs = 0; // Set log output speed(s)
  45. FLAGS_max_log_size = 1024; // Set max log file size(GB)
  46. FLAGS_stop_logging_if_full_disk = true;
  47. int t_dispatch_id = 0;
  48. // std::cin >> t_dispatch_id ;
  49. if ( argc == 2 )
  50. {
  51. std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl;
  52. t_dispatch_id = atoi(argv[1]);
  53. }
  54. std::cout << " huli test :::: " << " t_dispatch_id = " << t_dispatch_id << std::endl;
  55. Dispatch_manager::get_instance_references().dispatch_manager_init(t_dispatch_id);
  56. std::cout << "Dispatch_manager = " << Dispatch_manager::get_instance_references().get_dispatch_manager_status() << std::endl;
  57. System_executor::get_instance_references().system_executor_init(8);
  58. std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
  59. System_communication::get_instance_references().communication_init();
  60. char ch ;
  61. std::cin >> ch ;
  62. System_communication::get_instance_references().communication_uninit();
  63. System_executor::get_instance_references().system_executor_uninit();
  64. Dispatch_manager::get_instance_references().dispatch_manager_uninit();
  65. return 0;
  66. }