|
@@ -35,7 +35,7 @@ static pcmsgbuffer gpcmsgbuf;
|
|
|
|
|
|
|
|
|
void uploadsend(::grpc::ServerReaderWriter<iv::UploadReplyStream, iv::UploadRequestStream>* stream,bool * pbrun,
|
|
|
- std::string * pstrvin,std::string * pstrmd5,bool *pbUpdatemd4orvin,QMutex * pmutex,int * preqid,qint64 * pnsendtime,QMutex * pmutexidtime)
|
|
|
+ std::string * pstrvin,std::string * pstrmd5,bool *pbUpdatemd4orvin,QMutex * pmutex,int * preqid,qint64 * pnsendtime,qint64 * recvtime,QMutex * pmutexidtime)
|
|
|
{
|
|
|
std::string strvin;
|
|
|
std::string strmd5;
|
|
@@ -71,6 +71,7 @@ void uploadsend(::grpc::ServerReaderWriter<iv::UploadReplyStream, iv::UploadRequ
|
|
|
pmutexidtime->lock();
|
|
|
reply.set_nreqsendtime(*pnsendtime);
|
|
|
reply.set_nreqid(*preqid);
|
|
|
+ reply.set_npausetime(QDateTime::currentMSecsSinceEpoch() - *recvtime);
|
|
|
pmutexidtime->unlock();
|
|
|
if(nres == 1)
|
|
|
{
|
|
@@ -111,6 +112,7 @@ void queryctrlsend(::grpc::ServerReaderWriter<iv::queryReplyStream, iv::queryReq
|
|
|
xTime.start();
|
|
|
int nlastsend = xTime.elapsed();
|
|
|
qint64 nlastdatatime = 0;
|
|
|
+ qint64 nculatency;
|
|
|
while(*pbrun)
|
|
|
{
|
|
|
if(*pbUpdatemd4orvin)
|
|
@@ -126,7 +128,7 @@ void queryctrlsend(::grpc::ServerReaderWriter<iv::queryReplyStream, iv::queryReq
|
|
|
qint64 ntime;
|
|
|
std::vector<char > xvectorquerydata;
|
|
|
|
|
|
- int nres = gcumsgbuf.getmsg(strvin,strmd5,nlastdatatime,id,ntime,&xvectorquerydata);
|
|
|
+ int nres = gcumsgbuf.getmsg(strvin,strmd5,nlastdatatime,id,ntime,&xvectorquerydata,&nculatency);
|
|
|
|
|
|
nlastdatatime = ntime;
|
|
|
|
|
@@ -138,6 +140,7 @@ void queryctrlsend(::grpc::ServerReaderWriter<iv::queryReplyStream, iv::queryReq
|
|
|
reply.set_xdata(xvectorquerydata.data(),xvectorquerydata.size());
|
|
|
reply.set_id(id);
|
|
|
reply.set_ntime(ntime);
|
|
|
+ reply.set_nculatency(nculatency);
|
|
|
stream->Write(reply);
|
|
|
nlastsend = xTime.elapsed();
|
|
|
}
|
|
@@ -170,9 +173,10 @@ class UploadServiceImpl final : public iv::UploadStream::Service {
|
|
|
QMutex uploadmutex;
|
|
|
int reqid = -1;
|
|
|
qint64 pnsendtime = 0;
|
|
|
+ qint64 nrecvtime = 0;
|
|
|
QMutex mutexidtime;
|
|
|
std::thread * pthread = new std::thread(uploadsend,stream,&brun,&strvin,&strctrlmd5,&bUpdatemd4orvin,&uploadmutex,
|
|
|
- &reqid,&pnsendtime,&mutexidtime);
|
|
|
+ &reqid,&pnsendtime,&nrecvtime,&mutexidtime);
|
|
|
std::cout<<"new connect."<<std::endl;
|
|
|
|
|
|
|
|
@@ -196,11 +200,14 @@ class UploadServiceImpl final : public iv::UploadStream::Service {
|
|
|
memcpy(xvectordata.data(),request.xdata().data(),request.xdata().size());
|
|
|
}
|
|
|
|
|
|
+ mutexidtime.lock();
|
|
|
reqid = request.id();
|
|
|
pnsendtime = request.nsendtime();
|
|
|
+ nrecvtime = QDateTime::currentMSecsSinceEpoch();
|
|
|
+ mutexidtime.unlock();
|
|
|
|
|
|
gcumsgbuf.addmsg(request.id(),request.ntime(),request.strvin(),request.strquerymd5(),request.strctrlmd5(),
|
|
|
- &xvectordata,request.bimportant(),request.kepptime());
|
|
|
+ &xvectordata,request.bimportant(),request.kepptime(),request.nlatency());
|
|
|
|
|
|
}
|
|
|
std::cout<<" no conn"<<std::endl;
|