Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima-camera-slsdetector
Commits
b9eea268
Commit
b9eea268
authored
Apr 09, 2020
by
Alejandro Homs Puron
Committed by
operator for beamline
Apr 27, 2020
Browse files
Add FrameMap delay_stat:
* Measure systematic delay drift between first and last items
parent
a0faa86e
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/SlsDetectorFrameMap.h
View file @
b9eea268
...
...
@@ -101,12 +101,16 @@ class FrameMap
FrameType
getLastFinishedFrame
()
const
{
return
getOldestFrame
(
getItemFrameArray
());
}
XYStat
::
LinRegress
calcDelayStat
()
{
return
m_delay_stat
.
calcLinRegress
();
}
private:
friend
class
Item
;
struct
AtomicCounter
{
int
count
;
Mutex
mutex
;
Timestamp
t0
;
void
set
(
int
reset
)
{
...
...
@@ -115,12 +119,17 @@ class FrameMap
mutex
.
unlock
();
}
bool
dec_test_and_reset
(
int
reset
)
bool
dec_test_and_reset
(
int
reset
,
double
&
delay
)
{
mutex
.
lock
();
Timestamp
t
=
Timestamp
::
now
();
if
(
count
==
reset
)
t0
=
t
;
bool
zero
=
(
--
count
==
0
);
if
(
zero
)
if
(
zero
)
{
count
=
reset
;
delay
=
t
-
t0
;
}
mutex
.
unlock
();
return
zero
;
}
...
...
@@ -132,6 +141,7 @@ class FrameMap
int
m_buffer_size
;
CounterList
m_frame_item_count_list
;
ItemList
m_item_list
;
XYStat
m_delay_stat
;
};
inline
bool
FrameMap
::
Item
::
isBadFrame
(
FrameType
frame
)
...
...
src/SlsDetectorCamera.cpp
View file @
b9eea268
...
...
@@ -210,6 +210,10 @@ void Camera::AcqThread::threadFunction()
m_cam
->
getStats
(
stats
);
DEB_ALWAYS
()
<<
DEB_VAR1
(
stats
);
FrameMap
&
m
=
m_cam
->
m_frame_map
;
XYStat
::
LinRegress
delay_stat
=
m
.
calcDelayStat
();
DEB_ALWAYS
()
<<
DEB_VAR1
(
delay_stat
);
if
(
had_frames
)
{
affinity_mgr
.
recvFinished
();
affinity_mgr
.
waitLimaFinished
();
...
...
src/SlsDetectorFrameMap.cpp
View file @
b9eea268
...
...
@@ -68,9 +68,12 @@ FrameMap::Item::frameFinished(FrameType frame, bool no_check, bool valid)
for
(
FrameType
f
=
m_last_frame
+
1
;
f
!=
(
frame
+
1
);
++
f
)
{
int
idx
=
f
%
m_map
->
m_buffer_size
;
AtomicCounter
&
count
=
m_map
->
m_frame_item_count_list
[
idx
];
bool
finished
=
count
.
dec_test_and_reset
(
nb_items
);
if
(
finished
)
double
delay
;
bool
finished
=
count
.
dec_test_and_reset
(
nb_items
,
delay
);
if
(
finished
)
{
finfo
.
finished
.
insert
(
f
);
m_map
->
m_delay_stat
.
add
(
frame
,
delay
);
}
}
if
(
DEB_CHECK_ANY
(
DebTypeReturn
))
{
...
...
@@ -133,6 +136,8 @@ void FrameMap::clear()
CounterList
::
iterator
cit
,
cend
=
count_list
.
end
();
for
(
cit
=
count_list
.
begin
();
cit
!=
cend
;
++
cit
)
cit
->
set
(
m_nb_items
);
m_delay_stat
.
reset
();
}
FrameArray
FrameMap
::
getItemFrameArray
()
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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