Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
f2a71850
Commit
f2a71850
authored
May 08, 2022
by
Pavel Vainerman
Committed by
Pavel Vainerman
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UNet): added processing statistics
parent
8959f350
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
23 deletions
+45
-23
test.xml
conf/test.xml
+1
-1
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+26
-14
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+12
-2
tests_individual_process.cc
extensions/UNetUDP/tests/tests_individual_process.cc
+2
-2
tests_multicast_with_sm.cc
extensions/UNetUDP/tests/tests_multicast_with_sm.cc
+2
-2
tests_with_sm.cc
extensions/UNetUDP/tests/tests_with_sm.cc
+2
-2
No files found.
conf/test.xml
View file @
f2a71850
...
...
@@ -182,7 +182,7 @@
</RTUExchange>
<UDPExchange
name=
"UDPExchange"
/>
<UDPExchange2
name=
"UDPExchange2"
/>
<UNetExchange
name=
"UNetExchange"
transport=
"multicast"
/>
<UNetExchange
name=
"UNetExchange"
transport
1
=
"multicast"
/>
<HeartBeatTime
msec=
"5000"
/>
<NCReadyTimeout
msec=
"120000"
/>
<TestGen
input1_s=
"Input1_S"
input2_s=
"DumpSensor1_S"
name=
"TestGen"
output1_c=
"DO_C"
output2_c=
"DO1_C"
/>
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
f2a71850
...
...
@@ -303,13 +303,11 @@ void UNetReceiver::statisticsEvent(ev::periodic& tm, int revents) noexcept
return
;
}
statRecvPerSec
=
recvCount
;
statUpPerSec
=
upCount
;
// unetlog9 << myname << "(statisctics):"
// << " recvCount=" << recvCount << "[per sec]"
// << " upCount=" << upCount << "[per sec]"
// << endl;
auto
t_end
=
chrono
::
high_resolution_clock
::
now
();
float
sec
=
chrono
::
duration_cast
<
chrono
::
duration
<
float
>>
(
t_end
-
t_stats
).
count
();
t_stats
=
t_end
;
stats
.
recvPerSec
=
recvCount
/
sec
;
stats
.
upPerSec
=
upCount
/
sec
;
recvCount
=
0
;
upCount
=
0
;
...
...
@@ -485,6 +483,7 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
return
;
bool
ok
=
false
;
t_start
=
chrono
::
high_resolution_clock
::
now
();
try
{
...
...
@@ -510,6 +509,9 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
std
::
lock_guard
<
std
::
mutex
>
l
(
tmMutex
);
ptRecvTimeout
.
reset
();
}
t_end
=
chrono
::
high_resolution_clock
::
now
();
stats
.
recvProcessingTime_microsec
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
t_end
-
t_start
).
count
();
}
// -----------------------------------------------------------------------------
bool
UNetReceiver
::
checkConnection
()
...
...
@@ -565,6 +567,8 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
bool
recvOk
=
checkConnection
();
// обновление данных в SM
t_start
=
chrono
::
high_resolution_clock
::
now
();
try
{
update
();
...
...
@@ -574,6 +578,9 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
unetcrit
<<
myname
<<
"(updateEvent): "
<<
ex
.
what
()
<<
std
::
endl
;
}
t_end
=
chrono
::
high_resolution_clock
::
now
();
stats
.
upProcessingTime_microsec
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
t_end
-
t_start
).
count
();
if
(
sidRespond
!=
DefaultObjectId
)
{
try
...
...
@@ -822,15 +829,20 @@ const std::string UNetReceiver::getShortInfo() const noexcept
<<
" lostPackets="
<<
setw
(
6
)
<<
getLostPacketsNum
()
<<
endl
<<
"
\t
["
<<
" recvTimeout="
<<
setw
(
6
)
<<
recvTimeout
<<
" prepareTime="
<<
setw
(
6
)
<<
prepareTime
<<
" evrunTimeout="
<<
setw
(
6
)
<<
evrunTimeout
<<
" lostTimeout="
<<
setw
(
6
)
<<
lostTimeout
<<
" updatepause="
<<
setw
(
6
)
<<
updatepause
<<
" maxDifferens="
<<
setw
(
6
)
<<
maxDifferens
<<
" recvTimeout="
<<
recvTimeout
<<
" prepareTime="
<<
prepareTime
<<
" evrunTimeout="
<<
evrunTimeout
<<
" lostTimeout="
<<
lostTimeout
<<
" updatepause="
<<
updatepause
<<
" maxDifferens="
<<
maxDifferens
<<
" ]"
<<
endl
<<
"
\t
[ qsize="
<<
(
wnum
-
rnum
)
<<
" recv="
<<
statRecvPerSec
<<
" update="
<<
statUpPerSec
<<
" per sec ]"
;
<<
"
\t
[ qsize:"
<<
setw
(
3
)
<<
(
wnum
-
rnum
)
<<
" recv:"
<<
setprecision
(
3
)
<<
setw
(
6
)
<<
stats
.
recvPerSec
<<
" msg/sec"
<<
" update:"
<<
setprecision
(
3
)
<<
setw
(
6
)
<<
stats
.
upPerSec
<<
" msg/sec"
<<
" upTime:"
<<
setw
(
6
)
<<
stats
.
upProcessingTime_microsec
<<
" usec"
<<
" recvTime:"
<<
setw
(
6
)
<<
stats
.
recvProcessingTime_microsec
<<
" usec"
<<
" ]"
;
return
s
.
str
();
}
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
f2a71850
...
...
@@ -209,10 +209,20 @@ namespace uniset
// счётчики для подсчёта статистики
size_t
recvCount
=
{
0
};
size_t
upCount
=
{
0
};
std
::
chrono
::
system_clock
::
time_point
t_start
;
std
::
chrono
::
system_clock
::
time_point
t_end
;
std
::
chrono
::
system_clock
::
time_point
t_stats
;
// текущая статистика
size_t
statRecvPerSec
=
{
0
};
/*!< количество принимаемых пакетов в секунду */
size_t
statUpPerSec
=
{
0
};
/*!< количество обработанных пакетов в секунду */
struct
Stats
{
float
recvPerSec
=
{
0
};
/*!< количество принимаемых пакетов в секунду */
float
upPerSec
=
{
0
};
/*!< количество обработанных пакетов в секунду */
size_t
upProcessingTime_microsec
=
{
0
};
/*!< время обработки данных */
size_t
recvProcessingTime_microsec
=
{
0
};
/*!< время обработки получения данных */
};
Stats
stats
;
// делаем loop общим.. одним на всех!
static
CommonEventLoop
loop
;
...
...
extensions/UNetUDP/tests/tests_individual_process.cc
View file @
f2a71850
...
...
@@ -30,8 +30,8 @@ int main(int argc, char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
,
Catch
::
Session
::
OnUnusedOptions
::
Ignore
);
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
uniset_init
(
argc
,
argv
);
...
...
extensions/UNetUDP/tests/tests_multicast_with_sm.cc
View file @
f2a71850
...
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto
conf
=
uniset_init
(
argc
,
argv
);
...
...
extensions/UNetUDP/tests/tests_with_sm.cc
View file @
f2a71850
...
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto
conf
=
uniset_init
(
argc
,
argv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment