#include #include #include "modulecomm.h" void * gpa; std::chrono::time_point> t1,t2; void testcall(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname) { qint64 sendtime; t2 = std::chrono::steady_clock::now(); double dr_ns = std::chrono::duration(t2-t1).count(); memcpy(&sendtime,strdata,8); qDebug("lat is %d ns is %f ",QDateTime::currentMSecsSinceEpoch() - sendtime,dr_ns); } void threadsend() { char * strdata = new char[3000000]; while(1) { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); qint64 ntime = QDateTime::currentMSecsSinceEpoch(); memcpy(strdata,&ntime,8); iv::modulecomm::ModuleSendMsg(gpa,strdata,2000000); t1 = std::chrono::steady_clock::now(); qDebug("send msg."); } } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); gpa = iv::modulecomm::RegisterSend("test1",3000000,1,iv::modulecomm::ModuleComm_INTERIOR); iv::modulecomm::RegisterRecv("test1",testcall,iv::modulecomm::ModuleComm_INTERIOR); std::thread * xthread = new std::thread(threadsend); return a.exec(); }