|
|
@@ -9,6 +9,7 @@
|
|
|
#include <signal.h>
|
|
|
#include <sys/mman.h>
|
|
|
#include <fcntl.h>
|
|
|
+#include <sys/time.h>
|
|
|
|
|
|
#include "Devices//tmsgheaders.h"
|
|
|
#include "Devices//lmx2594.h"
|
|
|
@@ -162,10 +163,10 @@ int main(int argc, char *argv[])
|
|
|
//Очистка буфера
|
|
|
memset(recvBuff, 0, sizeof(recvBuff));
|
|
|
|
|
|
- while ((n = recv(conn_fd, recvBuff, sizeof(recvBuff) - 1, 0)) > 0)
|
|
|
+ n = recv(conn_fd, recvBuff, sizeof(recvBuff) - 1, 0);
|
|
|
+ struct timeval tv;
|
|
|
+ while (n > 0)
|
|
|
{
|
|
|
- recvBuff[n] = 0;
|
|
|
-
|
|
|
if(fputs(recvBuff, stdout) == EOF)
|
|
|
{
|
|
|
printf("\n Error : Fputs error\n");
|
|
|
@@ -188,6 +189,23 @@ int main(int argc, char *argv[])
|
|
|
// Ищем команды разделенные разделителем
|
|
|
ptrLexeme = strtok_r(NULL, charSeparator, &savePtr);
|
|
|
}
|
|
|
+
|
|
|
+ gettimeofday(&tv, NULL);
|
|
|
+
|
|
|
+ double time_begin = ((double)tv.tv_sec) * 1000 +
|
|
|
+ ((double)tv.tv_usec) / 1000;
|
|
|
+
|
|
|
+ recvBuff[n] = 0;
|
|
|
+
|
|
|
+ n = recv(conn_fd, recvBuff, sizeof(recvBuff) - 1, 0);
|
|
|
+
|
|
|
+ gettimeofday(&tv, NULL);
|
|
|
+ double time_end = ((double)tv.tv_sec) * 1000 +
|
|
|
+ ((double)tv.tv_usec) / 1000 ;
|
|
|
+
|
|
|
+ double total_time_ms = time_end - time_begin;
|
|
|
+
|
|
|
+ printf("TOTAL TIME (ms) = %f\n", total_time_ms);
|
|
|
}
|
|
|
|
|
|
if (n == 0)
|