12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //
- //
- // 20210425, hl_dispatch 和 hl_dispatch_B的版本进行同步, 此时调度管理的功能全部完成.后续可能还需要日志记录.
- //
- #include <iostream>
- #include "./error_code/error_code.h"
- //#include "LogFiles.h"
- #include <glog/logging.h>
- #include "./communication/communication_socket_base.h"
- #include "./tool/thread_pool.h"
- #include "./system/system_communication.h"
- #include "./system/system_executor.h"
- #include "./tool/common_data.h"
- #include <algorithm> // std::for_each
- GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
- {
- time_t tt;
- time( &tt );
- tt = tt + 8*3600; // transform the time zone
- tm* t= gmtime( &tt );
- char buf[255]={0};
- sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt",
- t->tm_year + 1900,
- t->tm_mon + 1,
- t->tm_mday,
- t->tm_hour,
- t->tm_min,
- t->tm_sec);
- FILE* tp_file=fopen(buf,"w");
- fprintf(tp_file,data,strlen(data));
- fclose(tp_file);
- }
- #include <chrono>
- using namespace std;
- int main(int argc,char* argv[])
- {
- int t_id = 0;
- if ( argc == 2 )
- {
- t_id = stoi(argv[1]);
- }
- Error_manager t_error;
- const char* logPath = "./";
- google::InitGoogleLogging("LidarMeasurement");
- google::SetStderrLogging(google::INFO);
- google::SetLogDestination(0, logPath);
- google::SetLogFilenameExtension("zxlog");
- google::InstallFailureSignalHandler();
- google::InstallFailureWriter(&shut_down_logging);
- FLAGS_colorlogtostderr = true; // Set log color
- FLAGS_logbufsecs = 0; // Set log output speed(s)
- FLAGS_max_log_size = 1024; // Set max log file size(GB)
- FLAGS_stop_logging_if_full_disk = true;
- //#define MAIN_TEST 1
- #ifdef MAIN_TEST
- System_executor::get_instance_references().system_executor_init(10);
- System_communication::get_instance_references().communication_init();
- System_communication::get_instance_references().set_encapsulate_cycle_time(1000);
- while (1)
- {
- std::string test_string;
- std::cin >> test_string ;
- if ( test_string == "9" )
- {
- }
- std::this_thread::sleep_for(std::chrono::seconds(1));
- }
- return 0;
- #endif
- return 0;
- }
|