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
4cc88541
Commit
4cc88541
authored
May 08, 2022
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UNet): added processing statistics
parent
83afb896
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 @
4cc88541
...
@@ -182,7 +182,7 @@
...
@@ -182,7 +182,7 @@
</RTUExchange>
</RTUExchange>
<UDPExchange
name=
"UDPExchange"
/>
<UDPExchange
name=
"UDPExchange"
/>
<UDPExchange2
name=
"UDPExchange2"
/>
<UDPExchange2
name=
"UDPExchange2"
/>
<UNetExchange
name=
"UNetExchange"
transport=
"multicast"
/>
<UNetExchange
name=
"UNetExchange"
transport
1
=
"multicast"
/>
<HeartBeatTime
msec=
"5000"
/>
<HeartBeatTime
msec=
"5000"
/>
<NCReadyTimeout
msec=
"120000"
/>
<NCReadyTimeout
msec=
"120000"
/>
<TestGen
input1_s=
"Input1_S"
input2_s=
"DumpSensor1_S"
name=
"TestGen"
output1_c=
"DO_C"
output2_c=
"DO1_C"
/>
<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 @
4cc88541
...
@@ -303,13 +303,11 @@ void UNetReceiver::statisticsEvent(ev::periodic& tm, int revents) noexcept
...
@@ -303,13 +303,11 @@ void UNetReceiver::statisticsEvent(ev::periodic& tm, int revents) noexcept
return
;
return
;
}
}
statRecvPerSec
=
recvCount
;
auto
t_end
=
chrono
::
high_resolution_clock
::
now
();
statUpPerSec
=
upCount
;
float
sec
=
chrono
::
duration_cast
<
chrono
::
duration
<
float
>>
(
t_end
-
t_stats
).
count
();
t_stats
=
t_end
;
// unetlog9 << myname << "(statisctics):"
stats
.
recvPerSec
=
recvCount
/
sec
;
// << " recvCount=" << recvCount << "[per sec]"
stats
.
upPerSec
=
upCount
/
sec
;
// << " upCount=" << upCount << "[per sec]"
// << endl;
recvCount
=
0
;
recvCount
=
0
;
upCount
=
0
;
upCount
=
0
;
...
@@ -485,6 +483,7 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
...
@@ -485,6 +483,7 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
return
;
return
;
bool
ok
=
false
;
bool
ok
=
false
;
t_start
=
chrono
::
high_resolution_clock
::
now
();
try
try
{
{
...
@@ -510,6 +509,9 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
...
@@ -510,6 +509,9 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
std
::
lock_guard
<
std
::
mutex
>
l
(
tmMutex
);
std
::
lock_guard
<
std
::
mutex
>
l
(
tmMutex
);
ptRecvTimeout
.
reset
();
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
()
bool
UNetReceiver
::
checkConnection
()
...
@@ -565,6 +567,8 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
...
@@ -565,6 +567,8 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
bool
recvOk
=
checkConnection
();
bool
recvOk
=
checkConnection
();
// обновление данных в SM
// обновление данных в SM
t_start
=
chrono
::
high_resolution_clock
::
now
();
try
try
{
{
update
();
update
();
...
@@ -574,6 +578,9 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
...
@@ -574,6 +578,9 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
unetcrit
<<
myname
<<
"(updateEvent): "
<<
ex
.
what
()
<<
std
::
endl
;
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
)
if
(
sidRespond
!=
DefaultObjectId
)
{
{
try
try
...
@@ -822,15 +829,20 @@ const std::string UNetReceiver::getShortInfo() const noexcept
...
@@ -822,15 +829,20 @@ const std::string UNetReceiver::getShortInfo() const noexcept
<<
" lostPackets="
<<
setw
(
6
)
<<
getLostPacketsNum
()
<<
" lostPackets="
<<
setw
(
6
)
<<
getLostPacketsNum
()
<<
endl
<<
endl
<<
"
\t
["
<<
"
\t
["
<<
" recvTimeout="
<<
setw
(
6
)
<<
recvTimeout
<<
" recvTimeout="
<<
recvTimeout
<<
" prepareTime="
<<
setw
(
6
)
<<
prepareTime
<<
" prepareTime="
<<
prepareTime
<<
" evrunTimeout="
<<
setw
(
6
)
<<
evrunTimeout
<<
" evrunTimeout="
<<
evrunTimeout
<<
" lostTimeout="
<<
setw
(
6
)
<<
lostTimeout
<<
" lostTimeout="
<<
lostTimeout
<<
" updatepause="
<<
setw
(
6
)
<<
updatepause
<<
" updatepause="
<<
updatepause
<<
" maxDifferens="
<<
setw
(
6
)
<<
maxDifferens
<<
" maxDifferens="
<<
maxDifferens
<<
" ]"
<<
" ]"
<<
endl
<<
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
();
return
s
.
str
();
}
}
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
4cc88541
...
@@ -209,10 +209,20 @@ namespace uniset
...
@@ -209,10 +209,20 @@ namespace uniset
// счётчики для подсчёта статистики
// счётчики для подсчёта статистики
size_t
recvCount
=
{
0
};
size_t
recvCount
=
{
0
};
size_t
upCount
=
{
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
};
/*!< количество принимаемых пакетов в секунду */
struct
Stats
size_t
statUpPerSec
=
{
0
};
/*!< количество обработанных пакетов в секунду */
{
float
recvPerSec
=
{
0
};
/*!< количество принимаемых пакетов в секунду */
float
upPerSec
=
{
0
};
/*!< количество обработанных пакетов в секунду */
size_t
upProcessingTime_microsec
=
{
0
};
/*!< время обработки данных */
size_t
recvProcessingTime_microsec
=
{
0
};
/*!< время обработки получения данных */
};
Stats
stats
;
// делаем loop общим.. одним на всех!
// делаем loop общим.. одним на всех!
static
CommonEventLoop
loop
;
static
CommonEventLoop
loop
;
...
...
extensions/UNetUDP/tests/tests_individual_process.cc
View file @
4cc88541
...
@@ -30,8 +30,8 @@ int main(int argc, char* argv[] )
...
@@ -30,8 +30,8 @@ int main(int argc, char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
,
Catch
::
Session
::
OnUnusedOptions
::
Ignore
);
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
,
Catch
::
Session
::
OnUnusedOptions
::
Ignore
);
// if( returnCode != 0 ) // Indicates a command line error
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// return returnCode;
uniset_init
(
argc
,
argv
);
uniset_init
(
argc
,
argv
);
...
...
extensions/UNetUDP/tests/tests_multicast_with_sm.cc
View file @
4cc88541
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
// if( returnCode != 0 ) // Indicates a command line error
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// return returnCode;
auto
conf
=
uniset_init
(
argc
,
argv
);
auto
conf
=
uniset_init
(
argc
,
argv
);
...
...
extensions/UNetUDP/tests/tests_with_sm.cc
View file @
4cc88541
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
...
@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
int
returnCode
=
session
.
applyCommandLine
(
argc
,
argv
);
// if( returnCode != 0 ) // Indicates a command line error
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
// return returnCode;
auto
conf
=
uniset_init
(
argc
,
argv
);
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